original_string: protected function view_edit_submission_page($mform, $notices) {
          global $CFG, $USER, $DB;
  
          $o = '';
          require_once($CFG->dirroot . '/mod/assign/submission_form.php');
          // Need submit permission to submit an assignment.
          $userid = optional_param('userid', $USER->id, PARAM_INT);
          $user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
  
          // This variation on the url will link direct to this student.
          // The benefit is the url will be the same every time for this student, so Atto autosave drafts can match up.
          $returnparams = array('userid' => $userid, 'rownum' => 0, 'useridlistid' => 0);
          $this->register_return_link('editsubmission', $returnparams);
  
          if ($userid == $USER->id) {
              if (!$this->can_edit_submission($userid, $USER->id)) {
                  print_error('nopermission');
              }
              // User is editing their own submission.
              require_capability('mod/assign:submit', $this->context);
              $title = get_string('editsubmission', 'assign');
          } else {
              // User is editing another user's submission.
              if (!$this->can_edit_submission($userid, $USER->id)) {
                  print_error('nopermission');
              }
  
              $name = $this->fullname($user);
              $title = get_string('editsubmissionother', 'assign', $name);
          }
  
          if (!$this->submissions_open($userid)) {
              $message = array(get_string('submissionsclosed', 'assign'));
              return $this->view_notices($title, $message);
          }
  
          $postfix = '';
          if ($this->has_visible_attachments()) {
              $postfix = $this->render_area_files('mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0);
          }
          $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                        $this->get_context(),
                                                        $this->show_intro(),
                                                        $this->get_course_module()->id,
                                                        $title, '', $postfix));
  
          // Show plagiarism disclosure for any user submitter.
          $o .= $this->plagiarism_print_disclosure();
  
          $data = new stdClass();
          $data->userid = $userid;
          if (!$mform) {
              $mform = new mod_assign_submission_form(null, array($this, $data));
          }
  
          foreach ($notices as $notice) {
              $o .= $this->get_renderer()->notification($notice);
          }
  
          $o .= $this->get_renderer()->render(new assign_form('editsubmissionform', $mform));
  
          $o .= $this->view_footer();
  
          \mod_assign\event\submission_form_viewed::create_from_user($this, $user)->trigger();
  
          return $o;
      }
code: protected function view_edit_submission_page($mform, $notices) {
          global $CFG, $USER, $DB;
  
          $o = '';
          require_once($CFG->dirroot . '/mod/assign/submission_form.php');
          // Need submit permission to submit an assignment.
          $userid = optional_param('userid', $USER->id, PARAM_INT);
          $user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
  
          // This variation on the url will link direct to this student.
          // The benefit is the url will be the same every time for this student, so Atto autosave drafts can match up.
          $returnparams = array('userid' => $userid, 'rownum' => 0, 'useridlistid' => 0);
          $this->register_return_link('editsubmission', $returnparams);
  
          if ($userid == $USER->id) {
              if (!$this->can_edit_submission($userid, $USER->id)) {
                  print_error('nopermission');
              }
              // User is editing their own submission.
              require_capability('mod/assign:submit', $this->context);
              $title = get_string('editsubmission', 'assign');
          } else {
              // User is editing another user's submission.
              if (!$this->can_edit_submission($userid, $USER->id)) {
                  print_error('nopermission');
              }
  
              $name = $this->fullname($user);
              $title = get_string('editsubmissionother', 'assign', $name);
          }
  
          if (!$this->submissions_open($userid)) {
              $message = array(get_string('submissionsclosed', 'assign'));
              return $this->view_notices($title, $message);
          }
  
          $postfix = '';
          if ($this->has_visible_attachments()) {
              $postfix = $this->render_area_files('mod_assign', ASSIGN_INTROATTACHMENT_FILEAREA, 0);
          }
          $o .= $this->get_renderer()->render(new assign_header($this->get_instance(),
                                                        $this->get_context(),
                                                        $this->show_intro(),
                                                        $this->get_course_module()->id,
                                                        $title, '', $postfix));
  
          // Show plagiarism disclosure for any user submitter.
          $o .= $this->plagiarism_print_disclosure();
  
          $data = new stdClass();
          $data->userid = $userid;
          if (!$mform) {
              $mform = new mod_assign_submission_form(null, array($this, $data));
          }
  
          foreach ($notices as $notice) {
              $o .= $this->get_renderer()->notification($notice);
          }
  
          $o .= $this->get_renderer()->render(new assign_form('editsubmissionform', $mform));
  
          $o .= $this->view_footer();
  
          \mod_assign\event\submission_form_viewed::create_from_user($this, $user)->trigger();
  
          return $o;
      }
code_tokens: protected function view_edit_submission_page ( $ mform , $ notices ) { global $ CFG , $ USER , $ DB ; $ o = '' ; require_once ( $ CFG -> dirroot . '/mod/assign/submission_form.php' ) ; // Need submit permission to submit an assignment. $ userid = optional_param ( 'userid' , $ USER -> id , PARAM_INT ) ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) , '*' , MUST_EXIST ) ; // This variation on the url will link direct to this student. // The benefit is the url will be the same every time for this student, so Atto autosave drafts can match up. $ returnparams = array ( 'userid' => $ userid , 'rownum' => 0 , 'useridlistid' => 0 ) ; $ this -> register_return_link ( 'editsubmission' , $ returnparams ) ; if ( $ userid == $ USER -> id ) { if ( ! $ this -> can_edit_submission ( $ userid , $ USER -> id ) ) { print_error ( 'nopermission' ) ; } // User is editing their own submission. require_capability ( 'mod/assign:submit' , $ this -> context ) ; $ title = get_string ( 'editsubmission' , 'assign' ) ; } else { // User is editing another user's submission. if ( ! $ this -> can_edit_submission ( $ userid , $ USER -> id ) ) { print_error ( 'nopermission' ) ; } $ name = $ this -> fullname ( $ user ) ; $ title = get_string ( 'editsubmissionother' , 'assign' , $ name ) ; } if ( ! $ this -> submissions_open ( $ userid ) ) { $ message = array ( get_string ( 'submissionsclosed' , 'assign' ) ) ; return $ this -> view_notices ( $ title , $ message ) ; } $ postfix = '' ; if ( $ this -> has_visible_attachments ( ) ) { $ postfix = $ this -> render_area_files ( 'mod_assign' , ASSIGN_INTROATTACHMENT_FILEAREA , 0 ) ; } $ o .= $ this -> get_renderer ( ) -> render ( new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , $ title , '' , $ postfix ) ) ; // Show plagiarism disclosure for any user submitter. $ o .= $ this -> plagiarism_print_disclosure ( ) ; $ data = new stdClass ( ) ; $ data -> userid = $ userid ; if ( ! $ mform ) { $ mform = new mod_assign_submission_form ( null , array ( $ this , $ data ) ) ; } foreach ( $ notices as $ notice ) { $ o .= $ this -> get_renderer ( ) -> notification ( $ notice ) ; } $ o .= $ this -> get_renderer ( ) -> render ( new assign_form ( 'editsubmissionform' , $ mform ) ) ; $ o .= $ this -> view_footer ( ) ; \ mod_assign \ event \ submission_form_viewed :: create_from_user ( $ this , $ user ) -> trigger ( ) ; return $ o ; }
docstring: View edit submissions page.
  
  @param moodleform $mform
  @param array $notices A list of notices to display at the top of the
  edit submission form (e.g. from plugins).
  @return string The page output.
docstring_tokens: View edit submissions page .