mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-57766-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
815ce88f44
@ -302,14 +302,8 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
if (!empty($markerfilter)) {
|
||||
if ($markerfilter == ASSIGN_MARKER_FILTER_NO_MARKER) {
|
||||
$where .= ' AND (uf.allocatedmarker IS NULL OR uf.allocatedmarker = 0)';
|
||||
} else {
|
||||
$where .= ' AND uf.allocatedmarker = :markerid';
|
||||
$params['markerid'] = $markerfilter;
|
||||
}
|
||||
}
|
||||
} else { // Only show users allocated to this marker.
|
||||
$where .= ' AND uf.allocatedmarker = :markerid';
|
||||
$params['markerid'] = $USER->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1783,7 +1783,7 @@ class assign {
|
||||
* @return array List of user records
|
||||
*/
|
||||
public function list_participants($currentgroup, $idsonly) {
|
||||
global $DB;
|
||||
global $DB, $USER;
|
||||
|
||||
if (empty($currentgroup)) {
|
||||
$currentgroup = 0;
|
||||
@ -1797,6 +1797,7 @@ class assign {
|
||||
$fields = 'u.*';
|
||||
$orderby = 'u.lastname, u.firstname, u.id';
|
||||
$additionaljoins = '';
|
||||
$additionalfilters = '';
|
||||
$instance = $this->get_instance();
|
||||
if (!empty($instance->blindmarking)) {
|
||||
$additionaljoins .= " LEFT JOIN {assign_user_mapping} um
|
||||
@ -1818,11 +1819,26 @@ class assign {
|
||||
$orderby = "COALESCE(s.timecreated, " . time() . ") ASC, COALESCE(s.id, " . PHP_INT_MAX . ") ASC, um.id ASC";
|
||||
}
|
||||
|
||||
if ($instance->markingworkflow &&
|
||||
$instance->markingallocation &&
|
||||
!has_capability('mod/assign:manageallocations', $this->get_context())) {
|
||||
|
||||
$additionaljoins .= ' LEFT JOIN {assign_user_flags} uf
|
||||
ON u.id = uf.userid
|
||||
AND uf.assignment = :assignmentid3';
|
||||
|
||||
$params['assignmentid3'] = (int) $instance->id;
|
||||
|
||||
$additionalfilters .= ' AND uf.allocatedmarker = :markerid';
|
||||
$params['markerid'] = $USER->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT $fields
|
||||
FROM {user} u
|
||||
JOIN ($esql) je ON je.id = u.id
|
||||
$additionaljoins
|
||||
WHERE u.deleted = 0
|
||||
$additionalfilters
|
||||
ORDER BY $orderby";
|
||||
|
||||
$users = $DB->get_records_sql($sql, $params);
|
||||
|
@ -2174,15 +2174,18 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||
|
||||
// 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));
|
||||
|
||||
$users = $assign->list_participants(0, true);
|
||||
$user = reset($users);
|
||||
$this->assertEquals($this->students[0]->id, $user->id);
|
||||
|
||||
$cm = get_coursemodule_from_instance('assign', $assign->get_instance()->id);
|
||||
$context = context_module::instance($cm->id);
|
||||
$assign = new testable_assign($context, $cm, $this->course);
|
||||
// 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);
|
||||
$this->assertNotEquals(true, strpos($output, $this->students[0]->lastname));
|
||||
$users = $assign->list_participants(0, true);
|
||||
$this->assertEquals(0, count($users));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user