MDL-82808 mod_assign: replace userid with blindid in anonymous marking
This commit is contained in:
+11
-19
@@ -1249,11 +1249,11 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
if (empty($row->recordid)) {
|
||||
$row->recordid = $this->assignment->get_uniqueid_for_user($row->userid);
|
||||
}
|
||||
$urlparams['blindid'] = $row->recordid;
|
||||
$useridurlparam = ['blindid' => $row->recordid];
|
||||
} else {
|
||||
$urlparams['userid'] = $row->userid;
|
||||
$useridurlparam = ['userid' => $row->userid];
|
||||
}
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$noimage = null;
|
||||
|
||||
if (!$row->grade) {
|
||||
@@ -1292,11 +1292,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
|
||||
if (!$row->locked) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'lock',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
|
||||
$description = get_string('preventsubmissionsshort', 'assign');
|
||||
$actions['lock'] = new action_menu_link_secondary(
|
||||
@@ -1306,11 +1305,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
);
|
||||
} else {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'unlock',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('allowsubmissionsshort', 'assign');
|
||||
$actions['unlock'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1324,11 +1322,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$USER->id != $row->id &&
|
||||
$caneditsubmission) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'editsubmission',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('editsubmission', 'assign');
|
||||
$actions['editsubmission'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1340,11 +1337,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$caneditsubmission &&
|
||||
!empty($row->status)) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'removesubmissionconfirm',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('removesubmission', 'assign');
|
||||
$actions['removesubmission'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1357,11 +1353,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$this->assignment->get_instance()->cutoffdate) &&
|
||||
$this->hasgrantextension) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'grantextension',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('grantextension', 'assign');
|
||||
$actions['grantextension'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1372,11 +1367,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
|
||||
$this->assignment->get_instance()->submissiondrafts) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'reverttodraft',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('reverttodraftshort', 'assign');
|
||||
$actions['reverttodraft'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1390,11 +1384,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$submissionsopen &&
|
||||
$row->id != $USER->id) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'submitotherforgrading',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('submitforgrading', 'assign');
|
||||
$actions['submitforgrading'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
@@ -1411,11 +1404,10 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
|
||||
if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
|
||||
$urlparams = array('id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'action' => 'addattempt',
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
$url = new moodle_url('/mod/assign/view.php', $urlparams + $useridurlparam);
|
||||
$description = get_string('addattempt', 'assign');
|
||||
$actions['addattempt'] = new action_menu_link_secondary(
|
||||
$url,
|
||||
|
||||
+98
-10
@@ -529,7 +529,16 @@ class assign {
|
||||
$nextpageparams['action'] = 'view';
|
||||
}
|
||||
} else if ($action == 'addattempt') {
|
||||
$this->process_add_attempt(required_param('userid', PARAM_INT));
|
||||
$userid = false;
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
// Fallback to userid, if not found by blindid.
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
}
|
||||
$this->process_add_attempt($userid);
|
||||
$action = 'redirect';
|
||||
$nextpageparams['action'] = 'grading';
|
||||
} else if ($action == 'reverttodraft') {
|
||||
@@ -3007,7 +3016,16 @@ class assign {
|
||||
|
||||
$users = optional_param('userid', 0, PARAM_INT);
|
||||
if (!$users) {
|
||||
$users = required_param('selectedusers', PARAM_SEQUENCE);
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
if ($blindid) {
|
||||
$users = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
}
|
||||
// We need users, if not found by blindid.
|
||||
if (!$users) {
|
||||
$users = required_param('selectedusers', PARAM_SEQUENCE);
|
||||
}
|
||||
}
|
||||
$userlist = explode(',', $users);
|
||||
|
||||
@@ -4319,7 +4337,17 @@ class assign {
|
||||
protected function view_remove_submission_confirm() {
|
||||
global $USER;
|
||||
|
||||
$userid = optional_param('userid', $USER->id, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
|
||||
if ($this->is_blind_marking() && !$userid && $blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
|
||||
// If no userid specified, default to current user.
|
||||
if (!$userid) {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
|
||||
if (!$this->can_edit_submission($userid, $USER->id)) {
|
||||
throw new \moodle_exception('nopermission');
|
||||
@@ -4651,7 +4679,7 @@ class assign {
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
|
||||
if (!$userid && $blindid) {
|
||||
if ($this->is_blind_marking() && !$userid && $blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
|
||||
@@ -4785,7 +4813,17 @@ class assign {
|
||||
$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);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
|
||||
if ($this->is_blind_marking() && !$userid && $blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
// If no userid specified, default to current user.
|
||||
if (!$userid) {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
|
||||
$user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
|
||||
$timelimitenabled = get_config('assign', 'enabletimelimit');
|
||||
|
||||
@@ -6841,7 +6879,17 @@ class assign {
|
||||
|
||||
require_sesskey();
|
||||
|
||||
$userid = optional_param('userid', $USER->id, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
|
||||
if ($this->is_blind_marking() && !$userid && $blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
|
||||
// If no userid specified, default to current user.
|
||||
if (!$userid) {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
|
||||
if (!$this->submissions_open($userid)) {
|
||||
$notices[] = get_string('submissionsclosed', 'assign');
|
||||
@@ -8305,7 +8353,17 @@ class assign {
|
||||
require_sesskey();
|
||||
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
if ($blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
}
|
||||
|
||||
// Userid is required, if not found by blindid.
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->remove_submission($userid);
|
||||
@@ -8322,7 +8380,17 @@ class assign {
|
||||
require_sesskey();
|
||||
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
if ($blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
}
|
||||
|
||||
// Userid is required, if not found by blindid.
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->revert_to_draft($userid);
|
||||
@@ -8493,7 +8561,17 @@ class assign {
|
||||
require_sesskey();
|
||||
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
if ($blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
}
|
||||
|
||||
// Userid is required, if not found by blindid.
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->lock_submission($userid);
|
||||
@@ -8542,7 +8620,17 @@ class assign {
|
||||
require_sesskey();
|
||||
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
if ($this->is_blind_marking()) {
|
||||
$blindid = optional_param('blindid', 0, PARAM_INT);
|
||||
if ($blindid) {
|
||||
$userid = $this->get_user_id_for_uniqueid($blindid);
|
||||
}
|
||||
}
|
||||
|
||||
// Userid is required, if not found by blindid.
|
||||
if (!$userid) {
|
||||
$userid = required_param('userid', PARAM_INT);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->unlock_submission($userid);
|
||||
|
||||
Reference in New Issue
Block a user