MDL-82808 mod_assign: replace userid with blindid in anonymous marking
This commit is contained in:
@@ -1162,12 +1162,22 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
);
|
||||
$caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
|
||||
|
||||
$baseactionurl = new moodle_url('/mod/assign/view.php', [
|
||||
'id' => $this->assignment->get_course_module()->id,
|
||||
'userid' => $row->id,
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage,
|
||||
]);
|
||||
$urlparams = [
|
||||
'id' => $this->assignment->get_course_module()->id,
|
||||
'sesskey' => sesskey(),
|
||||
'page' => $this->currpage,
|
||||
];
|
||||
|
||||
if ($this->assignment->is_blind_marking()) {
|
||||
if (empty($row->recordid)) {
|
||||
$row->recordid = $this->assignment->get_uniqueid_for_user($row->userid);
|
||||
}
|
||||
$urlparams['blindid'] = $row->recordid;
|
||||
} else {
|
||||
$urlparams['userid'] = $row->userid;
|
||||
}
|
||||
|
||||
$baseactionurl = new moodle_url('/mod/assign/view.php', $urlparams);
|
||||
|
||||
$menu = new action_menu();
|
||||
$menu->set_owner_selector('.gradingtable-actionmenu');
|
||||
|
||||
+98
-10
@@ -556,7 +556,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);
|
||||
}
|
||||
// Userid is required, 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') {
|
||||
@@ -3110,7 +3119,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);
|
||||
|
||||
@@ -4325,7 +4343,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');
|
||||
@@ -4654,7 +4682,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);
|
||||
}
|
||||
|
||||
@@ -4791,7 +4819,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');
|
||||
|
||||
@@ -6900,7 +6938,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');
|
||||
@@ -8337,7 +8385,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);
|
||||
@@ -8354,7 +8412,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);
|
||||
@@ -8525,7 +8593,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);
|
||||
@@ -8574,7 +8652,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