Skip to content

Commit

Permalink
MDL-48074 enrol: option to filter by users 'not in any group'
Browse files Browse the repository at this point in the history
  • Loading branch information
davosmith committed Jul 3, 2015
1 parent e5eefbb commit 0c9d817
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enrol/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,13 @@ protected function get_filter_sql() {

// 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.
Expand Down
1 change: 1 addition & 0 deletions enrol/users_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ function definition() {
// 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;
}
Expand Down
1 change: 1 addition & 0 deletions lang/en/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
$string['migratetomanual'] = 'Migrate to manual enrolments';
$string['nochange'] = 'No change';
$string['noexistingparticipants'] = 'No existing participants';
$string['nogroup'] = 'No group';
$string['noguestaccess'] = 'Guests can not access this course, please try to log in.';
$string['none'] = 'None';
$string['notenrollable'] = 'You can not enrol yourself in this course.';
Expand Down

0 comments on commit 0c9d817

Please sign in to comment.