Merge branch 'MDL-78773-404' of https://github.com/paulholden/moodle into MOODLE_404_STABLE

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

View File

@ -14,16 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Report plugins helper class
*
* @package core
* @subpackage report
* @copyright 2021 Sujith Haridasan
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core;
use context_course;
use moodle_url;
use stdClass;
@ -32,17 +24,19 @@ use stdClass;
* A helper class with static methods to help report plugins
*
* @package core
* @subpackage report
* @copyright 2021 Sujith Haridasan
* @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)) {
@ -81,12 +75,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);

View File

@ -1,6 +1,11 @@
This files describes API changes in /report/* - plugins,
information provided here is intended especially for developers.
=== 4.4.2 ===
* The `report_helper::print_report_selector` method accepts an additional argument for adding content to the
tertiary navigation to align with the report selector
=== 4.2 ===
* The method report_progress\local\helper::get_activities_to_show() has an additional parameter $activitysection