[svn r12875] show or hide tabs

skala
Patrick Cool 19 years ago
parent 47c9fde601
commit b791fcf540
  1. 63
      index.php
  2. 193
      main/inc/banner.inc.php
  3. 1
      main/inc/lib/display.lib.php
  4. 43
      user_portal.php

@ -20,7 +20,7 @@
/**
* @package dokeos.main
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Refactoring
* @version $Id: index.php 12813 2007-07-31 08:16:06Z elixir_julian $
* @version $Id: index.php 12875 2007-08-06 12:26:55Z pcool $
* @todo check the different @todos in this page and really do them
* @todo check if the news management works as expected
*/
@ -184,13 +184,16 @@ if (!empty ($_GET['include']) && !strstr($_GET['include'], '/') && !strstr($_GET
else
{
if(!empty($_SESSION['user_language_choice'])){
if(!empty($_SESSION['user_language_choice']))
{
$user_selected_language=$_SESSION['user_language_choice'];
}
elseif(!empty($_SESSION['_user']['language'])){
elseif(!empty($_SESSION['_user']['language']))
{
$user_selected_language=$_SESSION['_user']['language'];
}
else{
else
{
$user_selected_language=get_setting('platformLanguage');
}
@ -203,10 +206,12 @@ else
}
else
{
if(file_exists('home/home_top_'.$user_selected_language.'.html')){
if(file_exists('home/home_top_'.$user_selected_language.'.html'))
{
include('home/home_top_'.$user_selected_language.'.html');
}
else{
else
{
include('home/home_top.html');
}
}
@ -325,7 +330,7 @@ function display_edit_course_list_links()
*/
function display_anonymous_right_menu()
{
global $loginFailed, $_plugins, $_user;
global $loginFailed, $_plugins, $_user, $menu_navigation;
$platformLanguage = api_get_setting('platformLanguage');
@ -384,37 +389,39 @@ function display_anonymous_right_menu()
api_plugin('campushomepage_menu');
echo '</div>';
}
/**
* User section
*/
if(isset($_SESSION['_user']['user_id']) && $_SESSION['_user']['user_id']!=0){
if(isset($_SESSION['_user']['user_id']) && $_SESSION['_user']['user_id']!=0)
{
// tabs that are deactivated are added here
if (!empty($menu_navigation))
{
echo "<div class=\"menusection\">";
echo "<span class=\"menusectioncaption\">".get_lang("MainNavigation")."</span>";
echo "<ul class=\"menulist\">";
foreach($menu_navigation as $section => $navigation_info)
{
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
echo '</li>';
echo "\n";
}
echo "</ul>";
echo '</div>';
}
echo "<div class=\"menusection\">";
echo "<span class=\"menusectioncaption\">".get_lang("MenuUser")."</span>";
echo "<ul class=\"menulist\">";
$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION["studentview"] != "studentenview");
if ($display_add_course_link)
display_create_course_link();
display_edit_course_list_links();
$navigation=array();
// Link to my profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
// Link to my agenda
$navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/myagenda.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myagenda']['title'] = get_lang('MyAgenda');
foreach($navigation as $section => $navigation_info)
{
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
echo '</li>';
echo "\n";
}
echo "</ul>";
echo "</div>";
}

@ -190,72 +190,72 @@ if ($_user['user_id'])
}
echo "<ul>\n";
$navigation = array();
// Link to campus homepage
$navigation[SECTION_CAMPUS]['url'] = api_get_path(WEB_PATH).'index.php';
$navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
$possible_tabs = get_tabs();
// Campus Homepage
if (api_get_setting('show_tabs', 'campus_homepage') == 'true')
{
$navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
}
else
{
$menu_navigation[SECTION_CAMPUS] = $possible_tabs[SECTION_CAMPUS];
}
if ($_user['user_id'])
{
if(api_get_setting('use_session_mode')=='true')
// My Courses
if (api_get_setting('show_tabs', 'my_courses') == 'true')
{
if(api_is_allowed_to_create_course())
{
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
else
{
// Link to my courses for students
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
// Link to active sessions
//$navigation[SECTION_ACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php';
//$navigation[SECTION_ACTIVESESSIONS]['title'] = get_lang('myActiveSessions');
// Link to inactive sessions
//$navigation[SECTION_INACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php?inactives';
//$navigation[SECTION_INACTIVESESSIONS]['title'] = get_lang('myInActiveSessions');
$navigation['mycourses'] = $possible_tabs['mycourses'];
}
else
{
// Link to my courses
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
$menu_navigation['mycourses'] = $possible_tabs['mycourses'];
}
//NOW IN THE RIGHT MENU IN "MY COURSES"
/*
// Link to my profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
// Link to my agenda
$navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/myagenda.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myagenda']['title'] = get_lang('MyAgenda');*/
//if(api_get_setting('use_session_mode')=='true'){
if(api_is_allowed_to_create_course())
{
// Link to my space
$navigation['session_my_space']['url'] = api_get_path(WEB_PATH).'main/mySpace/';
$navigation['session_my_space']['title'] = get_lang('MySpace');
}
if(!api_is_allowed_to_create_course())
{
// Link to my progress
$navigation['session_my_progress']['url'] = api_get_path(WEB_PATH).'main/auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
}
//}
if (api_is_platform_admin())
// My Profile
if (api_get_setting('show_tabs', 'my_profile') == 'true')
{
// Link to platform admin
$navigation['platform_admin']['url'] = $rootAdminWeb;
$navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
$navigation['myprofile'] = $possible_tabs['myprofile'];
}
else
{
$menu_navigation['myprofile'] = $possible_tabs['myprofile'];
}
// My Agenda
if (api_get_setting('show_tabs', 'my_agenda') == 'true')
{
$navigation['myagenda'] = $possible_tabs['myagenda'];
}
else
{
$menu_navigation['myagenda'] = $possible_tabs['myagenda'];
}
// Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true')
{
$navigation['session_my_space'] = $possible_tabs['session_my_space'];
}
else
{
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
}
if (api_get_setting('show_tabs', 'platform_administration') == 'true')
{
$navigation['platform_admin'] = $possible_tabs['platform_admin'];
}
else
{
$menu_navigation['platform_admin'] = $possible_tabs['platform_admin'];
}
}
// Displaying the tabs
foreach($navigation as $section => $navigation_info)
{
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
@ -414,5 +414,86 @@ if(api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_n
}
}
/**
* Determines the possible tabs (=sections) that are available.
* This function is used when creating the tabs in the third header line and all the sections
* that do not appear there (as determined by the platform admin on the Dokeos configuration settings page)
* will appear in the right hand menu that appears on several other pages
*
* @return array containing all the possible tabs
*
* @version Dokeos 1.8.4
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/
function get_tabs()
{
global $_course, $rootAdminWeb;
// Campus Homepage
$navigation[SECTION_CAMPUS]['url'] = api_get_path(WEB_PATH).'index.php';
$navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
// My Courses
if(api_get_setting('use_session_mode')=='true')
{
if(api_is_allowed_to_create_course())
{
// Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
else
{
// Link to my courses for students
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
// Link to active sessions
//$navigation[SECTION_ACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php';
//$navigation[SECTION_ACTIVESESSIONS]['title'] = get_lang('myActiveSessions');
// Link to inactive sessions
//$navigation[SECTION_INACTIVESESSIONS]['url'] = api_get_path(WEB_PATH).'user_portal.php?inactives';
//$navigation[SECTION_INACTIVESESSIONS]['title'] = get_lang('myInActiveSessions');
}
else
{
// Link to my courses
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
$navigation['mycourses']['title'] = get_lang('MyCourses');
}
// My Profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
// Link to my agenda
$navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/myagenda.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myagenda']['title'] = get_lang('MyAgenda');
// Reporting
if(api_is_allowed_to_create_course())
{
// Link to my space
$navigation['session_my_space']['url'] = api_get_path(WEB_PATH).'main/mySpace/';
$navigation['session_my_space']['title'] = get_lang('MySpace');
}
else
{
// Link to my progress
$navigation['session_my_progress']['url'] = api_get_path(WEB_PATH).'main/auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress');
}
// Platform administration
if (api_is_platform_admin())
{
$navigation['platform_admin']['url'] = $rootAdminWeb;
$navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
}
return $navigation;
}
?>
<!-- Begin Of script Output -->

@ -478,6 +478,7 @@ class Display {
$nameTools = $tool_name;
global $_plugins;
global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $clarolineRepositoryWeb, $text_dir, $plugins, $_user, $rootAdminWeb, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
global $menu_navigation;
include (api_get_path(INCLUDE_PATH)."header.inc.php");
}
/**

@ -1238,6 +1238,24 @@ api_session_register('status');
*/
echo "<div class=\"menu\">";
// tabs that are deactivated are added here
if (!empty($menu_navigation))
{
echo "<div class=\"menusection\">";
echo "<span class=\"menusectioncaption\">".get_lang("MainNavigation")."</span>";
echo "<ul class=\"menulist\">";
foreach($menu_navigation as $section => $navigation_info)
{
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
echo '</li>';
echo "\n";
}
echo "</ul>";
echo '</div>';
}
// api_display_language_form(); // moved to the profile page.
echo "<div class=\"menusection\">";
echo "<span class=\"menusectioncaption\">".get_lang("MenuUser")."</span>";
@ -1249,33 +1267,10 @@ if ($display_add_course_link)
display_edit_course_list_links();
display_digest($toolsList, $digest, $orderKey, $courses);
$navigation=array();
// Link to my profile
$navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myprofile']['title'] = get_lang('ModifyProfile');
// Link to my agenda
$navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/myagenda.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
$navigation['myagenda']['title'] = get_lang('MyAgenda');
foreach($navigation as $section => $navigation_info)
{
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
echo '</li>';
echo "\n";
}
echo "</ul>";
echo "</div>";
/*
-----------------------------------------------------------------------------
Plugins for banner section
-----------------------------------------------------------------------------
*/
// plugins for the my courses menu
if (is_array($_plugins['mycourses_menu'])){
echo '<div class="note" style="background: none">';

Loading…
Cancel
Save