From dcf92ede105567f44b91f3281057e7b426975965 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 27 Mar 2012 10:18:56 +0200 Subject: [PATCH] Fixing menu when user is not logged in + cleaning the template.lib.php --- main/css/base.css | 18 ++++++++++++ main/inc/lib/banner.lib.php | 22 +++++++-------- main/inc/lib/template.lib.php | 29 ++++++++++---------- main/template/default/layout/main_header.tpl | 8 ++++-- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/main/css/base.css b/main/css/base.css index 0bf9d9a194..d2b3ba3209 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -3573,3 +3573,21 @@ a.forum_group_link { #online_grid_container .thumbnail .caption { height: 30px; } + +#hide_bar_template { + width: 10px; + display: inline; + overflow: hidden; + height: 100%; + padding-bottom: 90em; + cursor:pointer; + background-color:#eee; + margin-left: 0px !important; + background-image: url("../img/hide0.png"); + background-repeat: no-repeat; + background-position: center center; +} + +#hide_bar_template:hover { + background-color:#aaa; +} \ No newline at end of file diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index 4b89d4a134..257e5124f6 100644 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -111,9 +111,8 @@ function get_tabs() { return $navigation; } -function show_header_1($language_file, $nameTools, $theme) { - global $noPHP_SELF; - $_course = api_get_course_info(); +function return_logo($theme) { + $_course = api_get_course_info(); $html = ''; $logo = api_get_path(SYS_CODE_PATH).'css/'.$theme.'/images/header-logo.png'; @@ -146,21 +145,21 @@ function show_header_1($language_file, $nameTools, $theme) { } } - /* Course title section */ + /* // Course title section if (!empty($_cid) and $_cid != -1 and isset($_course)) { //Put the name of the course in the header $html .= '
'; $html .= '
'; } elseif (isset($nameTools) && $language_file != 'course_home') { //Put the name of the user-tools in the header - if (!isset($_user['user_id'])) { + if (!isset($user_id)) { //echo '
'; } elseif (!$noPHP_SELF) { $html .= '
'.$nameTools.'
'; } else { $html .= '
'.$nameTools.'
'; } - } + }*/ return $html; } @@ -221,7 +220,7 @@ function return_navigation_array() { $navigation = array(); $menu_navigation = array(); - $possible_tabs = get_tabs(); + $possible_tabs = get_tabs(); // Campus Homepage if (api_get_setting('show_tabs', 'campus_homepage') == 'true') { @@ -326,7 +325,7 @@ function return_navigation_array() { } function return_menu() { - $navigation = return_navigation_array(); + $navigation = return_navigation_array(); $navigation = $navigation['navigation']; // Displaying the tabs @@ -407,11 +406,11 @@ function return_menu() { $show_bar = true; } - $menu = ''; + $menu = null; // Logout if ($show_bar) { - if (api_get_user_id()) { + if (api_get_user_id() && !api_is_anonymous()) { $login = ''; if (api_is_anonymous()) { $login = get_lang('Anonymous'); @@ -421,6 +420,7 @@ function return_menu() { $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').''; } @@ -446,7 +446,7 @@ function return_menu() { $menu .= $lis; $menu .= ''; } - } + } return $menu; } diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index ee472909ce..419c0d23bd 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -2,12 +2,11 @@ /* For licensing terms, see /license.txt */ /* * @author Julio Montoya + * @todo better organization of the class, methods and variables * **/ - /* @todo better organization of the class methods and variables */ - -// Load Smarty library + // Load Smarty library require_once api_get_path(LIBRARY_PATH).'smarty/Smarty.class.php'; require_once api_get_path(LIBRARY_PATH).'course_home.lib.php'; require_once api_get_path(LIBRARY_PATH).'banner.lib.php'; @@ -22,7 +21,7 @@ class Template extends Smarty { var $show_header; var $show_footer; var $help; - var $menu_navigation = array(); + //var $menu_navigation = array(); var $show_learnpath = false; // This is a learnpath section or not? var $plugin = null; var $course_id = null; @@ -285,23 +284,24 @@ class Template extends Smarty { $this->assign('css_style', $style_html); $style_print = '@import "'.api_get_path(WEB_CSS_PATH).$this->theme.'/print.css";'."\n"; - $this->assign('css_style_print', $style_print); - $this->assign('style_print', $style_print); - // Header 1 - $header1 = show_header_1($language_file, $nameTools, $this->theme); - $this->assign('header1', $header1); + $this->assign('css_style_print', $style_print); + + // Logo + $logo = return_logo($this->theme); + $this->assign('logo', $logo); } private function set_header_parameters() { $help = $this->help; $nameTools = $this->title; + global $lp_theme_css, $mycoursetheme, $user_theme; - global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $_user, - $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF; + global $httpHeadXtra, $htmlHeadXtra, $_course, $text_dir, + $interbreadcrumb, $charset, $language_file, $noPHP_SELF; - $navigation = return_navigation_array(); - $this->menu_navigation = $navigation['menu_navigation']; + //$navigation = return_navigation_array(); + //$this->menu_navigation = $navigation['menu_navigation']; global $_configuration; @@ -325,6 +325,7 @@ class Template extends Smarty { $title_list[] = api_get_setting('Institution'); $title_list[] = api_get_setting('siteName'); + if (!empty($course_title)) { $title_list[] = $course_title; } @@ -467,7 +468,7 @@ class Template extends Smarty { $this->assign('bug_notification_link', $bug_notification_link); $notification = return_notification_menu(); - $menu = return_menu(); + $menu = return_menu(); $breadcrumb = return_breadcrumb($interbreadcrumb, $language_file, $nameTools); $this->assign('notification_menu', $notification); diff --git a/main/template/default/layout/main_header.tpl b/main/template/default/layout/main_header.tpl index 5c229a55fe..f644e77ec2 100644 --- a/main/template/default/layout/main_header.tpl +++ b/main/template/default/layout/main_header.tpl @@ -29,10 +29,11 @@
-
- {* header1 - logo *} +
- {$header1} + {* logo *} + {$logo} + {* plugin_header *} {if !empty($plugin_header_left)}
@@ -76,6 +77,7 @@
{/if}
+ {* menu *} {if $menu}