-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.4.4, 4.5, 5.0
-
MOODLE_404_STABLE, MOODLE_405_STABLE, MOODLE_500_STABLE
-
mdl-83307_404
-
mdl-83307_405
-
mdl-83307_main
-
-
Fixes for some section return issues, which I noticed while working on MDL-83224.
Explanation of the fixes:
course/format/classes/output/local/content/cm/delegatedcontrolmenu.php (4.5 and main only)
- $baseurl = course_get_url($course, $sectionreturn);
+ $baseurl = course_get_url($course);
+ if (!is_null($sectionreturn)) {
+ $baseurl->param('sectionid', $format->get_sectionid());
Old behaviour was for course_get_url to put the passed section number in a section URL parameter. view.php uses that section number as the return section (except in options that appropriate it for another purpose). New behaviour is to put the put the passed section into a URL anchor, which is no use. We instead need to put the section number in a section URL parameter, or the section ID in a sectionid parameter manually. Using the section number is prone to error if sections are reordered, so section ID is better.
- if (!is_null($sectionreturn)) {
- $url->param('sr', $format->get_sectionid());
The view.php code doesn't use an sr parameter. As above, it uses the section or sectionid parameters for this purpose instead sometimes. And it's now set.
course/format/classes/output/local/content/section/controlmenu.php
- $baseurl = course_get_url($course, $sectionreturn);
+ $baseurl = course_get_url($course);
+ if (!is_null($sectionreturn)) {
+ $baseurl->param('sectionid', $format->get_sectionid());
Same reason as in delegatedcontrolmenu.php .
- if (!is_null($sectionreturn)) {
- $url->param('sectionid', $format->get_sectionid());
We don't need to do this for specific options, because it's now in the base URL.
- $url->param('section', $section->section);
+ $url->param('sectionid', $section->id);
(Three places.) Using the section number is prone to error if sections are reordered. And since I've used section ID above, we need to override that anyway, because it takes precedence.
course/format/topics/classes/output/courseformat/content/section/controlmenu.php
- if ($sectionreturn) {
- $url = course_get_url($course, $section->section);
- } else {
- $url = course_get_url($course);
+ $url = course_get_url($course);
+ if (!is_null($sectionreturn)) {
+ $url->param('sectionid', $format->get_sectionid());
Same reason as delegatedcontrolmenu.php
mod/lti/locallib.php
- function lti_get_configured_types($courseid, $sectionreturn = 0) {
+ function lti_get_configured_types($courseid, $sectionreturn = null) {
A section return of 0 now actually displays the section 0 page, instead of the course main page.
- has to be done before
-
MDL-83224 Revamp course get_view_url() options
-
- Development in progress
-