[svn r16925] Added general option to prevent course creation

skala
Isaac Flores 17 years ago
parent a341641d9b
commit 1506af4622
  1. 170
      main/inc/banner.inc.php

@ -1,5 +1,4 @@
<?php //$id: $ <?php
/* For licensing terms, see /dokeos_license.txt */
/** /**
============================================================================== ==============================================================================
* This script contains the actual html code to display the "header" * This script contains the actual html code to display the "header"
@ -9,21 +8,15 @@
============================================================================== ==============================================================================
*/ */
?> ?>
<div id="header"> <div id="header"> <!-- header section start -->
<div id="header1"> <div id="header1"> <!-- top of banner with institution name/hompage link -->
<div id="top_corner"></div> <div id="top_corner"></div>
<div id="institution"> <div id="institution">
<a href="<?php echo api_get_path(WEB_PATH);?>index.php" target="_top"><?php echo api_get_setting('siteName') ?></a> <a href="<?php echo api_get_path(WEB_PATH);?>index.php" target="_top"><?php echo api_get_setting('siteName') ?></a>
<?php -
$iurl = api_get_setting('InstitutionUrl'); <a href="<?php echo api_get_setting('InstitutionUrl') ?>" target="_top"><?php echo api_get_setting('Institution') ?></a>
$iname = api_get_setting('Institution'); </div>
if (!empty($iname))
{
echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
}
?>
</div>
<?php <?php
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -32,14 +25,16 @@
*/ */
if (!empty($_cid) and $_cid != -1 and isset($_course)) { if (!empty($_cid) and $_cid != -1 and isset($_course)) {
//Put the name of the course in the header //Put the name of the course in the header
echo ' ?>
<div id="my_courses"> <div id="my_courses"><a href="<?php echo api_get_path(WEB_COURSE_PATH).$_course['path']; ?>/index.php" target="_top">
<a href="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/index.php" target="_top">'.$_course['name'].' '; <?php
echo $_course['name']." ";
if (api_get_setting("display_coursecode_in_courselist") == "true") { if (api_get_setting("display_coursecode_in_courselist") == "true") {
echo $_course['official_code']; echo $_course['official_code'];
} }
if(api_get_setting("use_session_mode") == "true" && isset($_SESSION['session_name'])) { if(api_get_setting("use_session_mode") == "true" && isset($_SESSION['session_name'])) {
echo ' ('.$_SESSION['session_name'].')'; echo ' ('.$_SESSION['session_name'].')';
} }
if (api_get_setting("display_coursecode_in_courselist") == "true" AND api_get_setting("display_teacher_in_courselist") == "true") { if (api_get_setting("display_coursecode_in_courselist") == "true" AND api_get_setting("display_teacher_in_courselist") == "true") {
@ -48,9 +43,7 @@ if (!empty($_cid) and $_cid != -1 and isset($_course)) {
if (api_get_setting("display_teacher_in_courselist") == "true") { if (api_get_setting("display_teacher_in_courselist") == "true") {
echo stripslashes($_course['titular']); echo stripslashes($_course['titular']);
} }
echo ' </a>'; echo "</a></div>";
echo '
</div>';
} elseif (isset ($nameTools) && $language_file != 'course_home') { } elseif (isset ($nameTools) && $language_file != 'course_home') {
//Put the name of the user-tools in the header //Put the name of the user-tools in the header
if (!isset ($_user['user_id'])) { if (!isset ($_user['user_id'])) {
@ -62,7 +55,7 @@ if (!empty($_cid) and $_cid != -1 and isset($_course)) {
} }
} }
//not to let the header disappear if there's nothing on the left //not to let the header disappear if there's nothing on the left
echo ' <div class="clear">&nbsp;</div>'; echo '<div class="clear">&nbsp;</div>';
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -86,23 +79,18 @@ if (isset($_course['extLink']) && $_course['extLink']['name'] != "") {
echo "</a>"; echo "</a>";
} else { } else {
echo $_course['extLink']['name']; echo $_course['extLink']['name'];
} }
} }
?> echo "</div> <!-- end of #header1 -->";
</div> echo '<div id="header2">';
echo '<div id="Header2Right">';
echo '<ul>';
<div id="header2">
<div id="Header2Right">
<ul>
<?php
if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id']) OR (api_get_setting('showonline','course') == "true" AND $_user['user_id'] AND $_cid)) { if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id']) OR (api_get_setting('showonline','course') == "true" AND $_user['user_id'] AND $_cid)) {
if (api_get_setting("use_session_mode") == "true" && isset($_user['user_id']) && api_is_coach()) { if (api_get_setting("use_session_mode") == "true" && isset($_user['user_id']) && api_is_coach()) {
echo ' <li><a href="'.api_get_path(WEB_PATH).'whoisonlinesession.php?id_coach='.$_user['user_id'].'&amp;referer='.urlencode($_SERVER['REQUEST_URI']).'" target="_top">'.get_lang('UsersConnectedToMySessions').'</a></li>'; echo "<li><a href='".api_get_path(WEB_PATH)."whoisonlinesession.php?id_coach=".$_user['user_id']."&referer=".urlencode($_SERVER['REQUEST_URI'])."' target='_top'>".get_lang('UsersConnectedToMySessions')."</a></li>";
} }
$statistics_database = Database :: get_statistic_database(); $statistics_database = Database :: get_statistic_database();
$number = count(WhoIsOnline(api_get_user_id(), $statistics_database, api_get_setting('time_limit_whosonline'))); $number = count(WhoIsOnline(api_get_user_id(), $statistics_database, api_get_setting('time_limit_whosonline')));
if(!empty($_course['id'])) { if(!empty($_course['id'])) {
@ -111,24 +99,22 @@ if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR
} else { } else {
$number_online_in_course = 0; $number_online_in_course = 0;
} }
echo ' <li>'.get_lang('UsersOnline').': '; echo "<li>".get_lang('UsersOnline').": ";
// Display the who's online of the platform // Display the who's online of the platform
if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id'])) { if ((api_get_setting('showonline','world') == "true" AND !$_user['user_id']) OR (api_get_setting('showonline','users') == "true" AND $_user['user_id'])) {
echo '<a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_top">'.$number.'</a>'; echo "<a href='".api_get_path(WEB_PATH)."whoisonline.php' target='_top'>".$number."</a>";
} }
// Display the who's online for the course // Display the who's online for the course
if (is_array($_course) AND api_get_setting('showonline','course') == "true" AND isset($_course['sysCode'])) { if (is_array($_course) AND api_get_setting('showonline','course') == "true" AND isset($_course['sysCode'])) {
echo "(<a href='".api_get_path(WEB_PATH)."whoisonline.php?cidReq=".$_course['sysCode']."' target='_top'>$number_online_in_course ".get_lang('InThisCourse')."</a>)"; echo "(<a href='".api_get_path(WEB_PATH)."whoisonline.php?cidReq=".$_course['sysCode']."' target='_top'>$number_online_in_course ".get_lang('InThisCourse')."</a>)";
} }
echo '</li>'; echo '</li>';
} }
if ($_user['user_id'] && isset($_cid)) { if ($_user['user_id'] && isset($_cid)) {
if ((api_is_course_admin() || api_is_platform_admin()) && api_get_setting('student_view_enabled') == 'true') { if (api_is_course_admin() && api_get_setting('student_view_enabled') == 'true') {
echo '<li>| '; echo '<li>| ';
api_display_tool_view_option(); api_display_tool_view_option();
echo '</li>'; echo '</li>';
@ -148,10 +134,15 @@ if ( api_is_allowed_to_edit() ) {
?> ?>
</ul> </ul>
</div> </div>
<div class="clear">&nbsp;</div> <!-- link to campus home (not logged in)
</div> <a href="<?php echo api_get_path(WEB_PATH); ?>index.php" target="_top"><?php echo api_get_setting('siteName'); ?></a>
-->
<div id="header3"> <?php
//not to let the empty header disappear and ensure help pic is inside the header
echo "<div class=\"clear\">&nbsp;</div>";
?>
</div> <!-- End of header 2-->
<div id="header3">
<?php <?php
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@ -160,7 +151,7 @@ if ( api_is_allowed_to_edit() ) {
*/ */
if ($_user['user_id']) { if ($_user['user_id']) {
$login = ''; $login = '';
if(api_is_anonymous()) { if (api_is_anonymous()) {
$login = '('.get_lang('Anonymous').')'; $login = '('.get_lang('Anonymous').')';
} else { } else {
$uinfo = api_get_user_info(api_get_user_id()); $uinfo = api_get_user_info(api_get_user_id());
@ -169,14 +160,20 @@ if ($_user['user_id']) {
?> ?>
<!-- start user section line with name, my course, my profile, scorm info, etc --> <!-- start user section line with name, my course, my profile, scorm info, etc -->
<form method="get" action="<?php echo api_get_path(WEB_PATH); ?>index.php" class="banner_links" target="_top">
<input type="hidden" name="logout" value="true"/>
<input type="hidden" name="uid" value="<?php echo $_user['user_id']; ?>"/>
<ul id="logout"> <ul id="logout">
<li><a href="<?php echo api_get_path(WEB_PATH); ?>index.php?action=logout"><span><?php echo get_lang('Logout').' '.$login; ?></span></a></li> <li>
<input type="submit" name="submit" value="<?php echo get_lang("Logout").' '.$login; ?>"
onmouseover="this.style.textDecoration='underline'" onmouseout="this.style.textDecoration='none'"
class="logout" style=" height:20px;" />
</li>
</ul> </ul>
</form>
<?php <?php
} }
?> echo "<ul>\n";
<ul>
<?php
$navigation = array(); $navigation = array();
$possible_tabs = get_tabs(); $possible_tabs = get_tabs();
@ -192,7 +189,7 @@ if ($_user['user_id'] && !api_is_anonymous()) {
// My Courses // My Courses
if (api_get_setting('show_tabs', 'my_courses') == 'true') { if (api_get_setting('show_tabs', 'my_courses') == 'true') {
$navigation['mycourses'] = $possible_tabs['mycourses']; $navigation['mycourses'] = $possible_tabs['mycourses'];
} else{ } else {
$menu_navigation['mycourses'] = $possible_tabs['mycourses']; $menu_navigation['mycourses'] = $possible_tabs['mycourses'];
} }
@ -214,20 +211,20 @@ if ($_user['user_id'] && !api_is_anonymous()) {
if (api_get_setting('gradebook_enable') == 'true') { if (api_get_setting('gradebook_enable') == 'true') {
if (api_get_setting('show_tabs', 'my_gradebook') == 'true') { if (api_get_setting('show_tabs', 'my_gradebook') == 'true') {
$navigation['mygradebook'] = $possible_tabs['mygradebook']; $navigation['mygradebook'] = $possible_tabs['mygradebook'];
} else{ } else {
$menu_navigation['mygradebook'] = $possible_tabs['mygradebook']; $menu_navigation['mygradebook'] = $possible_tabs['mygradebook'];
} }
} }
// Reporting // Reporting
if (api_get_setting('show_tabs', 'reporting') == 'true') { if (api_get_setting('show_tabs', 'reporting') == 'true') {
if(api_is_allowed_to_create_course() || $_user['status'] == DRH) { if (api_is_allowed_to_create_course() || $_user['status'] == DRH) {
$navigation['session_my_space'] = $possible_tabs['session_my_space']; $navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else { } else {
$navigation['session_my_space'] = $possible_tabs['session_my_progress']; $navigation['session_my_space'] = $possible_tabs['session_my_progress'];
} }
} else { } else {
if(api_is_allowed_to_create_course() || $_user['status'] == DRH) { if (api_is_allowed_to_create_course() || $_user['status'] == DRH) {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_space']; $menu_navigation['session_my_space'] = $possible_tabs['session_my_space'];
} else { } else {
$menu_navigation['session_my_space'] = $possible_tabs['session_my_progress']; $menu_navigation['session_my_space'] = $possible_tabs['session_my_progress'];
@ -235,7 +232,7 @@ if ($_user['user_id'] && !api_is_anonymous()) {
} }
if(api_is_platform_admin(true)) { if (api_is_platform_admin(true)) {
if (api_get_setting('show_tabs', 'platform_administration') == 'true') { if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
$navigation['platform_admin'] = $possible_tabs['platform_admin']; $navigation['platform_admin'] = $possible_tabs['platform_admin'];
} else { } else {
@ -246,28 +243,34 @@ if ($_user['user_id'] && !api_is_anonymous()) {
// Displaying the tabs // Displaying the tabs
foreach($navigation as $section => $navigation_info) { foreach($navigation as $section => $navigation_info) {
if(isset($GLOBALS['this_section'])) { if (isset($GLOBALS['this_section'])) {
$current = ($section == $GLOBALS['this_section'] ? ' id="current"' : ''); $current = ($section == $GLOBALS['this_section'] ? ' id="current"' : '');
} else { } else {
$current = ''; $current = '';
} }
echo ' <li'.$current.'><a href="'.$navigation_info['url'].'" target="_top"><span>'.$navigation_info['title'].'</span></a></li>'."\n"; echo '<li'.$current.'>';
echo '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
echo '</li>';
echo "\n";
} }
?> ?>
</ul> </ul><!-- small hack to have it look good in opera -->&nbsp;
<div style="clear: both;" class="clear"> </div> </div> <!-- end of header3 (user) section -->
</div> <?php
/*
-----------------------------------------------------------------------------
<div id="header4"> BREADCRUMBS
<?php -----------------------------------------------------------------------------
/* */
?>
<div id="header4">
<?php
/*
* if the user is a coach he can see the users who are logged in its session * if the user is a coach he can see the users who are logged in its session
*/ */
$navigation = array(); $navigation = array();
// part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage // part 1: Course Homepage. If we are in a course then the first breadcrumb is a link to the course homepage
//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb if (isset ($_cid) and $_cid!=-1 and isset($_course)) {
if (isset ($_cid) and $_cid!=-1 and isset($_course) and !isset($_GET['hide_course_breadcrumb'])) {
$navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'; $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php';
switch(api_get_setting('breadcrumbs_course_homepage')) { switch(api_get_setting('breadcrumbs_course_homepage')) {
case 'get_lang': case 'get_lang':
@ -284,7 +287,7 @@ if (isset ($_cid) and $_cid!=-1 and isset($_course) and !isset($_GET['hide_cours
} }
// part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself) // part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself)
if (isset($interbreadcrumb) && is_array($interbreadcrumb)) { if (isset($interbreadcrumb) && is_array($interbreadcrumb)) {
foreach($interbreadcrumb as $breadcrumb_step) { foreach ($interbreadcrumb as $breadcrumb_step) {
$sep = (strrchr($breadcrumb_step['url'], '?') ? '&amp;' : '?'); $sep = (strrchr($breadcrumb_step['url'], '?') ? '&amp;' : '?');
$navigation_item['url'] = $breadcrumb_step['url'].$sep.api_get_cidreq(); $navigation_item['url'] = $breadcrumb_step['url'].$sep.api_get_cidreq();
$navigation_item['title'] = $breadcrumb_step['name']; $navigation_item['title'] = $breadcrumb_step['name'];
@ -300,18 +303,17 @@ if (isset ($nameTools) AND $language_file<>"course_home") {
} }
$final_navigation = array(); $final_navigation = array();
foreach($navigation as $index => $navigation_info) { foreach ($navigation as $index => $navigation_info) {
if(!empty($navigation_info['title'])) { if (!empty($navigation_info['title'])) {
$final_navigation[$index] = '<a href="'.$navigation_info['url'].'" class="breadcrumb breadcrumb'.$index.'" target="_top">'.$navigation_info['title'].'</a>'; $final_navigation[$index] = '<a href="'.$navigation_info['url'].'" target="_top">'.$navigation_info['title'].'</a>';
} }
} }
echo implode(' &gt; ',$final_navigation); echo implode(' &gt; ',$final_navigation);
?> ?>
</div> </div><!-- end of header4 -->
<?php <?php
if(api_get_setting('show_toolshortcuts')=='true') { if (api_get_setting('show_toolshortcuts')=='true') {
echo '<div id="toolshortcuts">'; echo '<div id="toolshortcuts">';
require_once('tool_navigation_menu.inc.php'); require_once('tool_navigation_menu.inc.php');
show_navigation_tool_shortcuts(); show_navigation_tool_shortcuts();
@ -334,7 +336,7 @@ if (isset ($dokeos_database_connection)) {
<?php <?php
//to mask the main div, set $header_hide_main_div to true in any script just before calling Display::display_header(); //to mask the main div, set $header_hide_main_div to true in any script just before calling Display::display_header();
global $header_hide_main_div; global $header_hide_main_div;
if (!empty($header_hide_main_div) && $header_hide_main_div===true) { if(!empty($header_hide_main_div) && $header_hide_main_div===true) {
//do nothing //do nothing
} else { } else {
?> ?>
@ -367,8 +369,8 @@ if(api_get_setting('show_navigation_menu') != 'false' && api_get_setting('show_n
echo '<div id="menuButton">'; echo '<div id="menuButton">';
echo $output_string_menu; echo $output_string_menu;
echo '</div>'; echo '</div>';
if(isset($_SESSION['hideMenu'])) { if (isset($_SESSION['hideMenu'])) {
if($_SESSION['hideMenu'] =="shown") { if ($_SESSION['hideMenu'] =="shown") {
if (isset($_cid) ) { if (isset($_cid) ) {
echo '<div id="centerwrap"> <!-- start of #centerwrap -->'; echo '<div id="centerwrap"> <!-- start of #centerwrap -->';
echo '<div id="center"> <!-- start of #center -->'; echo '<div id="center"> <!-- start of #center -->';
@ -403,7 +405,7 @@ function get_tabs() {
// My Courses // My Courses
if(api_get_setting('use_session_mode')=='true') { if(api_get_setting('use_session_mode')=='true') {
if(api_is_allowed_to_create_course()) { if (api_is_allowed_to_create_course()) {
// Link to my courses for teachers // Link to my courses for teachers
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true'; $navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php?nosession=true';
$navigation['mycourses']['title'] = get_lang('MyCourses'); $navigation['mycourses']['title'] = get_lang('MyCourses');
@ -413,6 +415,13 @@ function get_tabs() {
$navigation['mycourses']['title'] = get_lang('MyCourses'); $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 { } else {
// Link to my courses // Link to my courses
$navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php'; $navigation['mycourses']['url'] = api_get_path(WEB_PATH).'user_portal.php';
@ -436,18 +445,17 @@ function get_tabs() {
// Reporting // Reporting
if(api_is_allowed_to_create_course() || $_user['status']==DRH) { if(api_is_allowed_to_create_course() || $_user['status']==DRH) {
// Link to my space // Link to my space
$navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'; $navigation['session_my_space']['url'] = api_get_path(WEB_PATH).'main/mySpace/';
$navigation['session_my_space']['title'] = get_lang('MySpace'); $navigation['session_my_space']['title'] = get_lang('MySpace');
} else { } else {
// Link to my progress // Link to my progress
$navigation['session_my_progress']['url'] = api_get_path(WEB_CODE_PATH).'auth/my_progress.php'; $navigation['session_my_progress']['url'] = api_get_path(WEB_PATH).'main/auth/my_progress.php';
$navigation['session_my_progress']['title'] = get_lang('MyProgress'); $navigation['session_my_progress']['title'] = get_lang('MyProgress');
} }
// Platform administration // Platform administration
if (api_is_platform_admin(true)) { if (api_is_platform_admin(true)) {
//$navigation['platform_admin']['url'] = $rootAdminWeb; $navigation['platform_admin']['url'] = $rootAdminWeb;
$navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/';
$navigation['platform_admin']['title'] = get_lang('PlatformAdmin'); $navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
} }

Loading…
Cancel
Save