From 051ae813773291867bca169e8c2bf333cb29c2ac Mon Sep 17 00:00:00 2001 From: Julian Prud'homme Date: Tue, 24 Apr 2007 14:40:13 +0200 Subject: [PATCH] [svn r12104] Add the user menu in the home page when we are logged in --- index.php | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index b631d543ef..40f8f82deb 100644 --- a/index.php +++ b/index.php @@ -20,7 +20,7 @@ /** * @package dokeos.main * @author Patrick Cool , Ghent University, Refactoring -* @version $Id: index.php 11924 2007-04-08 16:30:56Z pcool $ +* @version $Id: index.php 12104 2007-04-24 12:40:13Z elixir_julian $ * @todo check the different @todos in this page and really do them * @todo check if the news management works as expected */ @@ -300,6 +300,16 @@ function category_has_open_courses($category) return false; } +function display_create_course_link() +{ + echo "
  • ".get_lang("CourseCreate")."
  • "; +} + +function display_edit_course_list_links() +{ + echo "
  • ".get_lang("CourseManagement")."
  • "; +} + /** * Displays the right-hand menu for anonymous users: * login form, useful links, help section @@ -368,6 +378,40 @@ function display_anonymous_right_menu() api_plugin('campushomepage_menu'); echo ''; } + + /** + * User section + */ + if(isset($_SESSION['_user']['user_id']) && $_SESSION['_user']['user_id']!=0){ + echo "
    "; + echo "".get_lang("MenuUser").""; + echo "
      "; + + $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'].'&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'].'&courseCode='.$_course['official_code'] : '' ); + $navigation['myagenda']['title'] = get_lang('MyAgenda'); + + foreach($navigation as $section => $navigation_info) + { + $current = ($section == $GLOBALS['this_section'] ? ' id="current"' : ''); + echo ''; + echo ''.$navigation_info['title'].''; + echo ''; + echo "\n"; + } + + echo "
    "; + echo "
    "; + } /**** use this comment to hide notice file section from right menu ****