Skip to content

Commit

Permalink
MDL-73772 reports: Fix Activity completion report with no group select
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed Feb 9, 2022
1 parent 5897242 commit ddfc331
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 21 additions & 2 deletions report/progress/classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function render_include_activity_select(\moodle_url $url, array $activity
);
$activityincludeselect->set_label(get_string('include', 'report_progress'));
return \html_writer::div($this->output->render($activityincludeselect),
'include-activity-selector d-inline-block ml-3' );
'include-activity-selector d-inline-block mr-3' );
}

/**
Expand All @@ -69,7 +69,26 @@ public function render_activity_order_select(\moodle_url $url, string $activityo
);
$sorttable->set_label(get_string('activityorder', 'report_progress'));
return \html_writer::div($this->output->render($sorttable),
'activity-order-selector include-activity-selector d-inline-block ml-3');
'activity-order-selector include-activity-selector d-inline-block');
}

/**
* Render groups single select box.
*
* @param \moodle_url $url The base url.
* @param \stdClass $course Current course.
* @return string HTML
*/
public function render_groups_select(\moodle_url $url, \stdClass $course): string {
$groupurl = fullclone($url);
$groupurl->remove_params(['page', 'group']);
$groupoutput = groups_print_course_menu($course, $groupurl, true);

if (empty($groupoutput)) {
return $groupoutput;
}

return \html_writer::div($groupoutput, 'd-inline-block mr-3');
}

/**
Expand Down
4 changes: 1 addition & 3 deletions report/progress/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ function csv_quote($value) {
$PAGE->requires->js_call_amd('report_progress/completion_override', 'init', [fullname($USER)]);

// Handle groups (if enabled).
$groupurl = fullclone($url);
$groupurl->remove_params(['page', 'group']);
groups_print_course_menu($course, $groupurl);
echo $output->render_groups_select($url, $course);

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

0 comments on commit ddfc331

Please sign in to comment.