Skip to content

Commit

Permalink
Upgrade: Adopt changes from MDL-81960 and use new \core\url class.
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Nov 23, 2024
1 parent 6c59d23 commit 56aceb1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### v4.4-r4

* 2024-10-20 - Upgrade: Adopt changes from MDL-81960 and use new \core\url class.
* 2024-10-20 - Upgrade: Adopt changes from MDL-81031 and use new \core\user class.
* 2024-10-07 - Prepare compatibility for Moodle 4.5.
* 2024-09-23 - Documentation: Add a note about the removal of the local/recompletion:resetmycompletion capability to README.md
Expand Down
2 changes: 1 addition & 1 deletion classes/enrollist_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function other_cols($column, $row) {

// Inject actions column.
if ($column === 'actions') {
$buttonurl = new \moodle_url('/user/view.php', ['id' => $row->moodleuserid, 'course' => $row->courseid]);
$buttonurl = new \core\url('/user/view.php', ['id' => $row->moodleuserid, 'course' => $row->courseid]);
$buttonlabel = get_string('tableviewenrolment', 'enrol_semco');
return $OUTPUT->single_button($buttonurl, $buttonlabel, 'get');
}
Expand Down
8 changes: 4 additions & 4 deletions classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ public static function enrol_user($userid, $courseid, $semcobookingid, $timestar

// Throw an exception if recompletion is not enabled at all.
if (empty($recompletionconfig->recompletiontype)) {
$localrecompletionurl = new moodle_url('/local/recompletion/recompletion.php', ['id' => $params['courseid']]);
$localrecompletionurl = new \core\url('/local/recompletion/recompletion.php', ['id' => $params['courseid']]);
throw new moodle_exception('localrecompletionnotenabled', 'enrol_semco', '', $localrecompletionurl->out());
}

// Throw an exception if recompletion is not set to OnDemand.
if ($recompletionconfig->recompletiontype != \local_recompletion_recompletion_form::RECOMPLETION_TYPE_ONDEMAND) {
$localrecompletionurl = new moodle_url('/local/recompletion/recompletion.php', ['id' => $params['courseid']]);
$localrecompletionurl = new \core\url('/local/recompletion/recompletion.php', ['id' => $params['courseid']]);
throw new moodle_exception('localrecompletionnotondemand', 'enrol_semco', '', $localrecompletionurl->out());
}
}
Expand Down Expand Up @@ -1064,13 +1064,13 @@ public static function reset_course_completion($enrolid) {

// Throw an exception if recompletion is not enabled at all.
if (empty($recompletionconfig->recompletiontype)) {
$localrecompletionurl = new moodle_url('/local/recompletion/recompletion.php', ['id' => $instance->courseid]);
$localrecompletionurl = new \core\url('/local/recompletion/recompletion.php', ['id' => $instance->courseid]);
throw new moodle_exception('localrecompletionnotenabled', 'enrol_semco', '', $localrecompletionurl->out());
}

// Throw an exception if recompletion is not set to OnDemand.
if ($recompletionconfig->recompletiontype != \local_recompletion_recompletion_form::RECOMPLETION_TYPE_ONDEMAND) {
$localrecompletionurl = new moodle_url('/local/recompletion/recompletion.php', ['id' => $instance->courseid]);
$localrecompletionurl = new \core\url('/local/recompletion/recompletion.php', ['id' => $instance->courseid]);
throw new moodle_exception('localrecompletionnotondemand', 'enrol_semco', '', $localrecompletionurl->out());
}

Expand Down
2 changes: 1 addition & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function enrol_semco_callbackimpl_before_standard_top_of_body_html(&$hook = null

// Create new navigation node for enrolment report.
$reportnode = navigation_node::create(get_string('reportpagetitle', 'enrol_semco', null, true),
new moodle_url('/enrol/semco/enrolreport.php'),
new \core\url('/enrol/semco/enrolreport.php'),
navigation_node::TYPE_SETTING,
null,
'enrol_semco_enrolreport');
Expand Down
8 changes: 4 additions & 4 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// And if we are not during the initial install or if the script is called without setting the page URL
// (which will happen during the plugin installation and will show a debug warning, that's why we suppress debugging messages
// temporarily).
$settingsurl = new moodle_url('/admin/settings.php', ['section' => 'enrolsettingssemco']);
$settingsurl = new \core\url('/admin/settings.php', ['section' => 'enrolsettingssemco']);
$olddebug = $CFG->debug;
$CFG->debug = 0;
$pageurl = $PAGE->url;
Expand Down Expand Up @@ -84,7 +84,7 @@

// Create enrolment report heading.
$name = 'enrol_semco/settings_enrolmentreportheading';
$reporturl = new moodle_url('/enrol/semco/enrolreport.php');
$reporturl = new \core\url('/enrol/semco/enrolreport.php');
$title = get_string('settings_enrolmentreportheading', 'enrol_semco', null, true);
$description = get_string('settings_enrolmentreportheading_desc', 'enrol_semco', null, true).'<br />'.
html_writer::link($reporturl,
Expand Down Expand Up @@ -137,7 +137,7 @@
// Create information widget.
$name = 'enrol_semco/settings_coursecompletionnotfound';
$title = '';
$localrecompletionurl = new moodle_url('/admin/settings.php', ['section' => 'local_recompletion']);
$localrecompletionurl = new \core\url('/admin/settings.php', ['section' => 'local_recompletion']);
$notification = new \core\output\notification(get_string('settings_coursecompletionlrcintro', 'enrol_semco', null, true).
get_string('settings_coursecompletionlrcfound', 'enrol_semco', null, true).
get_string('settings_coursecompletionnote', 'enrol_semco', $localrecompletionurl->out(), true),
Expand All @@ -152,7 +152,7 @@
// Create information widget.
$name = 'enrol_semco/settings_coursecompletionnotfound';
$title = '';
$localrecompletionurl = new moodle_url('/admin/settings.php', ['section' => 'local_recompletion']);
$localrecompletionurl = new \core\url('/admin/settings.php', ['section' => 'local_recompletion']);
$notification = new \core\output\notification(get_string('settings_coursecompletionlrcintro', 'enrol_semco', null, true).
get_string('settings_coursecompletionlrcnotfound', 'enrol_semco', null, true).
get_string('settings_coursecompletionnote', 'enrol_semco', $localrecompletionurl->out(), true),
Expand Down

0 comments on commit 56aceb1

Please sign in to comment.