original_string: public function add_submission_form_elements(MoodleQuickForm $mform, stdClass $data) {
          global $USER;
  
          $userid = $data->userid;
          // Team submissions.
          if ($this->get_instance()->teamsubmission) {
              $submission = $this->get_group_submission($userid, 0, false);
          } else {
              $submission = $this->get_user_submission($userid, false);
          }
  
          // Submission statement.
          $adminconfig = $this->get_admin_config();
          $requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement;
  
          $draftsenabled = $this->get_instance()->submissiondrafts;
          $submissionstatement = '';
  
          if ($requiresubmissionstatement) {
              $submissionstatement = $this->get_submissionstatement($adminconfig, $this->get_instance(), $this->get_context());
          }
  
          // If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent
          // that the submission statement checkbox will be displayed.
          if (empty($submissionstatement)) {
              $requiresubmissionstatement = false;
          }
  
          // Only show submission statement if we are editing our own submission.
          if ($requiresubmissionstatement && !$draftsenabled && $userid == $USER->id) {
              $mform->addElement('checkbox', 'submissionstatement', '', $submissionstatement);
              $mform->addRule('submissionstatement', get_string('required'), 'required', null, 'client');
          }
  
          $this->add_plugin_submission_elements($submission, $mform, $data, $userid);
  
          // Hidden params.
          $mform->addElement('hidden', 'id', $this->get_course_module()->id);
          $mform->setType('id', PARAM_INT);
  
          $mform->addElement('hidden', 'userid', $userid);
          $mform->setType('userid', PARAM_INT);
  
          $mform->addElement('hidden', 'action', 'savesubmission');
          $mform->setType('action', PARAM_ALPHA);
      }
code: public function add_submission_form_elements(MoodleQuickForm $mform, stdClass $data) {
          global $USER;
  
          $userid = $data->userid;
          // Team submissions.
          if ($this->get_instance()->teamsubmission) {
              $submission = $this->get_group_submission($userid, 0, false);
          } else {
              $submission = $this->get_user_submission($userid, false);
          }
  
          // Submission statement.
          $adminconfig = $this->get_admin_config();
          $requiresubmissionstatement = $this->get_instance()->requiresubmissionstatement;
  
          $draftsenabled = $this->get_instance()->submissiondrafts;
          $submissionstatement = '';
  
          if ($requiresubmissionstatement) {
              $submissionstatement = $this->get_submissionstatement($adminconfig, $this->get_instance(), $this->get_context());
          }
  
          // If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent
          // that the submission statement checkbox will be displayed.
          if (empty($submissionstatement)) {
              $requiresubmissionstatement = false;
          }
  
          // Only show submission statement if we are editing our own submission.
          if ($requiresubmissionstatement && !$draftsenabled && $userid == $USER->id) {
              $mform->addElement('checkbox', 'submissionstatement', '', $submissionstatement);
              $mform->addRule('submissionstatement', get_string('required'), 'required', null, 'client');
          }
  
          $this->add_plugin_submission_elements($submission, $mform, $data, $userid);
  
          // Hidden params.
          $mform->addElement('hidden', 'id', $this->get_course_module()->id);
          $mform->setType('id', PARAM_INT);
  
          $mform->addElement('hidden', 'userid', $userid);
          $mform->setType('userid', PARAM_INT);
  
          $mform->addElement('hidden', 'action', 'savesubmission');
          $mform->setType('action', PARAM_ALPHA);
      }
code_tokens: public function add_submission_form_elements ( MoodleQuickForm $ mform , stdClass $ data ) { global $ USER ; $ userid = $ data -> userid ; // Team submissions. if ( $ this -> get_instance ( ) -> teamsubmission ) { $ submission = $ this -> get_group_submission ( $ userid , 0 , false ) ; } else { $ submission = $ this -> get_user_submission ( $ userid , false ) ; } // Submission statement. $ adminconfig = $ this -> get_admin_config ( ) ; $ requiresubmissionstatement = $ this -> get_instance ( ) -> requiresubmissionstatement ; $ draftsenabled = $ this -> get_instance ( ) -> submissiondrafts ; $ submissionstatement = '' ; if ( $ requiresubmissionstatement ) { $ submissionstatement = $ this -> get_submissionstatement ( $ adminconfig , $ this -> get_instance ( ) , $ this -> get_context ( ) ) ; } // If we get back an empty submission statement, we have to set $requiredsubmisisonstatement to false to prevent // that the submission statement checkbox will be displayed. if ( empty ( $ submissionstatement ) ) { $ requiresubmissionstatement = false ; } // Only show submission statement if we are editing our own submission. if ( $ requiresubmissionstatement && ! $ draftsenabled && $ userid == $ USER -> id ) { $ mform -> addElement ( 'checkbox' , 'submissionstatement' , '' , $ submissionstatement ) ; $ mform -> addRule ( 'submissionstatement' , get_string ( 'required' ) , 'required' , null , 'client' ) ; } $ this -> add_plugin_submission_elements ( $ submission , $ mform , $ data , $ userid ) ; // Hidden params. $ mform -> addElement ( 'hidden' , 'id' , $ this -> get_course_module ( ) -> id ) ; $ mform -> setType ( 'id' , PARAM_INT ) ; $ mform -> addElement ( 'hidden' , 'userid' , $ userid ) ; $ mform -> setType ( 'userid' , PARAM_INT ) ; $ mform -> addElement ( 'hidden' , 'action' , 'savesubmission' ) ; $ mform -> setType ( 'action' , PARAM_ALPHA ) ; }
docstring: Add elements to submission form.
  @param MoodleQuickForm $mform
  @param stdClass $data
  @return void
docstring_tokens: Add elements to submission form .