mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-73532 navigation: Modify methods that extend the setting nav
Introduces some changes to the exising _extend_settings_navigation() methods that utilize the global $PAGE object. In order to accomodate the changes done for the secondary navigation for single activity courses, the methods that extend the settings navigation can no longer rely on the $PAGE object, instead the more reliabe way to obtain this infomation is through the get_page() method from settings_navigation class.
This commit is contained in:
parent
bf27303955
commit
4a9c83ac9e
19 changed files with 132 additions and 145 deletions
|
@ -837,18 +837,19 @@ function h5pactivity_fetch_recent_activity(array $submissions, int $courseid) :
|
|||
*/
|
||||
function h5pactivity_extend_settings_navigation(settings_navigation $settingsnav,
|
||||
navigation_node $h5pactivitynode = null) {
|
||||
global $PAGE, $USER;
|
||||
global $USER;
|
||||
|
||||
$manager = manager::create_from_coursemodule($PAGE->cm);
|
||||
$manager = manager::create_from_coursemodule($settingsnav->get_page()->cm);
|
||||
|
||||
// Attempts report.
|
||||
if ($manager->can_view_all_attempts()) {
|
||||
$attemptsreporturl = new moodle_url('/mod/h5pactivity/report.php', ['a' => $PAGE->cm->instance]);
|
||||
$attemptsreporturl = new moodle_url('/mod/h5pactivity/report.php',
|
||||
['a' => $settingsnav->get_page()->cm->instance]);
|
||||
$h5pactivitynode->add(get_string('attempts_report', 'h5pactivity'), $attemptsreporturl,
|
||||
settings_navigation::TYPE_SETTING, '', 'attemptsreport');
|
||||
} else if ($manager->can_view_own_attempts() && $manager->count_attempts($USER->id)) {
|
||||
$attemptsreporturl = new moodle_url('/mod/h5pactivity/report.php',
|
||||
['a' => $PAGE->cm->instance, 'userid' => $USER->id]);
|
||||
['a' => $settingsnav->get_page()->cm->instance, 'userid' => $USER->id]);
|
||||
$h5pactivitynode->add(get_string('attempts_report', 'h5pactivity'), $attemptsreporturl,
|
||||
settings_navigation::TYPE_SETTING, '', 'attemptsreport');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue