Merge branch 'wip-mdl-40218' of git://github.com/rajeshtaneja/moodle

This commit is contained in:
Marina Glancy 2013-07-10 09:58:09 +10:00
commit 9a2188812d
11 changed files with 239 additions and 31 deletions

View File

@ -687,9 +687,12 @@ EOD;
* @param string $enrol name of enrol plugin,
* there must be exactly one instance in course,
* it must support enrol_user() method.
* @param int $timestart (optional) 0 means unknown
* @param int $timeend (optional) 0 means forever
* @param int $status (optional) default to ENROL_USER_ACTIVE for new enrolments
* @return bool success
*/
public function enrol_user($userid, $courseid, $roleid = null, $enrol = 'manual') {
public function enrol_user($userid, $courseid, $roleid = null, $enrol = 'manual', $timestart = 0, $timeend = 0, $status = null) {
global $DB;
if (!$plugin = enrol_get_plugin($enrol)) {
@ -706,8 +709,7 @@ EOD;
$roleid = $instance->roleid;
}
$plugin->enrol_user($instance, $userid, $roleid);
$plugin->enrol_user($instance, $userid, $roleid, $timestart, $timeend, $status);
return true;
}
}

View File

@ -69,6 +69,13 @@ class mod_assign_grading_options_form extends moodleform {
$mform->setDefault('quickgrading', $instance['quickgrading']);
}
// Show active/suspended user option.
if ($instance['showonlyactiveenrolopt']) {
$mform->addElement('checkbox', 'showonlyactiveenrol', get_string('showonlyactiveenrol', 'grades'), '', $dirtyclass);
$mform->addHelpButton('showonlyactiveenrol', 'showonlyactiveenrol', 'grades');
$mform->setDefault('showonlyactiveenrol', $instance['showonlyactiveenrol']);
}
// Hidden params.
$mform->addElement('hidden', 'contextid', $instance['contextid']);
$mform->setType('contextid', PARAM_INT);

View File

