original_string: protected function view_grant_extension($mform) {
          global $CFG;
          require_once($CFG->dirroot . '/mod/assign/extensionform.php');
  
          $o = '';
  
          $data = new stdClass();
          $data->id = $this->get_course_module()->id;
  
          $formparams = array(
              'instance' => $this->get_instance(),
              'assign' => $this
          );
  
          $users = optional_param('userid', 0, PARAM_INT);
          if (!$users) {
              $users = required_param('selectedusers', PARAM_SEQUENCE);
          }
          $userlist = explode(',', $users);
  
          $keys = array('duedate', 'cutoffdate', 'allowsubmissionsfromdate');
          $maxoverride = array('allowsubmissionsfromdate' => 0, 'duedate' => 0, 'cutoffdate' => 0);
          foreach ($userlist as $userid) {
              // To validate extension date with users overrides.
              $override = $this->override_exists($userid);
              foreach ($keys as $key) {
                  if ($override->{$key}) {
                      if ($maxoverride[$key] < $override->{$key}) {
                          $maxoverride[$key] = $override->{$key};
                      }
                  } else if ($maxoverride[$key] < $this->get_instance()->{$key}) {
                      $maxoverride[$key] = $this->get_instance()->{$key};
                  }
              }
          }
          foreach ($keys as $key) {
              if ($maxoverride[$key]) {
                  $this->get_instance()->{$key} = $maxoverride[$key];
              }
          }
  
          $formparams['userlist'] = $userlist;
  
          $data->selectedusers = $users;
          $data->userid = 0;
  
          if (empty($mform)) {
              $mform = new mod_assign_extension_form(null, $formparams);
          }
          $mform->set_data($data);
          $header = new assign_header($this->get_instance(),
                                      $this->get_context(),
                                      $this->show_intro(),
                                      $this->get_course_module()->id,
                                      get_string('grantextension', 'assign'));
          $o .= $this->get_renderer()->render($header);
          $o .= $this->get_renderer()->render(new assign_form('extensionform', $mform));
          $o .= $this->view_footer();
          return $o;
      }
code: protected function view_grant_extension($mform) {
          global $CFG;
          require_once($CFG->dirroot . '/mod/assign/extensionform.php');
  
          $o = '';
  
          $data = new stdClass();
          $data->id = $this->get_course_module()->id;
  
          $formparams = array(
              'instance' => $this->get_instance(),
              'assign' => $this
          );
  
          $users = optional_param('userid', 0, PARAM_INT);
          if (!$users) {
              $users = required_param('selectedusers', PARAM_SEQUENCE);
          }
          $userlist = explode(',', $users);
  
          $keys = array('duedate', 'cutoffdate', 'allowsubmissionsfromdate');
          $maxoverride = array('allowsubmissionsfromdate' => 0, 'duedate' => 0, 'cutoffdate' => 0);
          foreach ($userlist as $userid) {
              // To validate extension date with users overrides.
              $override = $this->override_exists($userid);
              foreach ($keys as $key) {
                  if ($override->{$key}) {
                      if ($maxoverride[$key] < $override->{$key}) {
                          $maxoverride[$key] = $override->{$key};
                      }
                  } else if ($maxoverride[$key] < $this->get_instance()->{$key}) {
                      $maxoverride[$key] = $this->get_instance()->{$key};
                  }
              }
          }
          foreach ($keys as $key) {
              if ($maxoverride[$key]) {
                  $this->get_instance()->{$key} = $maxoverride[$key];
              }
          }
  
          $formparams['userlist'] = $userlist;
  
          $data->selectedusers = $users;
          $data->userid = 0;
  
          if (empty($mform)) {
              $mform = new mod_assign_extension_form(null, $formparams);
          }
          $mform->set_data($data);
          $header = new assign_header($this->get_instance(),
                                      $this->get_context(),
                                      $this->show_intro(),
                                      $this->get_course_module()->id,
                                      get_string('grantextension', 'assign'));
          $o .= $this->get_renderer()->render($header);
          $o .= $this->get_renderer()->render(new assign_form('extensionform', $mform));
          $o .= $this->view_footer();
          return $o;
      }
code_tokens: protected function view_grant_extension ( $ mform ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/mod/assign/extensionform.php' ) ; $ o = '' ; $ data = new stdClass ( ) ; $ data -> id = $ this -> get_course_module ( ) -> id ; $ formparams = array ( 'instance' => $ this -> get_instance ( ) , 'assign' => $ this ) ; $ users = optional_param ( 'userid' , 0 , PARAM_INT ) ; if ( ! $ users ) { $ users = required_param ( 'selectedusers' , PARAM_SEQUENCE ) ; } $ userlist = explode ( ',' , $ users ) ; $ keys = array ( 'duedate' , 'cutoffdate' , 'allowsubmissionsfromdate' ) ; $ maxoverride = array ( 'allowsubmissionsfromdate' => 0 , 'duedate' => 0 , 'cutoffdate' => 0 ) ; foreach ( $ userlist as $ userid ) { // To validate extension date with users overrides. $ override = $ this -> override_exists ( $ userid ) ; foreach ( $ keys as $ key ) { if ( $ override -> { $ key } ) { if ( $ maxoverride [ $ key ] < $ override -> { $ key } ) { $ maxoverride [ $ key ] = $ override -> { $ key } ; } } else if ( $ maxoverride [ $ key ] < $ this -> get_instance ( ) -> { $ key } ) { $ maxoverride [ $ key ] = $ this -> get_instance ( ) -> { $ key } ; } } } foreach ( $ keys as $ key ) { if ( $ maxoverride [ $ key ] ) { $ this -> get_instance ( ) -> { $ key } = $ maxoverride [ $ key ] ; } } $ formparams [ 'userlist' ] = $ userlist ; $ data -> selectedusers = $ users ; $ data -> userid = 0 ; if ( empty ( $ mform ) ) { $ mform = new mod_assign_extension_form ( null , $ formparams ) ; } $ mform -> set_data ( $ data ) ; $ header = new assign_header ( $ this -> get_instance ( ) , $ this -> get_context ( ) , $ this -> show_intro ( ) , $ this -> get_course_module ( ) -> id , get_string ( 'grantextension' , 'assign' ) ) ; $ o .= $ this -> get_renderer ( ) -> render ( $ header ) ; $ o .= $ this -> get_renderer ( ) -> render ( new assign_form ( 'extensionform' , $ mform ) ) ; $ o .= $ this -> view_footer ( ) ; return $ o ; }
docstring: View the grant extension date page.
  
  Uses url parameters 'userid'
  or from parameter 'selectedusers'
  
  @param moodleform $mform - Used for validation of the submitted data
  @return string
docstring_tokens: View the grant extension date page .