Merge branch 'wip-MDL-34917_master' of git://github.com/gjb2048/moodle

This commit is contained in:
Damyon Wiese 2013-03-25 11:15:03 +08:00
commit 716f35954e
2 changed files with 37 additions and 4 deletions

View File

@ -562,6 +562,39 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
return $o;
}
/**
* Generate the html for the 'Jump to' menu on a single section page.
*
* @param stdClass $course The course entry from DB
* @param array $sections The course_sections entries from the DB
* @param $displaysection the current displayed section number.
*
* @return string HTML to output.
*/
protected function section_nav_selection($course, $sections, $displaysection) {
global $CFG;
$o = '';
$sectionmenu = array();
$sectionmenu[course_get_url($course)->out(false)] = get_string('maincoursepage');
$modinfo = get_fast_modinfo($course);
$section = 1;
while ($section <= $course->numsections) {
$thissection = $modinfo->get_section_info($section);
$showsection = $thissection->uservisible or !$course->hiddensections;
if (($showsection) && ($section != $displaysection) && ($url = course_get_url($course, $section))) {
$sectionmenu[$url->out(false)] = get_section_name($course, $section);
}
$section++;
}
$select = new url_select($sectionmenu, '', array('' => get_string('jumpto')));
$select->class = 'jumpmenu';
$select->formid = 'sectionmenu';
$o .= $this->output->render($select);
return $o;
}
/**
* Output the html for a single section page .
*
@ -642,16 +675,16 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
echo $this->end_section_list();
// Display section bottom navigation.
$courselink = html_writer::link(course_get_url($course), get_string('returntomaincoursepage'));
$sectionbottomnav = '';
$sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom'));
$sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
$sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
$sectionbottomnav .= html_writer::tag('div', $courselink, array('class' => 'mdl-align'));
$sectionbottomnav .= html_writer::tag('div', $this->section_nav_selection($course, $sections, $displaysection),
array('class' => 'mdl-align'));
$sectionbottomnav .= html_writer::end_tag('div');
echo $sectionbottomnav;
// close single-section div.
// Close single-section div.
echo html_writer::end_tag('div');
}

View File

@ -973,6 +973,7 @@ $string['lookback'] = 'Look back';
$string['mailadmins'] = 'Inform admins';
$string['mailstudents'] = 'Inform students';
$string['mailteachers'] = 'Inform teachers';
$string['maincoursepage'] = 'Main course page';
$string['makeafolder'] = 'Create folder';
$string['makeeditable'] = 'If you make \'{$a}\' editable by the web server process (eg apache) then you could edit this file directly from this page';
$string['makethismyhome'] = 'Make this my default home page';
@ -1419,7 +1420,6 @@ $string['restoreusersprecheck'] = 'Checking user data';
$string['restoreusersprecheckerror'] = 'Some problems were detected when checking user data';
$string['restricted'] = 'Restricted';
$string['returningtosite'] = 'Returning to this web site?';
$string['returntomaincoursepage'] = 'Return to main course page';
$string['returntooriginaluser'] = 'Return to {$a}';
$string['revert'] = 'Revert';
$string['role'] = 'Role';