Merge branch 'MDL-38979-master' of git://github.com/ds125v/moodle

This commit is contained in:
Dan Poltawski 2013-05-08 13:27:42 +01:00
commit 0249631131

View File

@ -67,7 +67,6 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
* Overriding the custom_menu function ensures the custom menu is
* always shown, even if no menu items are configured in the global
* theme settings page.
* We use the sitename as the first menu item.
*/
public function custom_menu($custommenuitems = '') {
global $CFG;
@ -85,25 +84,24 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
* This renderer is needed to enable the Bootstrap style navigation.
*/
protected function render_custom_menu(custom_menu $menu) {
// If the menu has no children return an empty string.
if (!$menu->has_children()) {
return '';
}
global $CFG;
$addlangmenu = true;
$langs = get_string_manager()->get_list_of_translations();
if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
// Do not show lang menu if language forced.
if (count($langs) < 2
or empty($CFG->langmenu)
or ($this->page->course != SITEID and !empty($this->page->course->lang))) {
$addlangmenu = false;
}
if (count($langs) < 2) {
$addlangmenu = false;
if (!$menu->has_children() && $addlangmenu === false) {
return '';
}
if ($addlangmenu) {
$language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
foreach ($langs as $langtype => $langname) {
$language->add($langname,
new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
$language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}