diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index 31cb25a4fe..b0c0738d50 100644 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -371,8 +371,7 @@ function return_menu() { $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); $lis = ''; - $show_bar = false; - + if (!empty($open)) { if (strpos($open, 'show_menu') === false) { if (api_is_anonymous()) { @@ -380,8 +379,7 @@ function return_menu() { } } else { $lis .= Display::tag('li', $open); - } - $show_bar = true; + } } if (count($navigation) > 0 || !empty($lis)) { @@ -396,56 +394,13 @@ function return_menu() { $pre_lis .= ''.$navigation_info['title'].''; } } - $lis = $pre_lis.$lis; - $show_bar = true; + $lis = $pre_lis.$lis; } - $menu = null; - - // Logout - if ($show_bar) { - if (api_get_user_id() && !api_is_anonymous()) { - $login = ''; - if (api_is_anonymous()) { - $login = get_lang('Anonymous'); - } else { - $user_info = api_get_user_info(api_get_user_id()); - } - $logout_link = api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id(); - - $message_link = null; - - if (api_get_setting('allow_message_tool') == 'true') { - $message_link = ''.get_lang('Inbox').''; - } - - if (api_get_setting('allow_social_tool')=='true') { - $profile_url = ''.get_lang('Profile').''; - } else { - $profile_url = ''.get_lang('Profile').''; - } - //start user section line with name, my course, my profile, scorm info, etc - $menu .= ''; - } - - if (!empty($lis)) { - $menu .= ''; - } - } + $menu = null; + if (!empty($lis)) { + $menu .= $lis; + } return $menu; } diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index be12080641..4c8e812451 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -589,18 +589,42 @@ class Template { $notification = return_notification_menu(); $this->assign('notification_menu', $notification); + + //Preparing values for the menu + + //Logout link + $this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&&uid='.api_get_user_id()); + + //Profile link + if (api_get_setting('allow_social_tool')=='true') { + $profile_link = ''.get_lang('Profile').''; + } else { + $profile_link = ''.get_lang('Profile').''; + } + $this->assign('profile_link', $profile_link); + + //Message link + $message_link = null; + if (api_get_setting('allow_message_tool') == 'true') { + $message_link = ''.get_lang('Inbox').''; + } + $this->assign('message_link', $message_link); + + //Menu $menu = return_menu(); $this->assign('menu', $menu); + //Breadcrumb $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('breadcrumb', $breadcrumb); + //Extra content $extra_header = null; if (!api_is_platform_admin()) { $extra_header = trim(api_get_setting('header_extra_content')); } $this->assign('header_extra_content', $extra_header); - + if ($this->show_header == 1) { header('Content-Type: text/html; charset=' . api_get_system_encoding()); header('X-Powered-By: ' . $_configuration['software_name'] . ' ' . substr($_configuration['system_version'], 0, 1)); diff --git a/main/template/default/layout/main_header.tpl b/main/template/default/layout/main_header.tpl index 499f0738e7..85d668d43a 100644 --- a/main/template/default/layout/main_header.tpl +++ b/main/template/default/layout/main_header.tpl @@ -1,5 +1,5 @@ - + @@ -7,13 +7,13 @@ {% include "default/layout/head.tpl" %} - + {% if show_header == true %}
@@ -22,6 +22,7 @@ {{ help_content }} {{ bug_notification_link }} + {# topbar #} {% include "default/layout/topbar.tpl" %} @@ -74,11 +75,7 @@ {% endif %} {# menu #} - {% if menu is not null %} - - {% endif %} + {% include "default/layout/menu.tpl" %} {# breadcrumb #} {{ breadcrumb }} diff --git a/main/template/default/layout/menu.tpl b/main/template/default/layout/menu.tpl new file mode 100644 index 0000000000..516aa7abb7 --- /dev/null +++ b/main/template/default/layout/menu.tpl @@ -0,0 +1,31 @@ +{% if menu is not null %} + +{% endif %} \ No newline at end of file