protected function show_submit_button($submission = null, $teamsubmission = null, $userid = null) {
        if ($teamsubmission) {
            if ($teamsubmission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The assignment submission has been completed.
                return false;
            } else if ($this->submission_empty($teamsubmission)) {
                // There is nothing to submit yet.
                return false;
            } else if ($submission && $submission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The user has already clicked the submit button on the team submission.
                return false;
            } else if (
                !empty($this->get_instance()->preventsubmissionnotingroup)
                && $this->get_submission_group($userid) == false
            ) {
                return false;
            }
        } else if ($submission) {
            if ($submission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The assignment submission has been completed.
                return false;
            } else if ($this->submission_empty($submission)) {
                // There is nothing to submit.
                return false;
            }
        } else {
            // We've not got a valid submission or team submission.
            return false;
        }
        // Last check is that this instance allows drafts.
        return $this->get_instance()->submissiondrafts;
    }
protected function show_submit_button($submission = null, $teamsubmission = null, $userid = null) {
        if ($teamsubmission) {
            if ($teamsubmission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The assignment submission has been completed.
                return false;
            } else if ($this->submission_empty($teamsubmission)) {
                // There is nothing to submit yet.
                return false;
            } else if ($submission && $submission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The user has already clicked the submit button on the team submission.
                return false;
            } else if (
                !empty($this->get_instance()->preventsubmissionnotingroup)
                && $this->get_submission_group($userid) == false
            ) {
                return false;
            }
        } else if ($submission) {
            if ($submission->status === ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
                // The assignment submission has been completed.
                return false;
            } else if ($this->submission_empty($submission)) {
                // There is nothing to submit.
                return false;
            }
        } else {
            // We've not got a valid submission or team submission.
            return false;
        }
        // Last check is that this instance allows drafts.
        return $this->get_instance()->submissiondrafts;
    }
protected function show_submit_button ( $ submission = null , $ teamsubmission = null , $ userid = null ) { if ( $ teamsubmission ) { if ( $ teamsubmission -> status === ASSIGN_SUBMISSION_STATUS_SUBMITTED ) { // The assignment submission has been completed. return false ; } else if ( $ this -> submission_empty ( $ teamsubmission ) ) { // There is nothing to submit yet. return false ; } else if ( $ submission && $ submission -> status === ASSIGN_SUBMISSION_STATUS_SUBMITTED ) { // The user has already clicked the submit button on the team submission. return false ; } else if ( ! empty ( $ this -> get_instance ( ) -> preventsubmissionnotingroup ) && $ this -> get_submission_group ( $ userid ) == false ) { return false ; } } else if ( $ submission ) { if ( $ submission -> status === ASSIGN_SUBMISSION_STATUS_SUBMITTED ) { // The assignment submission has been completed. return false ; } else if ( $ this -> submission_empty ( $ submission ) ) { // There is nothing to submit. return false ; } } else { // We've not got a valid submission or team submission. return false ; } // Last check is that this instance allows drafts. return $ this -> get_instance ( ) -> submissiondrafts ; }
Returns true if the submit subsission button should be shown to the user.

@param stdClass $submission The users own submission record.
@param stdClass $teamsubmission The users team submission record if there is one
@param int $userid The user
@return bool
Returns true if the submit subsission button should be shown to the user .