This commit is contained in:
Huong Nguyen 2024-06-20 11:06:01 +07:00
commit 966d5308a5
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,8 @@
issueNumber: MDL-78773
notes:
report:
- message: >
The `report_helper::print_report_selector` method accepts an additional
argument for adding content to the tertiary navigation to align with the
report selector
type: changed

View File

@ -28,13 +28,14 @@ use stdClass;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class report_helper {
/**
* Print the selector dropdown
*
* @param string $pluginname The report plugin where the header is modified
* @return void
* @param string $additional Additional content to display aligned with the selector
*/
public static function print_report_selector(string $pluginname): void {
public static function print_report_selector(string $pluginname, string $additional = ''): void {
global $OUTPUT, $PAGE;
if ($reportnode = $PAGE->settingsnav->find('coursereports', \navigation_node::TYPE_CONTAINER)) {
@ -73,12 +74,18 @@ class report_helper {
$options = \html_writer::tag(
'div',
$OUTPUT->render_from_template('core/tertiary_navigation_selector', $selectmenu->export_for_template($OUTPUT)),
['class' => 'row pb-3']
['class' => 'navitem']
);
if ($additional) {
$options .= \html_writer::div('', 'navitem-divider') .
\html_writer::div($additional, 'navitem');
}
echo \html_writer::tag(
'div',
$options,
['class' => 'tertiary-navigation full-width-bottom-border ml-0', 'id' => 'tertiary-navigation']);
['class' => 'tertiary-navigation full-width-bottom-border ml-0 d-flex', 'id' => 'tertiary-navigation']);
} else {
echo $OUTPUT->heading($pluginname, 2, 'mb-3');
}

View File

@ -86,12 +86,15 @@ if ($course->id == SITEID) {
$PAGE->set_title("$course->shortname: $strstats");
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('report');
$PAGE->set_headingmenu(report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/report/stats/index.php"));
echo $OUTPUT->header();
// Print the selected dropdown.
$pluginname = get_string('pluginname', 'report_stats');
report_helper::print_report_selector($pluginname);
report_helper::print_report_selector(
get_string('pluginname', 'report_stats'),
report_stats_mode_menu($course, $mode, $time, $PAGE->url->out_omit_querystring())
);
}
report_stats_report($course, $report, $mode, $user, $roleid, $time);