Skip to content

Commit

Permalink
Merge branch 'master_MDL-45715' of https://github.com/danmarsden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Jul 28, 2014
2 parents 14a3ccc + 5a96486 commit d4a89aa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
9 changes: 6 additions & 3 deletions mod/assign/gradingtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public function __construct(assign $assignment,
}
}

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', '');
Expand Down Expand Up @@ -296,7 +297,8 @@ public function __construct(assign $assignment,
$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';
Expand Down Expand Up @@ -504,7 +506,8 @@ public function col_workflowstatus(stdClass $row) {
$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';
Expand Down
23 changes: 18 additions & 5 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ public function add_instance(stdClass $formdata, $callplugins) {
}
$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);
Expand Down Expand Up @@ -945,6 +948,9 @@ public function update_instance($formdata) {
}
$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);
Expand Down Expand Up @@ -3067,7 +3073,8 @@ protected function view_grading_table() {
$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();
Expand Down Expand Up @@ -3437,7 +3444,8 @@ protected function process_grading_batch_operation(& $mform) {
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,
Expand Down Expand Up @@ -5136,7 +5144,8 @@ protected function process_save_quick_grades() {
$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 &&
Expand Down Expand Up @@ -5319,7 +5328,8 @@ protected function process_save_grading_options() {
$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();
Expand Down Expand Up @@ -5899,7 +5909,10 @@ public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data,
$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) {
Expand Down

0 comments on commit d4a89aa

Please sign in to comment.