@ -725,10 +725,18 @@ class assign_grading_table extends table_sql implements renderable {
if (!$this->is_downloading()) {
$courseid = $this->assignment->get_course()->id;
$link= new moodle_url('/user/view.php', array('id' =>$row->id, 'course'=>$courseid));
return $this->output->action_link($link, fullname($row));
$fullname = $this->output->action_link($link, fullname($row));
} else {
return fullname($row);
$fullname = fullname($row);
}
if (!$this->assignment->is_active_user($row->id)) {
$suspendedstring = get_string('userenrolmentsuspended', 'grades');
$fullname .= ' ' . html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/enrolmentsuspended'),
'title' => $suspendedstring, 'alt' => $suspendedstring, 'class' => 'usersuspendedicon'));
$fullname = html_writer::tag('span', $fullname, array('class' => 'usersuspended'));
}
return $fullname;
}
/**

View File

@ -122,6 +122,12 @@ class assign {
/** @var array of marking workflow states for the current user */
private $markingworkflowstates = null;
/** @var bool whether to exclude users with inactive enrolment */
private $showonlyactiveenrol = null;
/** @var array list of suspended user IDs in form of ([id1] => id1) */
public $susers = null;
/**
* Constructor for the base assign class.
*
@ -134,8 +140,6 @@ class assign {
* otherwise this class will load one from the context as required.
*/
public function __construct($coursemodulecontext, $coursemodule, $course) {
global $PAGE;
$this->context = $coursemodulecontext;
$this->coursemodule = $coursemodule;
$this->course = $course;
@ -1256,9 +1260,11 @@ class assign {
*/
public function list_participants($currentgroup, $idsonly) {
if ($idsonly) {
return get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, 'u.id');
return get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, 'u.id', null, null, null,
$this->show_only_active_users());
} else {
return get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup);
return get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, 'u.*', null, null, null,
$this->show_only_active_users());
}
}
@ -1284,18 +1290,18 @@ class assign {
}
/**
* Load a count of users enrolled in the current course with the specified permission and group.
* Load a count of active users enrolled in the current course with the specified permission and group.
* 0 for no group.
*
* @param int $currentgroup
* @return int number of matching users
*/
public function count_participants($currentgroup) {
return count_enrolled_users($this->context, 'mod/assign:submit', $currentgroup);
return count_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, true);
}
/**
* Load a count of users submissions in the current module that require grading
* Load a count of active users submissions in the current module that require grading
* This means the submission modification time is more recent than the
* grading modification time and the status is SUBMITTED.
*
@ -1310,7 +1316,7 @@ class assign {
}
$currentgroup = groups_get_activity_group($this->get_course_module(), true);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, false);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$submissionmaxattempt = 'SELECT mxs.userid, MAX(mxs.attemptnumber) AS maxattempt
FROM {assign_submission} mxs
@ -1356,7 +1362,7 @@ class assign {
}
$currentgroup = groups_get_activity_group($this->get_course_module(), true);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, false);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$params['assignid'] = $this->get_instance()->id;
@ -1395,7 +1401,7 @@ class assign {
$params['groupuserid'] = 0;
} else {
$currentgroup = groups_get_activity_group($this->get_course_module(), true);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, false);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$params['assignid'] = $this->get_instance()->id;
@ -1405,6 +1411,7 @@ class assign {
WHERE
s.assignment = :assignid AND
s.timemodified IS NOT NULL';
}
return $DB->count_records_sql($sql, $params);
@ -1420,7 +1427,7 @@ class assign {
global $DB;
$currentgroup = groups_get_activity_group($this->get_course_module(), true);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, false);
list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
$params['assignid'] = $this->get_instance()->id;
$params['assignid2'] = $this->get_instance()->id;
@ -1455,6 +1462,7 @@ class assign {
s.assignment = :assignid AND
s.timemodified IS NOT NULL AND
s.status = :submissionstatus';
}
return $DB->count_records_sql($sql, $params);
@ -1839,6 +1847,14 @@ class assign {
}
}
}
// Exclude suspended users, if user can't see them.
if (!has_capability('moodle/course:viewsuspendedusers', $this->context)) {
foreach ($members as $key => $member) {
if (!$this->is_active_user($member->id)) {
unset($members[$key]);
}
}
}
return $members;
}
@ -2289,7 +2305,8 @@ class assign {
require_capability('mod/assign:grade', $this->context);
// Load all users with submit.
$students = get_enrolled_users($this->context, "mod/assign:submit");
$students = get_enrolled_users($this->context, "mod/assign:submit", null, 'u.*', null, null, null,
$this->show_only_active_users());
// Build a list of files to zip.
$filesforzipping = array();
@ -2657,12 +2674,12 @@ class assign {
$viewfullnames,
$this->is_blind_marking(),
$this->get_uniqueid_for_user($user->id),
get_extra_user_fields($this->get_context()));
get_extra_user_fields($this->get_context()),
!$this->is_active_user($userid));
$o .= $this->get_renderer()->render($usersummary);
}
$submission = $this->get_user_submission($userid, false, $attemptnumber);
$submissiongroup = null;
$submissiongroupmemberswhohavenotsubmitted = array();
$teamsubmission = null;
$notsubmitted = array();
if ($instance->teamsubmission) {
@ -2904,6 +2921,7 @@ class assign {
$controller = $gradingmanager->get_active_controller();
$showquickgrading = empty($controller);
$quickgrading = get_user_preferences('assign_quickgrading', false);
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
$markingallocation = $this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context);
@ -2935,7 +2953,9 @@ class assign {
'showquickgrading'=>$showquickgrading,
'quickgrading'=>$quickgrading,
'markingworkflowopt'=>$markingworkflowoptions,
'markingallocationopt'=>$markingallocationoptions);
'markingallocationopt'=>$markingallocationoptions,
'showonlyactiveenrolopt'=>$showonlyactiveenrolopt,
'showonlyactiveenrol'=>$this->show_only_active_users());
$classoptions = array('class'=>'gradingoptionsform');
$gradingoptionsform = new mod_assign_grading_options_form(null,
@ -3184,6 +3204,9 @@ class assign {
if ($userid == $USER->id && has_capability('mod/assign:submit', $this->context)) {
return true;
}
if (!$this->is_active_user($userid) && !has_capability('moodle/course:viewsuspendedusers', $this->context)) {
return false;
}
if (has_capability('mod/assign:grade', $this->context)) {
return true;
}
@ -3328,7 +3351,8 @@ class assign {
$this->get_course_context()),
$this->is_blind_marking(),
$this->get_uniqueid_for_user($user->id),
$extrauserfields));
$extrauserfields,
!$this->is_active_user($userid)));
$usercount += 1;
}
@ -3379,10 +3403,11 @@ class assign {
$usershtml .= $this->get_renderer()->render(new assign_user_summary($user,
$this->get_course()->id,
has_capability('moodle/site:viewfullnames',
$this->get_course_context()),
$this->get_course_context()),
$this->is_blind_marking(),
$this->get_uniqueid_for_user($user->id),
$extrauserfields));
$extrauserfields,
!$this->is_active_user($userid)));
$usercount += 1;
}
@ -3926,7 +3951,9 @@ class assign {
foreach ($team as $member) {
$membersubmission = $this->get_user_submission($member->id, false, $submission->attemptnumber);
if (!$membersubmission || $membersubmission->status != ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
// If no submission found for team member and member is active then everyone has not submitted.
if (!$membersubmission || $membersubmission->status != ASSIGN_SUBMISSION_STATUS_SUBMITTED
&& ($this->is_active_user($member->id))) {
$allsubmitted = false;
if ($anysubmitted) {
break;
@ -4096,7 +4123,8 @@ class assign {
* @return array
*/
protected function get_graders($userid) {
$potentialgraders = get_enrolled_users($this->context, 'mod/assign:grade');
// Potential graders should be active users only.
$potentialgraders = get_enrolled_users($this->context, "mod/assign:grade", null, 'u.*', null, null, null, true);
$graders = array();
if (groups_get_activity_groupmode($this->get_course_module()) == SEPARATEGROUPS) {
@ -4802,6 +4830,11 @@ class assign {
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
$controller = $gradingmanager->get_active_controller();
$showquickgrading = empty($controller);
if (!is_null($this->context)) {
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
} else {
$showonlyactiveenrolopt = false;
}
$markingallocation = $this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context);
@ -4831,7 +4864,9 @@ class assign {
'showquickgrading'=>$showquickgrading,
'quickgrading'=>false,
'markingworkflowopt' => $markingworkflowoptions,
'markingallocationopt' => $markingallocationoptions);
'markingallocationopt' => $markingallocationoptions,
'showonlyactiveenrolopt'=>$showonlyactiveenrolopt,
'showonlyactiveenrol'=>$this->show_only_active_users());
$mform = new mod_assign_grading_options_form(null, $gradingoptionsparams);
if ($formdata = $mform->get_data()) {
@ -4848,6 +4883,11 @@ class assign {
if ($showquickgrading) {
set_user_preference('assign_quickgrading', isset($formdata->quickgrading));
}
if (!empty($showonlyactiveenrolopt)) {
$showonlyactiveenrol = isset($formdata->showonlyactiveenrol);
set_user_preference('grade_report_showonlyactiveenrol', $showonlyactiveenrol);
$this->showonlyactiveenrol = $showonlyactiveenrol;
}
}
}
@ -6331,6 +6371,38 @@ class assign {
return $this->markingworkflowstates;
}
/**
* Check is only active users in course should be shown.
*
* @return bool true if only active users should be shown.
*/
public function show_only_active_users() {
global $CFG;
if (is_null($this->showonlyactiveenrol)) {
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
$this->showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
if (!is_null($this->context)) {
$this->showonlyactiveenrol = $this->showonlyactiveenrol ||
!has_capability('moodle/course:viewsuspendedusers', $this->context);
}
}
return $this->showonlyactiveenrol;
}
/**
* Return true is user is active user in course else false
*
* @param int $userid
* @return bool true is user is active in course.
*/
public function is_active_user($userid) {
if (is_null($this->susers) && !is_null($this->context)) {
$this->susers = get_suspended_userids($this->context);
}
return !in_array($userid, $this->susers);
}
}
/**

View File

@ -149,6 +149,10 @@ M.mod_assign.init_grading_options = function(Y) {
Y.one('form.gradingoptionsform').submit();
});
}
var showonlyactiveenrolelement = Y.one('#id_showonlyactiveenrol');
showonlyactiveenrolelement.on('change', function(e) {
Y.one('form.gradingoptionsform').submit();
});
});
};

View File

@ -125,6 +125,8 @@ class assign_user_summary implements renderable {
public $uniqueidforuser;
/** @var array $extrauserfields */
public $extrauserfields;
/** @var bool $suspendeduser */
public $suspendeduser;
/**
* Constructor
@ -134,19 +136,22 @@ class assign_user_summary implements renderable {
* @param bool $blindmarking
* @param int $uniqueidforuser
* @param array $extrauserfields
* @param bool $suspendeduser
*/
public function __construct(stdClass $user,
$courseid,
$viewfullnames,
$blindmarking,
$uniqueidforuser,
$extrauserfields) {
$extrauserfields,
$suspendeduser = false) {
$this->user = $user;
$this->courseid = $courseid;
$this->viewfullnames = $viewfullnames;
$this->blindmarking = $blindmarking;
$this->uniqueidforuser = $uniqueidforuser;
$this->extrauserfields = $extrauserfields;
$this->suspendeduser = $suspendeduser;
}
}

