diff --git a/course/format/topics/lang/en/format_topics.php b/course/format/topics/lang/en/format_topics.php index 31df02e067c..3afe91789ee 100644 --- a/course/format/topics/lang/en/format_topics.php +++ b/course/format/topics/lang/en/format_topics.php @@ -25,3 +25,4 @@ $string['sectionname'] = 'topic'; $string['pluginname'] = 'Topics format'; +$string['section0name'] = 'General'; \ No newline at end of file diff --git a/course/format/topics/lib.php b/course/format/topics/lib.php index 0279b22b86e..b47a986c179 100644 --- a/course/format/topics/lib.php +++ b/course/format/topics/lib.php @@ -34,21 +34,7 @@ * @return bool Returns true */ function callback_topics_load_content(&$navigation, $course, $coursenode) { - return $navigation->load_generic_course_sections($course, $coursenode, get_string('topic'), 'topic'); -} - -/** - * Used to display the course structure for a course where format=topic - * - * This is called automatically by {@link load_course()} if the current course - * format = weeks and the navigation was requested via AJAX - * - * @param array $path An array of keys to the course node in the navigation - * @param stdClass $modinfo The mod info object for the current course - * @return bool Returns true - */ -function callback_topics_load_limited_section(&$navigation, $keys, $course, $section) { - $navigation->limited_load_section_generic($keys, $course, $section, get_string('topic'), 'topic'); + return $navigation->load_generic_course_sections($course, $coursenode, get_string('topic'), 'topic', get_string('section0name', 'format_topics')); } /** diff --git a/course/format/weeks/lang/en/format_weeks.php b/course/format/weeks/lang/en/format_weeks.php index e60d81838da..fcdedba1a91 100644 --- a/course/format/weeks/lang/en/format_weeks.php +++ b/course/format/weeks/lang/en/format_weeks.php @@ -25,3 +25,4 @@ $string['sectionname'] = 'week'; $string['pluginname'] = 'Weekly format'; +$string['section0name'] = 'General'; diff --git a/course/format/weeks/lib.php b/course/format/weeks/lib.php index 2e845171fb1..4d541728ffd 100644 --- a/course/format/weeks/lib.php +++ b/course/format/weeks/lib.php @@ -34,22 +34,7 @@ * @param stdClass $course The course we are loading the section for */ function callback_weeks_load_content(&$navigation, $course, $coursenode) { - return $navigation->load_generic_course_sections($course, $coursenode, get_string('week'), 'week'); -} - -/** - * Used to display the course structure for a course where format=weeks - * - * This is called automatically by {@link load_course()} if the current course - * format = weeks and the navigation was requested via AJAX - * - * @param navigation_node $navigation The course node - * @param array $path An array of keys to the course node - * @param stdClass $course The course we are loading the section for - * @param stdClass $section The section to load - */ -function callback_weeks_load_limited_section(&$navigation, $keys, $course, $section) { - $navigation->limited_load_section_generic($keys, $course, $section, get_string('week'), 'week'); + return $navigation->load_generic_course_sections($course, $coursenode, get_string('week'), 'week', get_string('section0name', 'format_weeks')); } /** diff --git a/lib/navigationlib.php b/lib/navigationlib.php index e4cbf055c94..0ab1a8a47ed 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1042,12 +1042,14 @@ class global_navigation extends navigation_node { * @param string $activeparam The url used to identify the active section * @return array An array of course section nodes */ - public function load_generic_course_sections(stdClass $course, navigation_node $coursenode, $name, $activeparam) { + public function load_generic_course_sections(stdClass $course, navigation_node $coursenode, $name, $activeparam, $section0name=null) { $modinfo = get_fast_modinfo($course); $sections = array_slice(get_all_sections($course->id), 0, $course->numsections+1, true); $viewhiddensections = has_capability('moodle/course:viewhiddensections', $this->page->context); - $strgeneral = get_string('general'); + if ($section0name === null) { + $section0name = get_string('general'); + } foreach ($sections as &$section) { if ($course->id == SITEID) { $this->load_section_activities($coursenode, $section->section, $modinfo); @@ -1056,7 +1058,7 @@ class global_navigation extends navigation_node { continue; } if ($section->section == 0) { - $sectionname = $strgeneral; + $sectionname = $section0name; } else { $sectionname = $name.' '.$section->section; }