Skip to content
Permalink
Browse files
Merge branch 'MDL-60732-master' of git://github.com/damyon/moodle
  • Loading branch information
David Monllao committed Nov 8, 2017
2 parents 7effd6d + a471bc4 commit ed0e2cea00a78429a2c1431947dd7781efc92540
Showing with 13 additions and 15 deletions.
  1. +13 −15 user/renderer.php
@@ -121,6 +121,7 @@ public function unified_filter($course, $context, $filtersapplied) {
global $CFG, $DB, $USER;

require_once($CFG->dirroot . '/enrol/locallib.php');
require_once($CFG->dirroot . '/lib/grouplib.php');
$manager = new course_enrolment_manager($this->page, $course);

$filteroptions = [];
@@ -135,21 +136,19 @@ public function unified_filter($course, $context, $filtersapplied) {
$filteroptions += $roleoptions;

// Filter options for groups, if available.
if ($course->groupmode != NOGROUPS) {
if (has_capability('moodle/site:accessallgroups', $context) || $course->groupmode == VISIBLEGROUPS) {
// List all groups if the user can access all groups, or we are in visible group mode.
$groups = $manager->get_all_groups();
} else {
// Otherwise, just list the groups the user belongs to.
$groups = groups_get_all_groups($course->id, $USER->id);
}
$criteria = get_string('group');
$groupoptions = [];
foreach ($groups as $id => $group) {
$groupoptions += $this->format_filter_option(USER_FILTER_GROUP, $criteria, $id, $group->name);
}
$filteroptions += $groupoptions;
if (has_capability('moodle/site:accessallgroups', $context) || $course->groupmode != SEPARATEGROUPS) {
// List all groups if the user can access all groups, or we are in visible group mode or no groups mode.
$groups = $manager->get_all_groups();
} else {
// Otherwise, just list the groups the user belongs to.
$groups = groups_get_all_groups($course->id, $USER->id);
}
$criteria = get_string('group');
$groupoptions = [];
foreach ($groups as $id => $group) {
$groupoptions += $this->format_filter_option(USER_FILTER_GROUP, $criteria, $id, $group->name);
}
$filteroptions += $groupoptions;

$canreviewenrol = has_capability('moodle/course:enrolreview', $context);

@@ -241,7 +240,6 @@ public function unified_filter($course, $context, $filtersapplied) {
}
}


// Add missing applied filters to the filter options.
$filteroptions = $this->handle_missing_applied_filters($filtersapplied, $filteroptions);

0 comments on commit ed0e2ce

Please sign in to comment.