Source for file coaches.php
Documentation is available at coaches.php
* Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
// name of the language file that needs to be included
$language_file = array ('registration', 'index', 'tracking', 'admin');
require ('../inc/global.inc.php');
$this_section = "session_my_space";
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
if(isset ($_GET["id_student"])){
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
// Database Table Definitions
===============================================================================
===============================================================================
$fileName = 'coaches.csv';
if(!$open = fopen($archivePath. $fileName,'w+'))
foreach($a_header as $header)
foreach($a_data as $data)
$perm = octdec(!empty($perm)? $perm: '0660');
header("Location:". $archiveURL. $fileName);
$hours = floor($seconds / 3600);
$min = floor(($seconds - ($hours * 3600)) / 60);
$sec = $seconds - ($hours * 3600) - ($min * 60);
//echo $hours."h".$min."m".$sec."s";
return $hours. "h". $min. "m". $sec. "s" ;
global $tbl_session_course;
$sql= "SELECT course_code FROM $tbl_session_course WHERE id_coach='". $_SESSION["_uid"]. "'";
if(isset ($_GET["id_student"])){
$i_id_student= $_GET["id_student"];
$sqlCoachs = "SELECT DISTINCT src.id_coach " .
"FROM $tbl_session_rel_course as src, $tbl_session_rel_course_rel_user as srcru " .
"WHERE src.id_coach<>'0' AND src.course_code=srcru.course_code AND srcru.id_user='$i_id_student' AND srcru.id_session=src.id_session
$sqlCoachs = " SELECT DISTINCT id_coach, user_id, lastname, firstname
FROM $tbl_user, $tbl_session_rel_course
$sqlCoachs = " SELECT DISTINCT id_coach, $tbl_user.user_id, lastname, firstname
FROM $tbl_user as user, $tbl_session_rel_course as session_rel_course, $tbl_course_user as course_rel_user
WHERE course_rel_user.course_code=session_rel_course.course_code AND course_rel_user.status='1' AND course_rel_user.user_id='". $_SESSION["_uid"]. "'
AND session_rel_course.id_coach=user.user_id
echo '<table class="data_table">
$i_id_coach= $a_coachs["id_coach"];
if(isset ($_GET["id_student"])){
$sql_infos_coach= "SELECT lastname, firstname FROM $tbl_user WHERE user_id='$i_id_coach'";
$s_firstname= mysql_result($resultCoachsInfos,0,"firstname");
$s_lastname= $a_coachs["lastname"];
$s_firstname= $a_coachs["firstname"];
$s_sql_connection_time= "SELECT login_date, logout_date FROM $tbl_track_login WHERE login_user_id ='$i_id_coach' AND logout_date <> 'null'";
$s_login_date= $a_connections["login_date"];
$s_logout_date= $a_connections["logout_date"];
$i_timestamp_login_date= strtotime($s_login_date);
$i_timestamp_logout_date= strtotime($s_logout_date);
$i_nb_seconds+= ($i_timestamp_logout_date- $i_timestamp_login_date);
if($s_connection_time== "0h00m00s"){
$a_data[$i_id_coach]["firstname"]= $s_firstname;
$a_data[$i_id_coach]["lastname"]= $s_lastname;
$a_data[$i_id_coach]["connection_time"]= $s_connection_time;
echo '<tr class="'. $s_css_class. '"><td>'. $s_firstname. '</td><td>'. $s_lastname. '</td><td>'. $s_connection_time. '</td><td><a href="course.php?type=coach&user_id='. $i_id_coach. '">-></a></td><td><a href="student.php?type=coach&user_id='. $i_id_coach. '">-></a></td></tr>';
echo '<tr><td colspan="5" "align=center">'. get_lang("NoResult"). '</td></tr>';
if(isset ($_POST['export'])){
echo "<form method='post' action='coaches.php'>
<input type='submit' name='export' value='". get_lang('exportExcel'). "'/>
==============================================================================
==============================================================================
|