Merge branch 'm26_MDL-45715' of https://github.com/danmarsden/moodle into MOODLE_26_STABLE

This commit is contained in:
Dan Poltawski 2014-07-28 12:47:35 +01:00
commit abeb9d6544
2 changed files with 24 additions and 8 deletions

View file

@ -186,7 +186,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())) { if (has_capability('mod/assign:manageallocations', $this->assignment->get_context())) {
// Check to see if marker filter is set. // Check to see if marker filter is set.
$markerfilter = (int)get_user_preferences('assign_markerfilter', ''); $markerfilter = (int)get_user_preferences('assign_markerfilter', '');
@ -271,7 +272,8 @@ class assign_grading_table extends table_sql implements renderable {
$headers[] = get_string('submissionteam', 'assign'); $headers[] = get_string('submissionteam', 'assign');
} }
// Allocated marker. // 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())) { has_capability('mod/assign:manageallocations', $this->assignment->get_context())) {
// Add a column for the allocated marker. // Add a column for the allocated marker.
$columns[] = 'allocatedmarker'; $columns[] = 'allocatedmarker';
@ -481,7 +483,8 @@ class assign_grading_table extends table_sql implements renderable {
$name = 'quickgrade_' . $row->id . '_workflowstate'; $name = 'quickgrade_' . $row->id . '_workflowstate';
$o .= html_writer::select($workflowstates, $name, $workflowstate, array('' => $notmarked)); $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. // 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())) { !has_capability('mod/assign:manageallocations', $this->assignment->get_context())) {
$name = 'quickgrade_' . $row->id . '_allocatedmarker'; $name = 'quickgrade_' . $row->id . '_allocatedmarker';

View file

@ -575,6 +575,9 @@ class assign {
} }
$update->markingworkflow = $formdata->markingworkflow; $update->markingworkflow = $formdata->markingworkflow;
$update->markingallocation = $formdata->markingallocation; $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); $returnid = $DB->insert_record('assign', $update);
$this->instance = $DB->get_record('assign', array('id'=>$returnid), '*', MUST_EXIST); $this->instance = $DB->get_record('assign', array('id'=>$returnid), '*', MUST_EXIST);
@ -916,6 +919,9 @@ class assign {
} }
$update->markingworkflow = $formdata->markingworkflow; $update->markingworkflow = $formdata->markingworkflow;
$update->markingallocation = $formdata->markingallocation; $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); $result = $DB->update_record('assign', $update);
$this->instance = $DB->get_record('assign', array('id'=>$update->id), '*', MUST_EXIST); $this->instance = $DB->get_record('assign', array('id'=>$update->id), '*', MUST_EXIST);
@ -3007,7 +3013,8 @@ class assign {
$quickgrading = get_user_preferences('assign_quickgrading', false); $quickgrading = get_user_preferences('assign_quickgrading', false);
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context); $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); has_capability('mod/assign:manageallocations', $this->context);
// Get markers to use in drop lists. // Get markers to use in drop lists.
$markingallocationoptions = array(); $markingallocationoptions = array();
@ -3330,7 +3337,8 @@ class assign {
require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php'); require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php');
require_sesskey(); require_sesskey();
$markingallocation = $this->get_instance()->markingallocation && $markingallocation = $this->get_instance()->markingworkflow &&
$this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context); has_capability('mod/assign:manageallocations', $this->context);
$batchformparams = array('cm'=>$this->get_course_module()->id, $batchformparams = array('cm'=>$this->get_course_module()->id,
@ -4891,7 +4899,8 @@ class assign {
$current->grade = floatval($current->grade); $current->grade = floatval($current->grade);
} }
$gradechanged = $gradecolpresent && $current->grade !== $modified->grade; $gradechanged = $gradecolpresent && $current->grade !== $modified->grade;
$markingallocationchanged = $this->get_instance()->markingallocation && $markingallocationchanged = $this->get_instance()->markingworkflow &&
$this->get_instance()->markingallocation &&
($modified->allocatedmarker !== false) && ($modified->allocatedmarker !== false) &&
($current->allocatedmarker != $modified->allocatedmarker); ($current->allocatedmarker != $modified->allocatedmarker);
$workflowstatechanged = $this->get_instance()->markingworkflow && $workflowstatechanged = $this->get_instance()->markingworkflow &&
@ -5091,7 +5100,8 @@ class assign {
$showonlyactiveenrolopt = false; $showonlyactiveenrolopt = false;
} }
$markingallocation = $this->get_instance()->markingallocation && $markingallocation = $this->get_instance()->markingworkflow &&
$this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context); has_capability('mod/assign:manageallocations', $this->context);
// Get markers to use in drop lists. // Get markers to use in drop lists.
$markingallocationoptions = array(); $markingallocationoptions = array();
@ -5681,7 +5691,10 @@ class assign {
$mform->addHelpButton('workflowstate', 'markingworkflowstate', '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'); $markers = get_users_by_capability($this->context, 'mod/assign:grade');
$markerlist = array('' => get_string('choosemarker', 'assign')); $markerlist = array('' => get_string('choosemarker', 'assign'));
foreach ($markers as $marker) { foreach ($markers as $marker) {