diff --git a/mod/assign/gradingtable.php b/mod/assign/gradingtable.php index 115a04edbc2..44a1f706036 100644 --- a/mod/assign/gradingtable.php +++ b/mod/assign/gradingtable.php @@ -202,7 +202,8 @@ class assign_grading_table extends table_sql implements renderable { } } - if ($this->assignment->get_instance()->markingallocation) { + if ($this->assignment->get_instance()->markingworkflow && + $this->assignment->get_instance()->markingallocation) { if (has_capability('mod/assign:manageallocations', $this->assignment->get_context())) { // Check to see if marker filter is set. $markerfilter = (int)get_user_preferences('assign_markerfilter', ''); @@ -296,7 +297,8 @@ class assign_grading_table extends table_sql implements renderable { $headers[] = get_string('submissionteam', 'assign'); } // Allocated marker. - if ($this->assignment->get_instance()->markingallocation && + if ($this->assignment->get_instance()->markingworkflow && + $this->assignment->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->assignment->get_context())) { // Add a column for the allocated marker. $columns[] = 'allocatedmarker'; @@ -504,7 +506,8 @@ class assign_grading_table extends table_sql implements renderable { $name = 'quickgrade_' . $row->id . '_workflowstate'; $o .= html_writer::select($workflowstates, $name, $workflowstate, array('' => $notmarked)); // Check if this user is a marker that can't manage allocations and doesn't have the marker column added. - if ($this->assignment->get_instance()->markingallocation && + if ($this->assignment->get_instance()->markingworkflow && + $this->assignment->get_instance()->markingallocation && !has_capability('mod/assign:manageallocations', $this->assignment->get_context())) { $name = 'quickgrade_' . $row->id . '_allocatedmarker'; diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 53413e9701a..ca2844eccf0 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -595,6 +595,9 @@ class assign { } $update->markingworkflow = $formdata->markingworkflow; $update->markingallocation = $formdata->markingallocation; + if (empty($update->markingworkflow)) { // If marking workflow is disabled, make sure allocation is disabled. + $update->markingallocation = 0; + } $returnid = $DB->insert_record('assign', $update); $this->instance = $DB->get_record('assign', array('id'=>$returnid), '*', MUST_EXIST); @@ -938,6 +941,9 @@ class assign { } $update->markingworkflow = $formdata->markingworkflow; $update->markingallocation = $formdata->markingallocation; + if (empty($update->markingworkflow)) { // If marking workflow is disabled, make sure allocation is disabled. + $update->markingallocation = 0; + } $result = $DB->update_record('assign', $update); $this->instance = $DB->get_record('assign', array('id'=>$update->id), '*', MUST_EXIST); @@ -3043,7 +3049,8 @@ class assign { $quickgrading = get_user_preferences('assign_quickgrading', false); $showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context); - $markingallocation = $this->get_instance()->markingallocation && + $markingallocation = $this->get_instance()->markingworkflow && + $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context); // Get markers to use in drop lists. $markingallocationoptions = array(); @@ -3413,7 +3420,8 @@ class assign { require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php'); require_sesskey(); - $markingallocation = $this->get_instance()->markingallocation && + $markingallocation = $this->get_instance()->markingworkflow && + $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context); $batchformparams = array('cm'=>$this->get_course_module()->id, @@ -5059,7 +5067,8 @@ class assign { $current->grade = floatval($current->grade); } $gradechanged = $gradecolpresent && $current->grade !== $modified->grade; - $markingallocationchanged = $this->get_instance()->markingallocation && + $markingallocationchanged = $this->get_instance()->markingworkflow && + $this->get_instance()->markingallocation && ($modified->allocatedmarker !== false) && ($current->allocatedmarker != $modified->allocatedmarker); $workflowstatechanged = $this->get_instance()->markingworkflow && @@ -5242,7 +5251,8 @@ class assign { $showonlyactiveenrolopt = false; } - $markingallocation = $this->get_instance()->markingallocation && + $markingallocation = $this->get_instance()->markingworkflow && + $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context); // Get markers to use in drop lists. $markingallocationoptions = array(); @@ -5818,7 +5828,10 @@ class assign { $mform->addHelpButton('workflowstate', 'markingworkflowstate', 'assign'); } - if ($this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context)) { + if ($this->get_instance()->markingworkflow && + $this->get_instance()->markingallocation && + has_capability('mod/assign:manageallocations', $this->context)) { + $markers = get_users_by_capability($this->context, 'mod/assign:grade'); $markerlist = array('' => get_string('choosemarker', 'assign')); foreach ($markers as $marker) {