Fixing bug when hiding tabs see #4269

skala
Julio Montoya 13 years ago
parent 63c30aeb57
commit 59e8a87584
  1. 12
      main/inc/lib/banner.lib.php
  2. 12
      main/inc/lib/template.lib.php
  3. 16
      main/inc/lib/userportal.lib.php

@ -250,11 +250,11 @@ function show_header_2() {
echo '</div>';
}
function show_header_3() {
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') {
@ -355,6 +355,14 @@ function show_header_3() {
}
}
}
return array('menu_navigation' => $menu_navigation, 'navigation' => $navigation, 'possible_tabs' => $possible_tabs);
}
function show_header_3() {
$navigation = return_navigation_array();
//$menu_navigation = $navigation['menu_navigation'];
$navigation = $navigation['navigation'];
//$possible_tabs = $navigation['possible_tabs'];
// Displaying the tabs

@ -3,6 +3,7 @@
// Load Smarty library
require_once api_get_path(LIBRARY_PATH).'smarty/Smarty.class.php';
require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
class Template extends Smarty {
@ -10,6 +11,7 @@ class Template extends Smarty {
var $show_header;
var $show_footer;
var $help;
var $navigation = null;
function __construct($title = '', $show_header = true, $show_footer = true) {
$this->title = $title;
@ -194,7 +196,10 @@ class Template extends Smarty {
global $_plugins, $lp_theme_css, $mycoursetheme, $user_theme, $platform_theme;
global $httpHeadXtra, $htmlHeadXtra, $_course, $_user, $text_dir, $plugins, $_user,
$_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
global $menu_navigation;
$navigation = return_navigation_array();
$this->menu_navigation = $navigation['menu_navigation'];
global $_configuration, $show_learn_path;
$this->assign('system_charset', api_get_system_encoding());
@ -340,10 +345,7 @@ class Template extends Smarty {
}
}
$this->assign('favico', $favico);
//old banner.inc.php
require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
global $my_session_id;
$session_id = api_get_session_id();
$session_name = api_get_session_name($my_session_id);

@ -214,7 +214,7 @@ class IndexManager {
* @todo does $_plugins need to be global?
*/
function display_anonymous_right_menu() {
global $loginFailed, $_plugins, $_user, $menu_navigation;
global $loginFailed, $_plugins, $_user;
$platformLanguage = api_get_setting('platformLanguage');
$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
@ -347,12 +347,12 @@ class IndexManager {
if (isset($_SESSION['_user']['user_id']) && $_SESSION['_user']['user_id'] != 0) {
// Deleting the myprofile link.
if (api_get_setting('allow_social_tool') == 'true') {
unset($menu_navigation['myprofile']);
unset($this->tpl->menu_navigation['myprofile']);
}
if (!empty($menu_navigation)) {
if (!empty($this->tpl->menu_navigation)) {
$content = '<ul class="menulist">';
foreach ($menu_navigation as $section => $navigation_info) {
foreach ($this->tpl->menu_navigation as $section => $navigation_info) {
$current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
$content .='<li'.$current.'><a href="'.$navigation_info['url'].'" target="_self">'.$navigation_info['title'].'</a></li>';
}
@ -889,20 +889,20 @@ class IndexManager {
return $html;
}
function return_navigation_course_links($menu_navigation) {
function return_navigation_course_links() {
$html = '';
// Deleting the myprofile link.
if (api_get_setting('allow_social_tool') == 'true') {
unset($menu_navigation['myprofile']);
unset($this->tpl->menu_navigation['myprofile']);
}
// Main navigation section.
// Tabs that are deactivated are added here.
if (!empty($menu_navigation)) {
if (!empty($this->tpl->menu_navigation)) {
$main_navigation_content .= '<ul class="menulist">';
foreach ($menu_navigation as $section => $navigation_info) {
foreach ($this->tpl->menu_navigation as $section => $navigation_info) {
$current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
$main_navigation_content .= '<li'.$current.'>';
$main_navigation_content .= '<a href="'.$navigation_info['url'].'" target="_self">'.$navigation_info['title'].'</a>';

Loading…
Cancel
Save