'markingworkflow',
'markingallocation'));
-
$userflags = new backup_nested_element('userflags');
$userflag = new backup_nested_element('userflag', array('id'),
public function definition() {
$mform = $this->_form;
$params = $this->_customdata;
+ $formheader = get_string('batchsetmarkingworkflowstateforusers', 'assign', count($params['users']));
- $mform->addElement('header', 'general', get_string('batchsetmarkingworkflowstateforusers', 'assign', count($params['users'])));
+ $mform->addElement('header', 'general', $formheader);
$mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $params['usershtml']);
$options = $params['markingworkflowstates'];
if (!$dbman->field_exists($table, $field)) {
// OK safe to cleanup duplicates here.
- $sql = 'SELECT assignment, userid, groupid from {assign_submission} GROUP BY assignment, userid, groupid HAVING (count(id) > 1)';
+ $sql = 'SELECT assignment, userid, groupid from {assign_submission} ' .
+ 'GROUP BY assignment, userid, groupid HAVING (count(id) > 1)';
$badrecords = $DB->get_recordset_sql($sql);
foreach ($badrecords as $badrecord) {
// Put any upgrade step following this.
if ($oldversion < 2013061101) {
- // Define field markingworkflow to be added to assign
+ // Define field markingworkflow to be added to assign.
$table = new xmldb_table('assign');
$field = new xmldb_field('markingworkflow', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'maxattempts');
- // Conditionally launch add field markingworkflow
+ // Conditionally launch add field markingworkflow.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$dbman->add_field($table, $field);
}
- // Define field workflowstate to be added to assign_grades
+ // Define field workflowstate to be added to assign_grades.
$table = new xmldb_table('assign_user_flags');
$field = new xmldb_field('workflowstate', XMLDB_TYPE_CHAR, '20', null, null, null, null, 'extensionduedate');
- // Conditionally launch add field workflowstate
+ // Conditionally launch add field workflowstate.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Define field allocatedmarker to be added to assign_grades.
$field = new xmldb_field('allocatedmarker', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'workflowstate');
- // Conditionally launch add field workflowstate
+ // Conditionally launch add field workflowstate.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
-
return true;
}
-
-
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
-
return true;
}
-
-
$mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, $dirtyclass);
}
if (!empty($instance['markingallocationopt'])) {
- $mform->addElement('select', 'markerfilter', get_string('markerfilter', 'assign'), $instance['markingallocationopt'], $dirtyclass);
+ $markingfilter = get_string('markerfilter', 'assign');
+ $mform->addElement('select', 'markerfilter', $markingfilter, $instance['markingallocationopt'], $dirtyclass);
}
if (!empty($instance['markingworkflowopt'])) {
- $mform->addElement('select', 'workflowfilter', get_string('workflowfilter', 'assign'), $instance['markingworkflowopt'], $dirtyclass);
+ $workflowfilter = get_string('workflowfilter', 'assign');
+ $mform->addElement('select', 'workflowfilter', $workflowfilter, $instance['markingworkflowopt'], $dirtyclass);
}
// Quickgrading.
if ($instance['showquickgrading']) {
if ($this->assignment->get_instance()->markingallocation) {
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', '');
if (!empty($markerfilter)) {
$where .= ' AND uf.allocatedmarker = :markerid';
$workflowstates = $this->assignment->get_marking_workflow_states_for_current_user();
if (!empty($workflowstates)) {
$workflowfilter = get_user_preferences('assign_workflowfilter', '');
- if (array_key_exists($workflowfilter, $workflowstates) || $workflowfilter == ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED) {
- if ($workflowfilter == ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED) {
- $where .= ' AND (uf.workflowstate = :workflowstate OR uf.workflowstate IS NULL OR '.
- $DB->sql_isempty('assign_user_flags', 'workflowstate', true, true).')';
- $params['workflowstate'] = $workflowfilter;
- } else {
- $where .= ' AND uf.workflowstate = :workflowstate';
- $params['workflowstate'] = $workflowfilter;
- }
+ if ($workflowfilter == ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED) {
+ $where .= ' AND (uf.workflowstate = :workflowstate OR uf.workflowstate IS NULL OR '.
+ $DB->sql_isempty('assign_user_flags', 'workflowstate', true, true).')';
+ $params['workflowstate'] = $workflowfilter;
+ } else if (array_key_exists($workflowfilter, $workflowstates)) {
+ $where .= ' AND uf.workflowstate = :workflowstate';
+ $params['workflowstate'] = $workflowfilter;
}
}
}
$columns[] = 'teamstatus';
$headers[] = get_string('teamsubmissionstatus', 'assign');
}
- //allocated marker
+ // Allocated marker.
if ($this->assignment->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->assignment->get_context())) {
// Add a column for the allocated marker.
$workflowstate = ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED;
}
if ($this->quickgrading && !$gradingdisabled) {
+ $notmarked = get_string('markingworkflowstatenotmarked', 'assign');
$name = 'quickgrade_' . $row->id . '_workflowstate';
- $o .= html_writer::select($workflowstates, $name, $workflowstate, array('' => get_string('markingworkflowstatenotmarked', 'assign')));
+ $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 &&
!has_capability('mod/assign:manageallocations', $this->assignment->get_context())) {
* @param stdClass $row - The row of data
* @return id the user->id of the marker.
*/
- function col_allocatedmarker(stdClass $row) {
+ public function col_allocatedmarker(stdClass $row) {
static $markers = null;
static $markerlist = array();
if ($markers === null) {
// Get marking states to show in form.
$markingworkflowoptions = array();
if ($markingworkflow) {
+ $notmarked = get_string('markingworkflowstatenotmarked', 'assign');
$markingworkflowoptions[''] = get_string('filternone', 'assign');
- $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = get_string('markingworkflowstatenotmarked', 'assign');
+ $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = $notmarked;
$markingworkflowoptions = array_merge($markingworkflowoptions, $this->get_marking_workflow_states_for_current_user());
}
// Get marking states to show in form.
$markingworkflowoptions = array();
if ($this->get_instance()->markingworkflow) {
+ $notmarked = get_string('markingworkflowstatenotmarked', 'assign');
$markingworkflowoptions[''] = get_string('filternone', 'assign');
- $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = get_string('markingworkflowstatenotmarked', 'assign');
+ $markingworkflowoptions[ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED] = $notmarked
$markingworkflowoptions = array_merge($markingworkflowoptions, $this->get_marking_workflow_states_for_current_user());
}
}
if ($this->get_instance()->markingworkflow) {
- $options = array('' => get_string('markingworkflowstatenotmarked', 'assign')) + $this->get_marking_workflow_states_for_current_user();
+ $states = $this->get_marking_workflow_states_for_current_user();
+ $options = array('' => get_string('markingworkflowstatenotmarked', 'assign')) + $states;
$mform->addElement('select', 'workflowstate', get_string('markingworkflowstate', 'assign'), $options);
$mform->addHelpButton('workflowstate', 'markingworkflowstate', 'assign');
}
$this->add_to_log('set marking workflow state', $message);
}
}
-
-
}
/**
$this->add_to_log('set marking allocation', $message);
}
}
-
-
}
new lang_string('feedbackplugins', 'assign'), $module->is_enabled() === false));
$ADMIN->add('assignfeedbackplugins', new assign_admin_page_manage_assign_plugins('assignfeedback'));
-
assign_plugin_manager::add_admin_assign_plugin_settings('assignsubmission', $ADMIN, $settings, $module);
assign_plugin_manager::add_admin_assign_plugin_settings('assignfeedback', $ADMIN, $settings, $module);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
- // Constants from locallib.php
+ // Constants from "locallib.php".
$options = array(
'none' => get_string('attemptreopenmethod_none', 'mod_assign'),
'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'),
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
- // Constants from locallib.php
+ // Constants from "locallib.php".
$options = array(-1 => get_string('unlimitedattempts', 'mod_assign'));
$options += array_combine(range(1, 30), range(1, 30));
$name = new lang_string('maxattempts', 'mod_assign');
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
-
return true;
}
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
-
return true;
}
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
-
return true;
}
$this->assertEquals(1, count($assignment['grades']));
$grade = $assignment['grades'][0];
$this->assertEquals($student->id, $grade['userid']);
- // Should be the last grade (not the first)
+ // Should be the last grade (not the first).
$this->assertEquals(75, $grade['grade']);
}
$grades = $assign->get_user_grades_for_gradebook($this->students[0]->id);
$this->assertEquals(50, (int)$grades[$this->students[0]->id]->rawgrade);
-
}
public function test_markingworkflow() {
$assign = $this->create_instance(array('markingworkflow'=>1));
$PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id)));
- // Mark the submission and set to notmarked
+ // Mark the submission and set to notmarked.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$output = $assign->view_student_summary($this->students[0], true);
$this->assertEquals(false, strpos($output, '50.0'));
- // Mark the submission and set to inmarking
+ // Mark the submission and set to inmarking.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$output = $assign->view_student_summary($this->students[0], true);
$this->assertEquals(false, strpos($output, '50.0'));
- // Mark the submission and set to readyforreview
+ // Mark the submission and set to readyforreview.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$output = $assign->view_student_summary($this->students[0], true);
$this->assertEquals(false, strpos($output, '50.0'));
- // Mark the submission and set to inreview
+ // Mark the submission and set to inreview.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$output = $assign->view_student_summary($this->students[0], true);
$this->assertEquals(false, strpos($output, '50.0'));
- // Mark the submission and set to readyforrelease
+ // Mark the submission and set to readyforrelease.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$output = $assign->view_student_summary($this->students[0], true);
$this->assertEquals(false, strpos($output, '50.0'));
- // Mark the submission and set to released
+ // Mark the submission and set to released.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
global $PAGE;
$this->setUser($this->editingteachers[0]);
- $assign = $this->create_instance(array('markingworkflow'=>1,'markingallocation'=>1));
+ $assign = $this->create_instance(array('markingworkflow'=>1, 'markingallocation'=>1));
$PAGE->set_url(new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id)));
- // Allocate marker to submission
+ // Allocate marker to submission.
$data = new stdClass();
$data->allocatedmarker = $this->teachers[0]->id;
$assign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
- // Check the allocated marker can view the submission
+ // Check the allocated marker can view the submission.
$this->setUser($this->teachers[0]);
$gradingtable = new assign_grading_table($assign, 100, '', 0, true);
$output = $assign->get_renderer()->render($gradingtable);
$this->assertEquals(true, strpos($output, $this->students[0]->lastname));
- // Check that other teachers can't view this submission
+ // Check that other teachers can't view this submission.
$this->setUser($this->teachers[1]);
$gradingtable = new assign_grading_table($assign, 100, '', 0, true);
$output = $assign->get_renderer()->render($gradingtable);