mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-60732-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
ed0e2cea00
1 changed files with 13 additions and 15 deletions
|
@ -121,6 +121,7 @@ class core_user_renderer extends plugin_renderer_base {
|
||||||
global $CFG, $DB, $USER;
|
global $CFG, $DB, $USER;
|
||||||
|
|
||||||
require_once($CFG->dirroot . '/enrol/locallib.php');
|
require_once($CFG->dirroot . '/enrol/locallib.php');
|
||||||
|
require_once($CFG->dirroot . '/lib/grouplib.php');
|
||||||
$manager = new course_enrolment_manager($this->page, $course);
|
$manager = new course_enrolment_manager($this->page, $course);
|
||||||
|
|
||||||
$filteroptions = [];
|
$filteroptions = [];
|
||||||
|
@ -135,21 +136,19 @@ class core_user_renderer extends plugin_renderer_base {
|
||||||
$filteroptions += $roleoptions;
|
$filteroptions += $roleoptions;
|
||||||
|
|
||||||
// Filter options for groups, if available.
|
// Filter options for groups, if available.
|
||||||
if ($course->groupmode != NOGROUPS) {
|
if (has_capability('moodle/site:accessallgroups', $context) || $course->groupmode != SEPARATEGROUPS) {
|
||||||
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 or no groups mode.
|
||||||
// List all groups if the user can access all groups, or we are in visible group mode.
|
$groups = $manager->get_all_groups();
|
||||||
$groups = $manager->get_all_groups();
|
} else {
|
||||||
} else {
|
// Otherwise, just list the groups the user belongs to.
|
||||||
// Otherwise, just list the groups the user belongs to.
|
$groups = groups_get_all_groups($course->id, $USER->id);
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
$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);
|
$canreviewenrol = has_capability('moodle/course:enrolreview', $context);
|
||||||
|
|
||||||
|
@ -241,7 +240,6 @@ class core_user_renderer extends plugin_renderer_base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add missing applied filters to the filter options.
|
// Add missing applied filters to the filter options.
|
||||||
$filteroptions = $this->handle_missing_applied_filters($filtersapplied, $filteroptions);
|
$filteroptions = $this->handle_missing_applied_filters($filtersapplied, $filteroptions);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue