MDL-32508 course: deprecate get_section_url format callback

This commit is contained in:
Dan Poltawski 2012-04-27 09:36:37 +08:00
parent f755868314
commit d9e1326536
3 changed files with 10 additions and 24 deletions

View File

@ -80,14 +80,3 @@ function callback_topics_ajax_support() {
$ajaxsupport->testedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111, 'Safari' => 531, 'Chrome' => 6.0);
return $ajaxsupport;
}
/**
* Returns a URL to arrive directly at a section
*
* @param int $courseid The id of the course to get the link for
* @param int $sectionnum The section number to jump to
* @return moodle_url
*/
function callback_topics_get_section_url($courseid, $sectionnum) {
return new moodle_url('/course/view.php', array('id' => $courseid, 'topic' => $sectionnum));
}

View File

@ -102,14 +102,3 @@ function callback_weeks_ajax_support() {
$ajaxsupport->testedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111, 'Safari' => 531, 'Chrome' => 6.0);
return $ajaxsupport;
}
/**
* Returns a URL to arrive directly at a section
*
* @param int $courseid The id of the course to get the link for
* @param int $sectionnum The section number to jump to
* @return moodle_url
*/
function callback_weeks_get_section_url($courseid, $sectionnum) {
return new moodle_url('/course/view.php', array('id' => $courseid, 'week' => $sectionnum));
}

View File

@ -1762,7 +1762,10 @@ class global_navigation extends navigation_node {
$viewhiddensections = has_capability('moodle/course:viewhiddensections', $this->page->context);
$urlfunction = 'callback_'.$courseformat.'_get_section_url';
if ($course->coursedisplay == COURSE_DISPLAY_SINGLEPAGE || !function_exists($urlfunction)) {
if (function_exists($urlfunction)) {
debugging('Depricated callback_'.$courseformat.'_get_section_url in use.
Please switch your code to use the standard section url param');
} else {
$urlfunction = null;
}
@ -1788,8 +1791,13 @@ class global_navigation extends navigation_node {
}
$url = null;
if (!empty($urlfunction)) {
if ($urlfunction) {
// pre 2.3 style format url
$url = $urlfunction($course->id, $section->section);
}else{
if ($course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
$url = course_get_url($course, $section->section);
}
}
$sectionnode = $coursenode->add($sectionname, $url, navigation_node::TYPE_SECTION, null, $section->id);
$sectionnode->nodetype = navigation_node::NODETYPE_BRANCH;