mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
navigation MDL-22044 Course format can now choose the string that is used for section 0, defaults to general
This commit is contained in:
parent
de631d3c2e
commit
dc07683108
@ -25,3 +25,4 @@
|
|||||||
|
|
||||||
$string['sectionname'] = 'topic';
|
$string['sectionname'] = 'topic';
|
||||||
$string['pluginname'] = 'Topics format';
|
$string['pluginname'] = 'Topics format';
|
||||||
|
$string['section0name'] = 'General';
|
@ -34,21 +34,7 @@
|
|||||||
* @return bool Returns true
|
* @return bool Returns true
|
||||||
*/
|
*/
|
||||||
function callback_topics_load_content(&$navigation, $course, $coursenode) {
|
function callback_topics_load_content(&$navigation, $course, $coursenode) {
|
||||||
return $navigation->load_generic_course_sections($course, $coursenode, get_string('topic'), 'topic');
|
return $navigation->load_generic_course_sections($course, $coursenode, get_string('topic'), 'topic', get_string('section0name', 'format_topics'));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,3 +25,4 @@
|
|||||||
|
|
||||||
$string['sectionname'] = 'week';
|
$string['sectionname'] = 'week';
|
||||||
$string['pluginname'] = 'Weekly format';
|
$string['pluginname'] = 'Weekly format';
|
||||||
|
$string['section0name'] = 'General';
|
||||||
|
@ -34,22 +34,7 @@
|
|||||||
* @param stdClass $course The course we are loading the section for
|
* @param stdClass $course The course we are loading the section for
|
||||||
*/
|
*/
|
||||||
function callback_weeks_load_content(&$navigation, $course, $coursenode) {
|
function callback_weeks_load_content(&$navigation, $course, $coursenode) {
|
||||||
return $navigation->load_generic_course_sections($course, $coursenode, get_string('week'), 'week');
|
return $navigation->load_generic_course_sections($course, $coursenode, get_string('week'), 'week', get_string('section0name', 'format_weeks'));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1042,12 +1042,14 @@ class global_navigation extends navigation_node {
|
|||||||
* @param string $activeparam The url used to identify the active section
|
* @param string $activeparam The url used to identify the active section
|
||||||
* @return array An array of course section nodes
|
* @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);
|
$modinfo = get_fast_modinfo($course);
|
||||||
$sections = array_slice(get_all_sections($course->id), 0, $course->numsections+1, true);
|
$sections = array_slice(get_all_sections($course->id), 0, $course->numsections+1, true);
|
||||||
$viewhiddensections = has_capability('moodle/course:viewhiddensections', $this->page->context);
|
$viewhiddensections = has_capability('moodle/course:viewhiddensections', $this->page->context);
|
||||||
|
|
||||||
$strgeneral = get_string('general');
|
if ($section0name === null) {
|
||||||
|
$section0name = get_string('general');
|
||||||
|
}
|
||||||
foreach ($sections as &$section) {
|
foreach ($sections as &$section) {
|
||||||
if ($course->id == SITEID) {
|
if ($course->id == SITEID) {
|
||||||
$this->load_section_activities($coursenode, $section->section, $modinfo);
|
$this->load_section_activities($coursenode, $section->section, $modinfo);
|
||||||
@ -1056,7 +1058,7 @@ class global_navigation extends navigation_node {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($section->section == 0) {
|
if ($section->section == 0) {
|
||||||
$sectionname = $strgeneral;
|
$sectionname = $section0name;
|
||||||
} else {
|
} else {
|
||||||
$sectionname = $name.' '.$section->section;
|
$sectionname = $name.' '.$section->section;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user