MDL-41315 assign: Dont show users not in the current grouping

This is for separate groups mode. Note - this will be slower - but
this feature is experimental and groupslib does not provide a nicer api.
This commit is contained in:
Damyon Wiese
2013-09-13 14:47:01 +08:00
parent c1f10ffb24
commit a0e59f04dd
+12 -3
View File
@@ -1260,12 +1260,21 @@ class assign {
*/
public function list_participants($currentgroup, $idsonly) {
if ($idsonly) {
return get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, 'u.id', null, null, null,
$users = 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, 'u.*', null, null, null,
$users = get_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, 'u.*', null, null, null,
$this->show_only_active_users());
}
$cm = $this->get_course_module();
foreach ($users as $userid => $user) {
if (!groups_course_module_visible($cm, $userid)) {
unset($users[$userid]);
}
}
return $users;
}
/**
@@ -1297,7 +1306,7 @@ class assign {
* @return int number of matching users
*/
public function count_participants($currentgroup) {
return count_enrolled_users($this->context, 'mod/assign:submit', $currentgroup, true);
return count($this->list_participants($currentgroup, true));
}
/**