MDL-48074 enrol: option to filter by users 'not in any group'

This commit is contained in:
Davo Smith 2015-04-30 14:22:03 +01:00
parent e5eefbbf01
commit 0c9d8172b5
3 changed files with 9 additions and 2 deletions

View file

@ -280,8 +280,13 @@ class course_enrolment_manager {
// Group condition.
if ($this->groupfilter) {
$sql .= " AND gm.groupid = :groupid";
$params['groupid'] = $this->groupfilter;
if ($this->groupfilter < 0) {
// Show users who are not in any group.
$sql .= " AND gm.groupid IS NULL";
} else {
$sql .= " AND gm.groupid = :groupid";
$params['groupid'] = $this->groupfilter;
}
}
// Status condition.

View file

@ -167,6 +167,7 @@ class enrol_users_filter_form extends moodleform {
// Filter by group.
$allgroups = $manager->get_all_groups();
$groupsmenu[0] = get_string('allparticipants');
$groupsmenu[-1] = get_string('nogroup', 'enrol');
foreach($allgroups as $gid => $unused) {
$groupsmenu[$gid] = $allgroups[$gid]->name;
}