|
@@ -1,29 +1,6 @@
|
|
|
<?php
|
|
|
// $Id: tool_navigation_menu.inc.php 22072 2009-07-14 15:14:42Z jhp1411 $
|
|
|
-/*
|
|
|
-==============================================================================
|
|
|
- Dokeos - elearning and course management software
|
|
|
-
|
|
|
- Copyright (c) 2005 Dokeos S.A.
|
|
|
- Copyright (c) 2004-2005 Sandra Mathijs, Hogeschool Gent
|
|
|
- Copyright (c) 2005 Roan Embrechts, Vrije Universiteit Brussel
|
|
|
- Copyright (c) 2005 Wolfgang Schneider
|
|
|
- Copyright (c) Bart Mollet, Hogeschool Gent
|
|
|
-
|
|
|
- For a full list of contributors, see "credits.txt".
|
|
|
- The full license can be read in "license.txt".
|
|
|
-
|
|
|
- This program is free software; you can redistribute it and/or
|
|
|
- modify it under the terms of the GNU General Public License
|
|
|
- as published by the Free Software Foundation; either version 2
|
|
|
- of the License, or (at your option) any later version.
|
|
|
-
|
|
|
- See the GNU General Public License for more details.
|
|
|
-
|
|
|
- Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
|
|
|
- Mail: info@dokeos.com
|
|
|
-==============================================================================
|
|
|
-*/
|
|
|
+/* For licensing terms, see /chamilo_license.txt */
|
|
|
/**
|
|
|
==============================================================================
|
|
|
* Navigation menu display code
|
|
@@ -64,8 +41,8 @@ function get_navigation_items($include_admin_tools = false)
|
|
|
*/
|
|
|
|
|
|
$navigation_items['home']['image'] = 'home.gif';
|
|
|
- $navigation_items['home']['link'] = api_get_path(REL_COURSE_PATH).$_SESSION['_course']['path'].'/index.php';
|
|
|
- $navigation_items['home']['name'] = get_lang("CourseHomepageLink");
|
|
|
+ $navigation_items['home']['link'] = api_get_path(REL_COURSE_PATH).Security::remove_XSS($_SESSION['_course']['path']).'/index.php';
|
|
|
+ $navigation_items['home']['name'] = get_lang('CourseHomepageLink');
|
|
|
|
|
|
/*
|
|
|
--------------------------------------------------------------
|
|
@@ -101,14 +78,12 @@ function get_navigation_items($include_admin_tools = false)
|
|
|
--------------------------------------------------------------
|
|
|
*/
|
|
|
|
|
|
- if ($include_admin_tools)
|
|
|
- {
|
|
|
-
|
|
|
- $course_settings_sql = " SELECT name,image FROM $course_tools_table
|
|
|
- WHERE link='course_info/infocours.php'";
|
|
|
+ if ($include_admin_tools) {
|
|
|
+ $course_settings_sql = "SELECT name,image FROM $course_tools_table
|
|
|
+ WHERE link='course_info/infocours.php'";
|
|
|
$sql_result = Database::query($course_settings_sql);
|
|
|
$course_setting_info = Database::fetch_array($sql_result);
|
|
|
- $course_setting_visual_name = get_lang(ucfirst($course_setting_info['name']));
|
|
|
+ $course_setting_visual_name = get_lang(api_ucfirst($course_setting_info['name']));
|
|
|
if (api_get_session_id()==0) {
|
|
|
// course settings item
|
|
|
$navigation_items['course_settings']['image'] = $course_setting_info['image'];
|
|
@@ -117,15 +92,11 @@ function get_navigation_items($include_admin_tools = false)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- foreach($navigation_items as $key => $navigation_item)
|
|
|
- {
|
|
|
- if (strstr($navigation_item['link'], '?'))
|
|
|
- {
|
|
|
+ foreach($navigation_items as $key => $navigation_item) {
|
|
|
+ if (strstr($navigation_item['link'], '?')) {
|
|
|
//link already contains a parameter, add course id parameter with &
|
|
|
$parameter_separator = '&';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ } else {
|
|
|
//link doesn't contain a parameter yet, add course id parameter with ?
|
|
|
$parameter_separator = '?';
|
|
|
}
|
|
@@ -141,14 +112,11 @@ function show_navigation_menu()
|
|
|
{
|
|
|
$navigation_items = get_navigation_items(true);
|
|
|
$course_id = api_get_course_id();
|
|
|
- if(api_get_setting('show_navigation_menu') == 'icons')
|
|
|
- {
|
|
|
+ if(api_get_setting('show_navigation_menu') == 'icons') {
|
|
|
echo '<div style="float:right;width: 40px;position:absolute;right:10px;top:10px;">';
|
|
|
show_navigation_tool_shortcuts($orientation = SHORTCUTS_VERTICAL);
|
|
|
echo '</div>';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ } else {
|
|
|
echo '<div id="toolnav"> <!-- start of #toolnav -->';
|
|
|
?>
|
|
|
<script type="text/javascript">
|
|
@@ -208,19 +176,19 @@ function show_navigation_menu()
|
|
|
</script>
|
|
|
<?php
|
|
|
echo '<div id="toolnavbox">';
|
|
|
- echo '<div id="toolnavlist"><dl>';
|
|
|
- foreach ($navigation_items as $key => $navigation_item)
|
|
|
- {
|
|
|
+ echo '<div id="toolnavlist"><dl>';
|
|
|
+ foreach ($navigation_items as $key => $navigation_item) {
|
|
|
+ //students can't see the course settings option
|
|
|
+ if (!api_is_allowed_to_edit() && $key == 'course_settings') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
echo '<dd>';
|
|
|
$url_item = parse_url($navigation_item['link']);
|
|
|
$url_current = parse_url($_SERVER['REQUEST_URI']);
|
|
|
|
|
|
- if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window',$course_id)==true)
|
|
|
- {
|
|
|
+ if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window',$course_id)==true) {
|
|
|
echo '<a href="javascript: void(0);" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ } else {
|
|
|
echo '<a href="'.$navigation_item['link'].'" target="_self" ';
|
|
|
}
|
|
|
|
|
@@ -249,8 +217,7 @@ function show_navigation_menu()
|
|
|
?>
|
|
|
<script type="text/javascript">
|
|
|
/* <![CDATA[ */
|
|
|
- if(readCookie('dokeos_menu_state') == 0)
|
|
|
- {
|
|
|
+ if(readCookie('dokeos_menu_state') == 0)
|
|
|
swap_menu();
|
|
|
}
|
|
|
/* ]]> */
|
|
@@ -265,32 +232,25 @@ function show_navigation_menu()
|
|
|
function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL)
|
|
|
{
|
|
|
$navigation_items = get_navigation_items(false);
|
|
|
- foreach ($navigation_items as $key => $navigation_item)
|
|
|
- {
|
|
|
-
|
|
|
- if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true)
|
|
|
- {
|
|
|
+ foreach ($navigation_items as $key => $navigation_item) {
|
|
|
+ if (strpos($navigation_item['link'],'chat')!==false && api_get_course_setting('allow_open_chat_window')==true) {
|
|
|
/*
|
|
|
echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
|
|
|
*/
|
|
|
echo '<a href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+ } else {
|
|
|
echo '<a href="'.$navigation_item['link'].'"';
|
|
|
}
|
|
|
|
|
|
- if (strpos(api_get_self(), $navigation_item['link']) !== false)
|
|
|
- {
|
|
|
+ if (strpos(api_get_self(), $navigation_item['link']) !== false) {
|
|
|
echo ' id="here"';
|
|
|
}
|
|
|
echo ' target="_self" title="'.$navigation_item['name'].'">';
|
|
|
echo '<img src="'.api_get_path(WEB_IMG_PATH).$navigation_item['image'].'" alt="'.$navigation_item['name'].'"/>';
|
|
|
echo '</a>';
|
|
|
- if($orientation == SHORTCUTS_VERTICAL)
|
|
|
- {
|
|
|
+ if($orientation == SHORTCUTS_VERTICAL){
|
|
|
echo '<br />';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-?>
|
|
|
+?>
|