Adding message if teacher have no courses

skala
Julio Montoya 16 years ago
parent c730962ce6
commit d0b2368fc1
  1. 58
      main/mySpace/index.php

@ -1,4 +1,4 @@
<?php // $Id: index.php 16620 2008-10-25 20:03:54Z yannoo $ <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* @todo use constant for $this_section * @todo use constant for $this_section
@ -53,9 +53,9 @@ $tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
$tbl_track_cours_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $tbl_track_cours_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
/******************** /*
* FUNCTIONS * FUNCTIONS
********************/ */
function count_teacher_courses() { function count_teacher_courses() {
global $nb_teacher_courses; global $nb_teacher_courses;
@ -98,21 +98,21 @@ function rsort_sessions($a, $b) {
} }
} }
/************************** /*
* MAIN CODE * MAIN CODE
***************************/ */
$is_coach = api_is_coach(); $is_coach = api_is_coach();
$is_platform_admin = api_is_platform_admin(); $is_platform_admin = api_is_platform_admin();
$is_drh = api_is_drh(); $is_drh = api_is_drh();
$is_session_admin = api_is_session_admin(); $is_session_admin = api_is_session_admin();
if ($is_session_admin) { if ($is_session_admin) {
header('location:session.php'); header('location:session.php');
exit; exit;
} }
// get views // Get views
$views = array('admin', 'teacher', 'coach', 'drh'); $views = array('admin', 'teacher', 'coach', 'drh');
$view = 'teacher'; $view = 'teacher';
if (isset($_GET['view']) && in_array($_GET['view'], $views)) { if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
@ -194,25 +194,31 @@ if ($is_drh || $_GET['display'] == 'yourstudents') {
$menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>'; $menu_items[] = '<a href="session.php">'.get_lang('Sessions').'</a>';
} }
// actions menu // Actions menu
echo '<div class="actions-title" style ="font-size:10pt;">';
$nb_menu_items = count($menu_items); $nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item; if ($nb_teacher_courses > 0 ) {
if ($key != $nb_menu_items - 1) { echo '<div class="actions-title" style ="font-size:10pt;">';
echo '&nbsp;|&nbsp;'; if ($nb_menu_items > 1) {
foreach ($menu_items as $key => $item) {
echo $item;
if ($key != $nb_menu_items - 1) {
echo '&nbsp;|&nbsp;';
}
} }
}
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
if ($view == 'admin') {
echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '<a href="'.api_get_self().'?display=useroverview&export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>' : '';
} else {
echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '' : '<a href="'.api_get_self().'?export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
} }
} echo '</div>';
echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
if ($view == 'admin') {
echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '<a href="'.api_get_self().'?display=useroverview&export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>' : '';
} else { } else {
echo (isset($_GET['display']) && $_GET['display'] == 'useroverview')? '' : '<a href="'.api_get_self().'?export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>'; Display::display_warning_message(get_lang('HaveNoCourse'));
} }
echo '</div>';
echo '<h4>'.$title.'</h4>'; echo '<h4>'.$title.'</h4>';
if (($is_drh && $view == 'drh') || $_GET['display'] == 'yourstudents') { if (($is_drh && $view == 'drh') || $_GET['display'] == 'yourstudents') {
@ -383,9 +389,9 @@ if ($view == 'coach' || $view == 'drh') {
} }
if ($view == 'coach') { if ($view == 'coach') {
/**************************************** /**
* Infos about sessions of the coach * Infos about sessions of the coach
****************************************/ **/
$sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']); $sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']);
$nb_sessions = count($sessions); $nb_sessions = count($sessions);
$nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0; $nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0;

Loading…
Cancel
Save