Skip to content

Commit

Permalink
MDL-82381 report: Show group select in all courses
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Jul 5, 2024
1 parent 5aef789 commit f2d79fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions report/progress/classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ public function render_activity_order_select(\moodle_url $url, string $activityo
*
* @param \moodle_url $url The base url.
* @param \stdClass $course Current course.
* @param int $activegroup Currently active group, defaults to 0.
* @return string HTML
*/
public function render_groups_select(\moodle_url $url, \stdClass $course): string {
public function render_groups_select(\moodle_url $url, \stdClass $course, int $activegroup = 0): string {
$groups = groups_get_all_groups($course->id);
if (count($groups) == 0) {
return '';
}
$groupurl = fullclone($url);
$groupurl->remove_params(['page', 'group']);
$groupoutput = groups_print_course_menu($course, $groupurl, true);

$groupoutput = groups_allgroups_course_menu($course, $groupurl, true, $activegroup);
if (empty($groupoutput)) {
return $groupoutput;
}
Expand Down
8 changes: 6 additions & 2 deletions report/progress/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ function csv_quote($value) {
require_capability('report/progress:view',$context);

// Get group mode
$group = groups_get_course_group($course,true); // Supposed to verify group
if (groups_group_visible($groupid, $course)) {
$group = $groupid;
} else {
$group = 0;
}
if ($group===0 && $course->groupmode==SEPARATEGROUPS) {
require_capability('moodle/site:accessallgroups',$context);
}
Expand Down Expand Up @@ -205,7 +209,7 @@ function csv_quote($value) {
$PAGE->requires->js_call_amd('report_progress/completion_override', 'init', [fullname($USER)]);

// Handle groups (if enabled).
echo $output->render_groups_select($url, $course);
echo $output->render_groups_select($url, $course, $group);

// Display include activity filter.
echo $output->render_include_activity_select($url, $activitytypes, $activityinclude);
Expand Down

0 comments on commit f2d79fe

Please sign in to comment.