MDL-52133 mod_assign: Support userid on single grade page

This commit is contained in:
Ryan Wyllie 2016-05-05 02:08:31 +00:00
parent fc1ef59fbe
commit a6c1a1c753
2 changed files with 18 additions and 13 deletions

View File

@ -65,7 +65,7 @@ class mod_assign_grade_form extends moodleform {
*/
protected function get_form_identifier() {
$params = $this->_customdata[2];
return get_class($this) . '_' . $params['rownum'];
return get_class($this) . '_' . $params['userid'];
}
/**

View File

@ -3347,7 +3347,7 @@ class assign {
$o .= $this->get_renderer()->render($header);
// If userid is passed - we are only grading a single student.
$rownum = required_param('rownum', PARAM_INT);
$rownum = optional_param('rownum', 0, PARAM_INT);
$useridlistid = optional_param('useridlistid', $this->get_useridlist_key_id(), PARAM_ALPHANUM);
$userid = optional_param('userid', 0, PARAM_INT);
$attemptnumber = optional_param('attemptnumber', -1, PARAM_INT);
@ -3360,6 +3360,7 @@ class assign {
$useridlist = $SESSION->mod_assign_useridlist[$useridlistkey];
} else {
$rownum = 0;
$useridlistid = 0;
$useridlist = array($userid);
}
@ -3479,11 +3480,11 @@ class assign {
// Now show the grading form.
if (!$mform) {
$pagination = array('rownum'=>$rownum,
'useridlistid'=>$useridlistid,
'last'=>$last,
'userid'=>optional_param('userid', 0, PARAM_INT),
'attemptnumber'=>$attemptnumber);
$pagination = array('rownum' => $rownum,
'useridlistid' => $useridlistid,
'last' => $last,
'userid' => $userid,
'attemptnumber' => $attemptnumber);
$formparams = array($this, $data, $pagination);
$mform = new mod_assign_grade_form(null,
$formparams,
@ -6537,7 +6538,9 @@ class assign {
$userid = isset($params['userid']) ? $params['userid'] : 0;
$attemptnumber = isset($params['attemptnumber']) ? $params['attemptnumber'] : 0;
$gradingpanel = !empty($params['gradingpanel']);
if (!$userid) {
$bothids = ($userid && $useridlistid);
if (!$userid || $bothids) {
$useridlistkey = $this->get_useridlist_key($useridlistid);
if (empty($SESSION->mod_assign_useridlist[$useridlistkey])) {
$SESSION->mod_assign_useridlist[$useridlistkey] = $this->get_grading_userid_list();
@ -6703,6 +6706,8 @@ class assign {
$mform->setType('attemptnumber', PARAM_INT);
$mform->addElement('hidden', 'ajax', optional_param('ajax', 0, PARAM_INT));
$mform->setType('ajax', PARAM_INT);
$mform->addElement('hidden', 'userid', optional_param('userid', 0, PARAM_INT));
$mform->setType('userid', PARAM_INT);
if ($this->get_instance()->teamsubmission) {
$mform->addElement('header', 'groupsubmissionsettings', get_string('groupsubmissionsettings', 'assign'));
@ -7433,11 +7438,11 @@ class assign {
$data = new stdClass();
$gradeformparams = array('rownum'=>$rownum,
'useridlistid'=>$useridlistid,
'last'=>false,
'attemptnumber'=>$attemptnumber,
'userid'=>optional_param('userid', 0, PARAM_INT));
$gradeformparams = array('rownum' => $rownum,
'useridlistid' => $useridlistid,
'last' => $last,
'attemptnumber' => $attemptnumber,
'userid' => $userid);
$mform = new mod_assign_grade_form(null,
array($this, $data, $gradeformparams),
'post',