View File

@ -124,14 +124,23 @@ class mod_assign_renderer extends plugin_renderer_base {
*/
public function render_assign_user_summary(assign_user_summary $summary) {
$o = '';
$supendedclass = '';
$suspendedicon = '';
if (!$summary->user) {
return;
}
if ($summary->suspendeduser) {
$supendedclass = ' usersuspended';
$suspendedstring = get_string('userenrolmentsuspended', 'grades');
$suspendedicon = ' ' . html_writer::empty_tag('img', array('src' => $this->pix_url('i/enrolmentsuspended'),
'title' => $suspendedstring, 'alt' => $suspendedstring, 'class' => 'usersuspendedicon'));
}
$o .= $this->output->container_start('usersummary');
$o .= $this->output->box_start('boxaligncenter usersummarysection');
$o .= $this->output->box_start('boxaligncenter usersummarysection'.$supendedclass);
if ($summary->blindmarking) {
$o .= get_string('hiddenuser', 'assign') . $summary->uniqueidforuser;
$o .= get_string('hiddenuser', 'assign') . $summary->uniqueidforuser.$suspendedicon;
} else {
$o .= $this->output->user_picture($summary->user);
$o .= $this->output->spacer(array('width'=>30));
@ -145,6 +154,7 @@ class mod_assign_renderer extends plugin_renderer_base {
if (count($extrainfo)) {
$fullname .= ' (' . implode(', ', $extrainfo) . ')';
}
$fullname .= $suspendedicon;
$o .= $this->output->action_link($url, $fullname);
}
$o .= $this->output->box_end();

View File

@ -46,6 +46,8 @@ class mod_assign_base_testcase extends advanced_testcase {
const DEFAULT_EDITING_TEACHER_COUNT = 2;
/** @const Optional extra number of students to create */
const EXTRA_STUDENT_COUNT = 40;
/** @const Optional number of suspended students */
const EXTRA_SUSPENDED_COUNT = 10;
/** @const Optional extra number of teachers to create */
const EXTRA_TEACHER_COUNT = 5;
/** @const Optional extra number of editing teachers to create */
@ -74,6 +76,9 @@ class mod_assign_base_testcase extends advanced_testcase {
/** @var array $extrastudents List of EXTRA_STUDENT_COUNT students in the course*/
protected $extrastudents = null;
/** @var array $extrasuspendedstudents List of EXTRA_SUSPENDED_COUNT students in the course*/
protected $extrasuspendedstudents = null;
/** @var array $groups List of 10 groups in the course */
protected $groups = null;
@ -151,6 +156,11 @@ class mod_assign_base_testcase extends advanced_testcase {
array_push($this->extrastudents, $this->getDataGenerator()->create_user());
}
$this->extrasuspendedstudents = array();
for ($i = 0; $i < self::EXTRA_SUSPENDED_COUNT; $i++) {
array_push($this->extrasuspendedstudents, $this->getDataGenerator()->create_user());
}
$teacherrole = $DB->get_record('role', array('shortname'=>'teacher'));
foreach ($this->extrateachers as $i => $teacher) {
$this->getDataGenerator()->enrol_user($teacher->id,
@ -177,6 +187,14 @@ class mod_assign_base_testcase extends advanced_testcase {
}
}
foreach ($this->extrasuspendedstudents as $i => $suspendedstudent) {
$this->getDataGenerator()->enrol_user($suspendedstudent->id,
$this->course->id,
$studentrole->id, 'manual', 0, 0, ENROL_USER_SUSPENDED);
if ($i < (self::EXTRA_SUSPENDED_COUNT / 2)) {
groups_add_member($this->groups[$i % self::GROUP_COUNT], $suspendedstudent);
}
}
}
/**

View File

@ -298,6 +298,18 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$assign = $this->create_instance(array('grade'=>100));
$this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($assign->list_participants(null, true)));
// Teacher with user preference set should see suspended users as well.
set_user_preference('grade_report_showonlyactiveenrol', false);
$assign = $this->create_instance(array('grade'=>100));
$this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT + self::EXTRA_SUSPENDED_COUNT,
count($assign->list_participants(null, true)));
// Non-editing teacher should not see suspended users, even if user preference is set.
$this->setUser($this->teachers[0]);
set_user_preference('grade_report_showonlyactiveenrol', false);
$assign = $this->create_instance(array('grade'=>100));
$this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($assign->list_participants(null, true)));
}
public function test_count_teams() {
@ -366,11 +378,24 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$plugin = $assign->get_submission_plugin_by_type('onlinetext');
$plugin->save($submission, $data);
// Simulate a submission for suspended user, this will never be counted.
$this->setUser($this->extrastudents[3]);
$submission = $assign->get_user_submission($this->extrasuspendedstudents[0]->id, true);
$submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
$assign->testable_update_submission($submission, $this->extrasuspendedstudents[0]->id, true, false);
$data = new stdClass();
$data->onlinetext_editor = array('itemid'=>file_get_unused_draft_itemid(),
'text'=>'Submission text',
'format'=>FORMAT_MOODLE);
$plugin = $assign->get_submission_plugin_by_type('onlinetext');
$plugin->save($submission, $data);
// Simulate adding a grade.
$this->setUser($this->teachers[0]);
$data = new stdClass();
$data->grade = '50.0';
$assign->testable_apply_grade_to_user($data, $this->extrastudents[3]->id, 0);
$assign->testable_apply_grade_to_user($data, $this->extrasuspendedstudents[0]->id, 0);
$this->assertEquals(2, $assign->count_grades());
$this->assertEquals(4, $assign->count_submissions());
@ -386,6 +411,13 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$users = $assign->testable_get_grading_userid_list();
$this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT, count($users));
$this->setUser($this->editingteachers[0]);
set_user_preference('grade_report_showonlyactiveenrol', false);
$assign = $this->create_instance();
$users = $assign->testable_get_grading_userid_list();
$this->assertEquals(self::DEFAULT_STUDENT_COUNT + self::EXTRA_STUDENT_COUNT + self::EXTRA_SUSPENDED_COUNT, count($users));
}
public function test_cron() {
@ -431,6 +463,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
}
public function test_can_view_submission() {
$this->create_extra_users();
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
@ -442,10 +475,12 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$this->assertEquals(true, $assign->can_view_submission($this->students[0]->id));
$this->assertEquals(true, $assign->can_view_submission($this->students[1]->id));
$this->assertEquals(true, $assign->can_view_submission($this->teachers[0]->id));
$this->assertEquals(false, $assign->can_view_submission($this->extrasuspendedstudents[0]->id));
$this->setUser($this->editingteachers[0]);
$this->assertEquals(true, $assign->can_view_submission($this->students[0]->id));
$this->assertEquals(true, $assign->can_view_submission($this->students[1]->id));
$this->assertEquals(true, $assign->can_view_submission($this->teachers[0]->id));
$this->assertEquals(true, $assign->can_view_submission($this->extrasuspendedstudents[0]->id));
}
@ -479,7 +514,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$submission = $assign->get_group_submission($this->extrastudents[0]->id, 0, true);
$assign->testable_update_submission($submission, $this->extrastudents[0]->id, true, true);
// Check that at least 2 members of the submission group had their submission updated.
// Check that at least 2 active members and 1 suspended member of the submission group had their submission updated.
$this->setUser($this->editingteachers[0]);
$gradinginfo = grade_get_grades($this->course->id,
@ -500,6 +535,50 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
$this->assertEquals($this->extrastudents[self::GROUP_COUNT]->id,
$gradinginfo->items[0]->grades[$this->extrastudents[self::GROUP_COUNT]->id]->usermodified);
$gradinginfo = grade_get_grades($this->course->id,
'mod',
'assign',
$assign->get_instance()->id,
$this->extrasuspendedstudents[0]->id);
$this->assertEquals($this->extrasuspendedstudents[0]->id,
$gradinginfo->items[0]->grades[$this->extrasuspendedstudents[0]->id]->usermodified);
// Check the same with non-editing teacher and make sure submission is not updated for suspended user.
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance(array('teamsubmission'=>1));
$this->setUser($this->extrastudents[1]);
$now = time();
$submission = $assign->get_group_submission($this->extrastudents[1]->id, 0, true);
$assign->testable_update_submission($submission, $this->extrastudents[1]->id, true, true);
$this->setUser($this->teachers[0]);
$gradinginfo = grade_get_grades($this->course->id,
'mod',
'assign',
$assign->get_instance()->id,
$this->extrastudents[1]->id);
$this->assertEquals($this->extrastudents[1]->id,
$gradinginfo->items[0]->grades[$this->extrastudents[1]->id]->usermodified);
$gradinginfo = grade_get_grades($this->course->id,
'mod',
'assign',
$assign->get_instance()->id,
$this->extrastudents[self::GROUP_COUNT+1]->id);
$this->assertEquals($this->extrastudents[self::GROUP_COUNT+1]->id,
$gradinginfo->items[0]->grades[$this->extrastudents[self::GROUP_COUNT+1]->id]->usermodified);
$gradinginfo = grade_get_grades($this->course->id,
'mod',
'assign',
$assign->get_instance()->id,
$this->extrasuspendedstudents[1]->id);
$this->assertEquals($this->extrasuspendedstudents[1]->id,
$gradinginfo->items[0]->grades[$this->extrasuspendedstudents[1]->id]->usermodified);
// Now verify blind marking.
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance(array('blindmarking'=>1));

View File

@ -1,5 +1,8 @@
This files describes API changes in the assign code.
=== 2.6 ===
* To see submission/grades of inactive users, user should have moodle/course:viewsuspendedusers capability.
* count_* functions will return only active participants.
=== 2.5 ===

View File

@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$module->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
$module->version = 2013061101; // The current module version (Date: YYYYMMDDXX).
$module->version = 2013070901; // The current module version (Date: YYYYMMDDXX).
$module->requires = 2013050100; // Requires this Moodle version.
$module->cron = 60;