$string['sectionname'] = 'topic';
$string['pluginname'] = 'Topics format';
+$string['section0name'] = 'General';
\ No newline at end of file
* @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'));
}
/**
$string['sectionname'] = 'week';
$string['pluginname'] = 'Weekly format';
+$string['section0name'] = 'General';
* @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'));
}
/**
* @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);
continue;
}
if ($section->section == 0) {
- $sectionname = $strgeneral;
+ $sectionname = $section0name;
} else {
$sectionname = $name.' '.$section->section;
}