Browse Source

[svn r11353] improve the reporting (for the moment only for the coaches)

Eric Marguin 18 years ago
parent
commit
fd6c78b84d

+ 420 - 0
main/inc/lib/tracking.lib.php

@@ -0,0 +1,420 @@
+<?php // $Id: tracking.lib.php 2007-28-02 15:51:53
+/*
+==============================================================================
+	Dokeos - elearning and course management software
+
+	Copyright (c) 2004 Dokeos S.A.
+	Copyright (c) 2003 Ghent University (UGent)
+	Copyright (c) 2001 Universite catholique de Louvain (UCL)
+	Copyright (c) various contributors
+
+	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: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
+==============================================================================
+*/
+/**
+==============================================================================
+*	This is the tracking library for Dokeos.
+*	Include/require it in your code to use its functionality.
+*
+*	@package dokeos.library
+==============================================================================
+*/
+
+
+class Tracking {
+	
+	/**
+	 * Calculates the time spent on the platform by a user
+	 * @param integer $user_id the user id
+	 * @return timestamp $nb_seconds
+	 */
+	function get_time_spent_on_the_platform ($user_id) 
+	{
+		
+		$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
+					
+		$sql = 'SELECT login_date, logout_date FROM '.$tbl_track_login.' 
+				WHERE login_user_id = '.intval($user_id);
+		
+		$rs = api_sql_query($sql);
+		
+		$nb_seconds=0;
+		
+		while($a_connections=mysql_fetch_array($rs))
+		{
+			
+			$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);
+			
+			$nb_seconds += ($i_timestamp_logout_date-$i_timestamp_login_date);
+			
+		}
+		
+		return $nb_seconds;
+	}
+	
+	/**
+	 * Calculates the time spent on the course
+	 * @param integer $user_id the user id
+	 * @param string $course_code the course code
+	 * @return timestamp $nb_seconds
+	 */
+	function get_time_spent_on_the_course ($user_id, $course_code) 
+	{
+		// protect datas
+		$student_id = intval($student_id);
+		$course_code = addslashes($course_code);
+		
+		$tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
+					
+		$sql = 'SELECT login_course_date, logout_course_date FROM '.$tbl_track_course.' 
+				WHERE user_id = '.intval($user_id).'
+				AND course_code="'.$course_code.'"';
+		
+		$rs = api_sql_query($sql);
+		
+		$nb_seconds=0;
+		
+		while($a_connections=mysql_fetch_array($rs))
+		{
+			
+			$s_login_date = $a_connections["login_course_date"];
+			$s_logout_date = $a_connections["logout_course_date"];
+			
+			$i_timestamp_login_date = strtotime($s_login_date);
+			$i_timestamp_logout_date = strtotime($s_logout_date);
+			
+			$nb_seconds += ($i_timestamp_logout_date-$i_timestamp_login_date);
+			
+		}
+		
+		return $nb_seconds;
+	}
+	
+	function get_last_connection_date($student_id)
+	{
+		$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
+		$sql = 'SELECT login_date FROM '.$tbl_track_login.' 
+				WHERE login_user_id = '.intval($student_id).' 
+				ORDER BY login_date DESC LIMIT 0,1';
+		
+		$rs = api_sql_query($sql);
+		if($last_login_date = mysql_result($rs,0,0))
+		{
+			return $last_login_date;
+		}
+		else
+		{
+			return false;
+		}
+	}
+	
+	function count_course_per_student ($user_id)
+	{
+		
+		$user_id = intval($user_id);
+		$tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
+		$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+		
+		$sql = 'SELECT DISTINCT course_code
+				FROM '.$tbl_course_rel_user.'
+				WHERE user_id = '.$user_id;
+		$rs = api_sql_query($sql , __FILE__ , __LINE__);
+		$nb_courses = mysql_num_rows($rs);
+		
+		$sql = 'SELECT DISTINCT course_code
+				FROM '.$tbl_session_course_rel_user.'
+				WHERE id_user = '.$user_id;
+		$rs = api_sql_query($sql , __FILE__ , __LINE__);
+		$nb_courses += mysql_num_rows($rs);
+		
+		return $nb_courses;
+	}
+	
+	function get_avg_student_progress($student_id, $course_code)
+	{
+		require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
+		
+		// protect datas
+		$student_id = intval($student_id);
+		$course_code = addslashes($course_code);
+		
+		// get the informations of the course 
+		$a_course = CourseManager :: get_course_information($course_code);
+		
+		// table definition
+		$tbl_course_lp_view = Database :: get_course_table(TABLE_LP_VIEW , $a_course['db_name']);
+		$tbl_course_lp_view_item = Database :: get_course_table(TABLE_LP_ITEM_VIEW , $a_course['db_name']);
+		$tbl_course_lp_item = Database :: get_course_table(TABLE_LP_ITEM , $a_course['db_name']);
+		$tbl_course_lp = Database :: get_course_table(TABLE_LP , $a_course['db_name']);
+		
+		// get the progress in learning pathes	
+		$sqlProgress = "SELECT COUNT( DISTINCT item_view.lp_item_id ) AS nbItem 
+						FROM ".$tbl_course_lp_view_item." AS item_view 
+						INNER JOIN ".$tbl_course_lp_view." AS lpview 
+							ON lpview.user_id = ".$student_id." 
+						WHERE item_view.status = 'completed' 
+					   ";
+		
+		$resultProgress = api_sql_query($sqlProgress);
+		$a_nbItem = mysql_fetch_array($resultProgress);
+		
+		$nbTotalItem = Database::count_rows($tbl_course_lp_item);
+
+		$totalItem = $totalItem + $nbTotalItem;
+		
+		$totalProgress = $totalProgress + $a_nbItem['nbItem'];
+		
+		$progress = round(($a_nbItem['nbItem'] * 100) / $nbTotalItem);
+		
+		return $progress;
+	}
+	
+	function get_avg_student_score($student_id, $course_code)
+	{
+		
+		// protect datas
+		$student_id = intval($student_id);
+		$course_code = addslashes($course_code);
+		
+		
+		$sqlScore = "	SELECT  exe_result,
+								exe_weighting
+		 				FROM ".Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES)."
+						WHERE exe_user_id = ".$student_id."
+		 				AND exe_cours_id = '".$course_code."'
+					";
+		$resultScore = api_sql_query($sqlScore);
+		$i = 0;
+		$score = 0;
+		while($a_score = mysql_fetch_array($resultScore))
+		{
+			$score = $score + $a_score['exe_result'];
+			$weighting = $weighting + $a_score['exe_weighting'];
+			$i++;
+		}
+		
+		$totalScore = $totalScore + $score;
+		$totalWeighting = $totalWeighting + $weighting;
+		
+		$pourcentageScore = round(($score*100)/$weighting);
+		
+		return $pourcentageScore;
+	}
+	
+	/**
+	 * gets the list of students followed by coach
+	 * @param integer $coach_id the id of the coach
+	 * @return Array the list of students
+	 */
+	function get_student_followed_by_coach ($coach_id)
+	{
+		$coach_id = intval($coach_id);
+		
+		$tbl_session_course_user 	= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+		$tbl_session_course 		= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
+		$tbl_session 		= Database :: get_main_table(TABLE_MAIN_SESSION);
+			
+		$a_students = array();
+		
+		//////////////////////////////////////////////////////////////
+		// At first, courses where $coach_id is coach of the course //
+		//////////////////////////////////////////////////////////////
+		$sql = 'SELECT id_session, course_code FROM '.$tbl_session_course.' WHERE id_coach='.$coach_id;
+		$result=api_sql_query($sql);
+		
+		while($a_courses=mysql_fetch_array($result))
+		{
+	    	$course_code=$a_courses["course_code"];
+	    	$id_session=$a_courses["id_session"];
+	    	
+	    	$sql = "SELECT distinct	srcru.id_user  
+					FROM $tbl_session_course_user AS srcru 
+					WHERE course_code='$course_code' AND id_session='$id_session'";
+
+			$rs=api_sql_query($sql);
+			
+			while($row=mysql_fetch_array($rs))
+			{
+				$a_students[$row['id_user']]=$row['id_user'];
+			}			
+	    }
+	    
+	    //////////////////////////////////////////////////////////////
+		// Then, courses where $coach_id is coach of the session    //
+		//////////////////////////////////////////////////////////////
+		
+		$sql = 'SELECT session_course_user.id_user 
+				FROM '.$tbl_session_course_user.' as session_course_user
+				INNER JOIN '.$tbl_session_course.' as session_course
+					ON session_course.course_code = session_course_user.course_code
+				INNER JOIN '.$tbl_session.' as session
+					ON session.id = session_course.id_session
+					AND session.id_coach = '.$coach_id;
+		$result=api_sql_query($sql);
+		
+		while($row=mysql_fetch_array($result))
+		{
+			$a_students[$row['id_user']]=$row['id_user'];
+		}
+		
+		return $a_students;
+	}
+	
+	function get_courses_followed_by_coach ($coach_id) {
+		
+		$coach_id = intval($coach_id);
+		
+		$tbl_session_course_user 	= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+		$tbl_session_course 		= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
+		$tbl_session 				= Database :: get_main_table(TABLE_MAIN_SESSION);
+		
+		//////////////////////////////////////////////////////////////
+		// At first, courses where $coach_id is coach of the course //
+		//////////////////////////////////////////////////////////////
+		$sql = 'SELECT DISTINCT course_code FROM '.$tbl_session_course.' WHERE id_coach='.$coach_id;
+		$result=api_sql_query($sql);
+		while($row = mysql_fetch_array($result))
+		{
+			$a_courses[$row['course_code']] = $row['course_code'];
+		}
+	    
+	    
+	    //////////////////////////////////////////////////////////////
+		// Then, courses where $coach_id is coach of the session    //
+		//////////////////////////////////////////////////////////////		
+		$sql = 'SELECT DISTINCT session_course.course_code
+				FROM '.$tbl_session_course.' as session_course
+				INNER JOIN '.$tbl_session.' as session
+					ON session.id = session_course.id_session
+					AND session.id_coach = '.$coach_id;
+		$result=api_sql_query($sql);
+		
+		while($row=mysql_fetch_array($result))
+		{
+			$a_courses[$row['course_code']] = $row['course_code'];
+		}
+		
+		return $a_courses;
+	}
+	
+	function get_sessions_coached_by_user($coach_id)
+	{
+		// table definition
+		$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
+		$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
+		
+		// protect datas
+		$coach_id = intval($coach_id);
+		
+		// session where we are general coach
+		$sql = 'SELECT DISTINCT id, name, date_start, date_end
+				FROM '.$tbl_session.' 
+				WHERE id_coach='.$coach_id;
+		$rs = api_sql_query($sql);
+		while($row = mysql_fetch_array($rs))
+		{
+			$a_sessions[$row["id"]]=$row;
+		}
+		
+		// session where we are coach of a course
+		$sql = 'SELECT DISTINCT session.id, session.name, session.date_start, session.date_end
+				FROM '.$tbl_session.' as session
+				INNER JOIN '.$tbl_session_course.' as session_course
+					ON session.id = session_course.id_session
+					AND session_course.id_coach='.$coach_id;
+
+		$rs = api_sql_query($sql);
+		
+		while($row = mysql_fetch_array($rs))
+		{
+			$a_sessions[$row["id"]]=$row;
+		}
+		
+		
+		return $a_sessions;
+		
+	}
+	
+	
+	function get_courses_list_from_session($session_id)
+	{
+		//protect datas
+		$session_id = intval($session_id);
+		
+		// table definition
+		$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
+		$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
+		
+		$sql = 'SELECT DISTINCT course_code, id_coach 
+				FROM '.$tbl_session_course.'
+				WHERE id_session='.$session_id;
+		
+		$rs = api_sql_query($sql,__FILE__,__LINE__);
+		$a_courses = array();
+		while($row = mysql_fetch_array($rs))
+		{
+			$a_courses[$row['course_code']] = $row;
+		}
+		return $a_courses;
+	}
+	
+	function count_student_assignments ($student_id, $course_code)
+	{
+		require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
+		
+		// protect datas
+		$student_id = intval($student_id);
+		$course_code = addslashes($course_code);
+		
+		// get the informations of the course 
+		$a_course = CourseManager :: get_course_information($course_code);
+		
+		// table definition
+		$tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $a_course['db_name']);
+		$sql = 'SELECT 1
+				FROM '.$tbl_item_property.' 
+				WHERE insert_user_id='.$student_id.'
+				AND tool="work"';
+		
+		$rs = api_sql_query($sql, __LINE__, __FILE__);
+		return mysql_num_rows($rs);
+	}
+	
+	function count_student_messages ($student_id, $course_code)
+	{
+		require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
+		
+		// protect datas
+		$student_id = intval($student_id);
+		$course_code = addslashes($course_code);
+		
+		// get the informations of the course 
+		$a_course = CourseManager :: get_course_information($course_code);
+		
+		// table definition
+		$tbl_messages = Database :: get_course_table(TABLE_FORUM_POST, $a_course['db_name']);
+		$sql = 'SELECT 1
+				FROM '.$tbl_messages.' 
+				WHERE poster_id='.$student_id;
+		
+		$rs = api_sql_query($sql, __LINE__, __FILE__);
+		return mysql_num_rows($rs);
+	}
+}
+
+
+?>

+ 15 - 0
main/inc/lib/usermanager.lib.php

@@ -283,6 +283,21 @@ class UserManager
 		$user = mysql_fetch_array($res,MYSQL_ASSOC);
 		return $user;
 	}
+	
+	/**
+	 * Get user information
+	 * @param string $id The id
+	 * @return array All user information as an associative array
+	 */
+	function get_user_info_by_id($user_id)
+	{
+		$user_id = intval($user_id);
+		$user_table = Database :: get_main_table(TABLE_MAIN_USER);
+		$sql = "SELECT * FROM $user_table WHERE user_id=".$user_id;
+		$res = api_sql_query($sql,__FILE__,__LINE__);
+		$user = mysql_fetch_array($res,MYSQL_ASSOC);
+		return $user;
+	}
 
 	//for survey
 	function get_teacher_list($course_id, $sel_teacher='')

+ 249 - 87
main/mySpace/index.php

@@ -7,6 +7,8 @@ $language_file = array ('registration', 'index','tracking');
 $cidReset=true;
 
 require ('../inc/global.inc.php');
+require (api_get_path(LIBRARY_PATH).'tracking.lib.php');
+require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
 $nameTools= get_lang("MySpace");
 
 $this_section = "session_my_space";
@@ -24,34 +26,223 @@ $tbl_session_course 		= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
 $tbl_session_user 			= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
 $tbl_session_course_user 	= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 $tbl_admin					= Database :: get_main_table(TABLE_MAIN_ADMIN);
-  
-  
-    
-function is_coach()
+
+$isCoach = api_is_coach(); 
+
+
+if($isCoach)
 {
-  	global $tbl_session_course;
-  	
-	$sql="SELECT course_code FROM $tbl_session_course WHERE id_coach='".$_SESSION["_uid"]."'";
-	$result=api_sql_query($sql);
-	  
-	if(mysql_num_rows($result)>0)
+	
+	/****************************************
+	 * Infos about students of the coach
+	 ****************************************/
+	$a_students = Tracking :: get_student_followed_by_coach($_user['user_id']);
+	$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
+	$nbStudents = count($a_students);
+	
+	$totalTimeSpent = 0;
+	$totalCourses = 0;
+	$avgTotalProgress = 0;
+	$avgResultsToExercises = 0;
+	$nb_inactive_students = 0;
+	foreach($a_students as $student_id)
 	{
-	    return true;	    
+		if($last_connection_date = Tracking :: get_last_connection_date($student_id))
+		{
+			list($last_connection_date, $last_connection_hour) = explode(' ',$last_connection_date);
+			$last_connection_date = explode('-',$last_connection_date);
+			$last_connection_hour = explode(':',$last_connection_hour);
+			$last_connection_time = mktime($last_connection_hour[0],$last_connection_hour[1],$last_connection_hour[2],$last_connection_date[1],$last_connection_date[2],$last_connection_date[0]);			
+			if(time()-(3600*24*7) > $last_connection_time)
+			{
+				$nb_inactive_students++;
+			}
+		}
+		else
+		{
+			$nb_inactive_students++;
+		}
+		
+		$totalTimeSpent += Tracking :: get_time_spent_on_the_platform($student_id);
+		$totalCourses += Tracking :: count_course_per_student($student_id);
+		$avgStudentProgress = $avgStudentScore = 0;
+		$nb_courses_student = 0;
+		foreach($a_courses as $course_code)
+		{
+			if(CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true))
+			{
+				$nb_courses_student++;
+				$avgStudentProgress += Tracking :: get_avg_student_progress($student_id,$course_code);
+				$avgStudentScore += Tracking :: get_avg_student_score($student_id,$course_code);
+			}
+		}
+		// average progress of the student
+		$avgStudentProgress = $avgStudentProgress / $nb_courses_student;
+		$avgTotalProgress += $avgStudentProgress;
+		
+		// average test results of the student
+		$avgStudentScore = $avgStudentScore / $nb_courses_student;
+		$avgResultsToExercises += $avgStudentScore;
+		
 	}
-	else
+	// average progress
+	$avgTotalProgress = $avgTotalProgress/$nbStudents;
+	
+	// average results to the tests
+	$avgResultsToExercises = $avgResultsToExercises/$nbStudents;
+	
+	// average courses by student
+	$avgCoursesPerStudent = round($totalCourses / $nbStudents,1);
+	
+	// average time spent on the platform
+	$avgTimeSpent = $totalTimeSpent / $nbStudents;
+	
+	
+	 echo '
+	 <div class="admin_section">
+		<h4>
+			<a href="student.php"><img src="'.api_get_path(WEB_IMG_PATH).'students.gif">&nbsp;'.get_lang('Probationers').' ('.$nbStudents.')'.'</a> 
+		</h4>
+		<table class="data_table">
+			<tr>
+				<td>
+					'.get_lang('InactivesStudents').'
+				</td>
+				<td>
+					'.$nb_inactive_students.'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('AverageTimeSpentOnThePlatform').'
+				</td>
+				<td>
+					'.api_time_to_hms($avgTimeSpent).'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('AverageCoursePerStudent').'
+				</td>
+				<td>
+					'.$avgCoursesPerStudent.'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('AverageProgressInLearnpath').'
+				</td>
+				<td>
+					'.round($avgTotalProgress,1).' %
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('AverageResultsToTheExercices').'
+				</td>
+				<td>
+					'.round($avgResultsToExercises,1).'
+				</td>
+			</tr>
+		</table>
+		<a href="student.php">'.get_lang('SeeStudentList').'</a>
+	 </div>';
+	 
+	 
+	 
+	 /****************************************
+	 * Infos about sessions of the coach
+	 ****************************************/
+	$a_sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']);
+	$nbSessions = count($a_sessions);
+	$nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0;
+	$a_courses = array();
+	foreach($a_sessions as $a_session)
 	{
-		return false;
+		if($a_session['date_start'] == '0000-00-00')
+		{
+			$nb_sessions_current ++;
+		}
+		else
+		{
+			$date_start = explode('-',$session['date_start']);
+			$time_start = mktime(0,0,0,$date_start[1],$date_start[2],$date_start[0]);
+			
+			$date_end = explode('-',$session['date_end']);				
+			$time_end = mktime(0,0,0,$date_end[1],$date_end[2],$date_end[0]);			
+			if($time_start < time() && time() < $time_end)
+			{
+				$nb_sessions_current++;
+			}
+			else if(time() < $time_start)
+			{
+				$nb_sessions_future++;
+			}
+			else if(time() > $time_end)
+			{
+				$nb_sessions_past++;
+			}
+		}
+		$a_courses = array_merge($a_courses, Tracking::get_courses_list_from_session($a_session['id']));		
 	}
+	$nb_courses_per_session = round(count($a_courses)/$nbSessions,1);
+	echo '
+	 <div class="admin_section">
+		<h4>
+			<a href="session.php"><img src="'.api_get_path(WEB_IMG_PATH).'sessions.gif">&nbsp;'.get_lang('Sessions').' ('.$nbSessions.')'.'</a>
+		</h4>
+		<table class="data_table">
+			<tr>
+				<td>
+					'.get_lang('NbActiveSessions').'
+				</td>
+				<td>
+					'.$nb_sessions_current.'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('NbPastSessions').'
+				</td>
+				<td>
+					'.$nb_sessions_past.'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('NbFutureSessions').'
+				</td>
+				<td>
+					'.$nb_sessions_future.'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('NbStudentPerSession').'
+				</td>
+				<td>
+					'.round($nbStudents/$nbSessions,1).'
+				</td>
+			</tr>
+			<tr>
+				<td>
+					'.get_lang('NbCoursesPerSession').'
+				</td>
+				<td>
+					'.$nb_courses_per_session.'
+				</td>
+			</tr>
+		</table>
+		<a href="student.php">'.get_lang('SeeSessionList').'</a>
+	 </div>';
+	 
+	 Display::display_footer();
+	 exit;
 }
-  
-  
-  
- /*
- ===============================================================================
- 	MAIN CODE
- ===============================================================================  
- */
- 	
+
+
+
+
 //Trainers
 if(api_is_platform_admin())
 {
@@ -153,7 +344,7 @@ elseif($is_allowedCreateCourse)
 			}
 	}
 		
-		if(is_coach())
+		if($isCoach)
 		{
 			$a_stagiaire_coach=array();
 			
@@ -228,20 +419,7 @@ elseif($is_allowedCreateCourse)
 			
 		}
 		
-		//La personne est coach
-		if(is_coach()){
-			
-			$sqlNbCours = "	SELECT DISTINCT course_code 
-							FROM $tbl_session_course 
-						  	WHERE id_coach='".$_user['user_id']."' 
-						  ";
-			$resultCours = api_sql_query($sqlNbCours);
-			
-			while($a_cours_coach = mysql_fetch_array($resultCours)){
-				$a_cours[]=$a_cours_coach["course_code"];
-			}
-			
-		}
+		
 		$a_cours=array_unique($a_cours);
 		$nbCours=count($a_cours);
 		
@@ -280,7 +458,7 @@ elseif($is_allowedCreateCourse)
 			
 		}
 		
-		if(is_coach())
+		if($isCoach)
 		{
 			$sqlNbSessions = "	SELECT DISTINCT id_session 
 								FROM $tbl_session_course 
@@ -300,9 +478,6 @@ elseif($is_allowedCreateCourse)
 		
 	}
 
-	$sql_nb_admin="SELECT count(user_id) FROM $tbl_admin";
-	$resultNbAdmin = api_sql_query($sql_nb_admin);
-	$i_nb_admin=mysql_result($resultNbAdmin,0,0);
 
 if(api_is_platform_admin())
 {
@@ -313,60 +488,47 @@ if(api_is_platform_admin())
 	 </div>';
 }
  
-if((api_is_platform_admin() || $is_allowedCreateCourse) && api_get_setting('use_session_mode')=='true')
-{
+if((api_is_platform_admin() || ($is_allowedCreateCourse && $nbCoachs>0)) && api_get_setting('use_session_mode')=='true')
+{ // if the user is platform admin, or if he's a teacher which manage coaches
 	 echo '<div class="admin_section">
 		<h4>
 			<a href="coaches.php"><img src="'.api_get_path(WEB_IMG_PATH).'coachs.gif">&nbsp;'.get_lang("Tutors").' ('.$nbCoachs.')</a>
 		</h4>
 	 </div>';
 }
-?>
- <div class="admin_section">
-	<h4>
-		<?php 
-			echo "<a href='student.php'><img src='".api_get_path(WEB_IMG_PATH)."students.gif'>&nbsp;".get_lang('Probationers').' ('.$nbStagiaire.')'."</a>"; 
-		?>
-	</h4>
- </div>
- <div class="admin_section">
-	<h4>
-		<?php echo "<a href='admin.php'><img src='".api_get_path(WEB_IMG_PATH)."admins.gif'>&nbsp;".get_lang('Administrators')." (".$i_nb_admin.")</a>"; ?>
-	</h4>
- </div>
- <div class="admin_section">
-	<h4>
-		<?php echo "<a href='cours.php'><img src='".api_get_path(WEB_IMG_PATH)."courses.gif'>&nbsp;".get_lang('Courses').' ('.$nbCours.')'."</a>"; ?>
-	</h4>
- </div>
- 
- <?php
- if(api_get_setting('use_session_mode')=='true'){
- ?>
- <div class="admin_section">
-	<h4>
-		<?php echo "<a href='session.php'><img src='".api_get_path(WEB_IMG_PATH)."sessions.gif'>&nbsp;".get_lang('Sessions').' ('.$nbSessions.')'."</a>"; ?>
-	</h4>
- </div>
- <?php
- }
- ?>
 
- <div class="admin_section">
-	<h4>
-		<?php echo "<img src='".api_get_path(WEB_IMG_PATH)."statistics.gif'>&nbsp;".get_lang('Tracks'); ?>
-	</h4>
-	<ul>
-		<li>
-			<a href="progression.php"><?php echo get_lang('Progression'); ?></a>
-		</li>
-		<li>
-			<a href="reussite.php"><?php echo get_lang('Success'); ?></a>
-		</li>
-	</ul>
- </div>
 
- <?php
+if(api_is_platform_admin())
+{
+	
+	$sql_nb_admin="SELECT count(user_id) FROM $tbl_admin";
+	$resultNbAdmin = api_sql_query($sql_nb_admin);
+	$i_nb_admin=mysql_result($resultNbAdmin,0,0);
+	echo '
+	 <div class="admin_section">
+		<h4>
+			<a href="admin.php"><img src="'.api_get_path(WEB_IMG_PATH).'admins.gif>&nbsp;'.get_lang('Administrators').' ('.$i_nb_admin.')</a>
+		</h4>
+	 </div>';
+}
+if($nbCours)
+{
+	echo '
+	 <div class="admin_section">
+		<h4>
+			<a href="cours.php"><img src="'.api_get_path(WEB_IMG_PATH).'courses.gif">&nbsp;'.get_lang('Courses').' ('.$nbCours.')'.'</a>
+		</h4>
+	 </div>';
+}
+if(api_get_setting('use_session_mode')=='true'){
+	echo '
+	 <div class="admin_section">
+		<h4>
+			<a href="session.php"><img src="'.api_get_path(WEB_IMG_PATH).'sessions.gif">&nbsp;'.get_lang('Sessions').' ('.$nbSessions.')'.'</a>
+		</h4>
+	 </div>';
+}
+
  
  
  /*

+ 107 - 213
main/mySpace/myStudents.php

@@ -7,6 +7,9 @@
 $language_file = array ('registration', 'index', 'tracking', 'exercice');
  $cidReset=true;
  include ('../inc/global.inc.php');
+ include_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
+ include_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
+ include_once(api_get_path(LIBRARY_PATH).'course.lib.php');
  
  $this_section = "session_my_space";
  
@@ -191,7 +194,7 @@ else
 
 if(!empty($_GET['student']))
 {
-	
+	// is the user online ?
 	$statistics_database = Database :: get_statistic_database();
 	$a_usersOnline = WhoIsOnline($_GET['student'], $statistics_database, 30);
 	foreach($a_usersOnline as $a_online)
@@ -205,82 +208,63 @@ if(!empty($_GET['student']))
 			$online = get_lang('No');
 		}
 	}
-	$sqlInfosUser = "	SELECT  user_id,
-								CONCAT(firstname,' ',lastname) AS name,
-								email,
-								phone,
-								picture_uri
-						FROM $tbl_user
-						WHERE user_id = ".$_GET['student']
-					;
-	$resultInfosUser = api_sql_query($sqlInfosUser);
-	$a_infosUser = mysql_fetch_array($resultInfosUser);
 	
-	if(api_get_setting('use_session_mode')=='true'){
-	$sqlCours = " 	SELECT DISTINCT course.title,
-									course.code,
-									course.db_name,
-									CONCAT(user.firstname,' ',user.lastname) as tutor_name,
-									sessionCourse.id_coach
-					FROM $tbl_user as user,$tbl_course AS course
-					INNER JOIN $tbl_session_course_user AS course_user
-						ON course_user.course_code = course.code
-					INNER JOIN $tbl_session_course as sessionCourse
-							ON sessionCourse.course_code = course.code
-					WHERE course_user.id_user = ".$_GET['student']."
-					AND sessionCourse.id_coach = user.user_id
-					ORDER BY course.title ASC
-				";
-	}
-	else{
-					
-		$sqlCours = "SELECT course.title,course.code,course.db_name FROM $tbl_course as course, $tbl_course_user as cru WHERE cru.course_code=course.code AND cru.user_id='".$_GET['student']."'";			
-
+	// infos about user
+	$a_infosUser = UserManager::get_user_info_by_id($_GET['student']);
+	$a_infosUser['name'] = $a_infosUser['firstname'].' '.$a_infosUser['lastname'];
+	
+	// courses followed by user where we are coach
+	$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
+	$avg_student_progress = $avg_student_score = $nb_courses = 0;
+	foreach ($a_courses as $key=>$course_code)
+	{
+		if(!CourseManager::is_user_subscribed_in_course($a_infosUser['user_id'], $course_code, true))
+		{
+			array_splice($a_courses, $key);
+		}
+		else
+		{
+			$nb_courses++;
+			$avg_student_progress += Tracking :: get_avg_student_progress($a_infosUser['user_id'],$course_code);
+			$avg_student_score += Tracking :: get_avg_student_score($a_infosUser['user_id'],$course_code);
+		}
 	}
-		$resultCours = api_sql_query($sqlCours);
+	$avg_student_progress = round($avg_student_progress / $nb_courses,1);
+	$avg_student_score = round($avg_student_score / $nb_courses,1);
 		
 ?>
 
 	<a name="infosStudent"></a>
 	<table class="data_table">
 		<tr>
-			<td 
-				<?php
-					if(empty($details))
-						echo 'colspan="6"';
-					else
-						echo 'colspan="7"';	
-				?>
-				class="border">
+			<td class="border">
 				<table width="100%" border="0" >
 					<tr>
 						
 							<?php
 								if(!empty($a_infosUser['picture_uri']))
 								{
-									echo '	<td class="borderRight">
+									echo '	<td class="borderRight" width="10%">
 												<img src="'.$a_infosUser['picture_uri'].'" />
 											</td>
 										 ';
 								}
 								else{
-									echo '	<td class="borderRight">
+									echo '	<td class="borderRight" width="10%">
 												<img src="../img/unknown.jpg" />
 											</td>
 										 '; 
 								}
 								
-								if(!empty($_GET['details'])){
-									$widthCellInfos="60%";
-								}
-								else{
-									$widthCellInfos="85%";
-								}
-								
 							?>
 						
-						<td class="none" width="<?php echo $widthCellInfos;?>">
-							<table>
+						<td class="none" width="40%">
+							<table width="100%">
+								<tr>
+									<th>
+										<?php echo get_lang('Informations'); ?>
+									</th>
+								</tr>
 								<tr>
 									<td class="none">
 										<?php 
@@ -330,14 +314,58 @@ if(!empty($_GET['student']))
 								</tr>
 							</table>
 						</td>
+						<td class="borderLeft" width="35%">
+							<table width="100%">
+								<tr>
+									<th>
+										<?php echo get_lang('Tracking'); ?>
+									</th>
+								</tr>
+								<tr>
+									<td>
+										<table>
+											<tr>
+												<td class="none">
+													<?php echo get_lang('LatestLogin') ?>
+												</td>
+												<td class="none">
+													<?php echo Tracking::get_last_connection_date($a_infosUser['user_id']) ?>
+												</td>
+											</tr>
+											<tr>
+												<td class="none">
+													<?php echo get_lang('TimeSpentOnThePlatform') ?>
+												</td>
+												<td class="none">
+													<?php echo api_time_to_hms(Tracking::get_time_spent_on_the_platform($a_infosUser['user_id'])) ?>
+												</td>
+											</tr>
+											<tr>
+												<td class="none">
+													<?php echo get_lang('Progress') ?>
+												</td>
+												<td class="none">
+													<?php echo $avg_student_progress.' %' ?>
+												</td>
+											</tr>
+											<tr>
+												<td class="none">
+													<?php echo get_lang('Score') ?>
+												</td>
+												<td class="none">
+													<?php echo $avg_student_score.' %' ?>
+												</td>
+											</tr>
+										</table>
+									</td>
+								</tr>
+							</table>
+						</td>
 					<?php
-				
-						if(!empty($_GET['details']))
-						{
 							$sendMail = Display::encrypted_mailto_link($a_infosUser['email'], ' '.get_lang('SendMail'));
 						
 					?>
-						<td class="borderLeft" width="25%">
+						<td class="borderLeft" width="15%">
 							<table width="100%">
 								<tr>
 									<th>
@@ -362,36 +390,14 @@ if(!empty($_GET['student']))
 										?>
 								
 								</tr>
-								<tr>
-									<td class="none">
-										<?php echo "<img align='absbottom' src='../img/meeting_agenda.gif'><a href=''>".'&nbsp; '.get_lang('RdvAgenda')."</a>"; ?>
-									</td>
-								</tr>
-								<tr>
-									<td class="none">
-										<?php echo "<img align='absbottom' src='../img/visio.gif'><a href=''>".'&nbsp; '.get_lang('VideoConf')."</a>"; ?>
-									</td>
-								</tr>
-								<tr>
-									<td class="none">
-										<?php echo "<img align='absbottom' src='../img/chat.gif'><a href=''>".'&nbsp; '.get_lang('Chat')."</a>"; ?>
-									</td>
-								</tr>
-								<tr>
-									<td class="none">
-								
-										<?php echo "<img align='absbottom' src='../img/spreadsheet.gif'><a href='".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&csv=true#infosStudent'>".'&nbsp; '.get_lang('ExcelFormat')."</a>"; ?>
-									</td>
-								</tr>
 							</table>
 						</td>
-					<?php
-						}
-					?>
 					</tr>
 				</table>
 			</td>
 		</tr>
+	</table>
+	<table class="data_table">
 		<tr><td colspan="5" style="border-width: 0px;">&nbsp;</td></tr>
 		</a>
 <?php
@@ -773,144 +779,32 @@ if(!empty($_GET['student']))
 			</th>
 		</tr>
 <?php
-			if(mysql_num_rows($resultCours)>0)
+		if(count($a_courses)>0)
+		{
+			foreach($a_courses as $course_code)
 			{
-				while($a_cours = mysql_fetch_array($resultCours))
-				{
+				$course_infos = CourseManager :: get_course_information($course_code);
+				echo '
+<tr>				
+	<td>
+		'.$course_infos['title'].'
+	</td>
+	<td>
+		'.api_time_to_hms(Tracking :: get_time_spent_on_the_course($a_infosUser['user_id'], $course_code)).'
+	</td>
+	<td>
+		'.Tracking :: get_avg_student_progress($a_infosUser['user_id'], $course_code).' %
+	</td>
+	<td>
+		'.Tracking :: get_avg_student_score($a_infosUser['user_id'], $course_code).' %
+	</td>
+	<td>
+		<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'#infosStudent"> -> </a>
+	</td>
 
-				if((api_get_setting("use_session_mode")=="true" && $i_user_id == $a_cours['id_coach']) || (api_get_setting("use_session_mode")=="false") && is_teacher($a_cours['code'])){
-						if($i%2==0){
-							$s_css_class="row_odd";
-					}
-					else{
-						$s_css_class="row_even";
-					}
-					
-					$i++;
-					
-					/**
-					 * Calcul du score total de l'étudiant sur le cours courant
-					 */
-					
-					$sqlScore = "	SELECT  exe_result,
-											exe_weighting
-					 				FROM $tbl_stats_exercices
-									WHERE exe_user_id = ".$_GET['student']."
-					 				AND exe_cours_id = '".$a_cours['code']."'
-								";
-					$resultScore = api_sql_query($sqlScore);
-					$i = 0;
-					$score = 0;
-					while($a_score = mysql_fetch_array($resultScore))
-					{
-						$score = $score + $a_score['exe_result'];
-						$weighting = $weighting + $a_score['exe_weighting'];
-						$i++;
-					}
-					
-					$totalScore = $totalScore + $score;
-					$totalWeighting = $totalWeighting + $weighting;
-					
-					$pourcentageScore = round(($score*100)/$weighting);
-					
-					$weighting = 0;
-					
-					/**
-					 * Calcul de la progression de l'étudiant sur les learning path du cours courant
-					 */
-					
-					$sqlProgress = "SELECT COUNT( DISTINCT item_view.lp_item_id ) AS nbItem 
-									FROM ".$a_cours['db_name'].".".$tbl_course_lp_view_item." AS item_view 
-									INNER JOIN ".$a_cours['db_name'].".".$tbl_course_lp_view." AS lpview 
-										ON lpview.user_id = ".$_GET['student']." 
-									WHERE item_view.status = 'completed' 
-								   ";
-	
-					$resultProgress = api_sql_query($sqlProgress);
-					$a_nbItem = mysql_fetch_array($resultProgress);
-					
-					$table = $a_cours['db_name'].'.'.$tbl_course_lp_item;
-					if(mysql_select_db($a_cours['db_name']))
-						$nbTotalItem = Database::count_rows($table);
-			
-					$totalItem = $totalItem + $nbTotalItem;
-					
-					$totalProgress = $totalProgress + $a_nbItem['nbItem'];
-					
-					$progress = round(($a_nbItem['nbItem'] * 100)/$nbTotalItem);
-					
-					
-					/**
-					 * Calcul du temps passé sur le cours courant
-					 */
-					
-					$tbl_track_lcourse_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
-					
-					$s_sql_connection_time="SELECT login_course_date, logout_course_date FROM $tbl_track_lcourse_access WHERE user_id ='".$_GET['student']."' AND logout_course_date <> 'null' AND course_code='".$a_cours['code']."'";
 
-					$q_result_connection_time=api_sql_query($s_sql_connection_time);
-					
-					$i_nb_seconds=0;
-					
-					while($a_connections=mysql_fetch_array($q_result_connection_time)){
-						
-						$s_login_date=$a_connections["login_course_date"];
-						$s_logout_date=$a_connections["logout_course_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);
-						
-					}
-					
-					$s_connection_time=calculHours($i_nb_seconds);
-					if($s_connection_time=="0h00m00s"){
-						$s_connection_time="";
-					}
-					
-					echo '<tr class="'.$s_css_class.'">';
-						
-					if(api_get_setting("use_session_mode")=="true"){
-						echo '<td>'.$a_cours['title'].'&nbsp;-&nbsp;'.get_lang('Tutor').' : '.$a_cours['tutor_name'].'</td>';
-					}
-					else{
-						echo '<td>'.$a_cours['title'].'</td>';
-					}
-					
-					echo '<td align="center">'.$s_connection_time.'</td>';
-					
-					echo '<td align="center">'.$progress.'%</td>';
-					
-					echo '<td align="center">'.$pourcentageScore.'%</td>';
-					
-					echo '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?student='.$a_infosUser['user_id'].'&details=true&course='.$a_cours['code'].'#infosStudent"> -> </a></td>';
-					
-					echo '</tr>';
-					
-				}
-					
+';
 			}
-			
-			$totalPourcentageScore = round(($totalScore*100)/$totalWeighting);
-			$progress = round(($totalProgress*100)/$totalItem);
-?>
-		<tr class='total'>
-			<td>
-				<strong>Total</strong>
-			</td>
-			<td>
-			</td>
-			<td align="center">
-				<?php echo $progress.'%'; ?>
-			</td>
-			<td align="center">
-				<?php echo $totalPourcentageScore.'%'; ?>
-			</td>
-			<td>
-			</td>
-		</tr>
-	<?php
 		}
 		else
 		{

+ 78 - 121
main/mySpace/student.php

@@ -9,6 +9,9 @@ ob_start();
 $language_file = array ('registration', 'index', 'tracking');
  $cidReset=true;
  require ('../inc/global.inc.php');
+ require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php');
+ require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
+ require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  
   $nameTools= get_lang("Students");
  
@@ -256,13 +259,87 @@ $tbl_session_rel_user 		= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
 	}
 	
 }
- 
+
+function count_student_coached()
+{
+	global $a_students;
+	return count($a_students);
+}
 
 /*
  ===============================================================================
  	MAIN CODE
  ===============================================================================  
  */
+ 
+ 
+ 
+$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
+$a_students = Tracking :: get_student_followed_by_coach($_user['user_id']);
+
+if(count($a_students)>0)
+{
+	$table = new SortableTable('tracking', 'count_student_coached');
+	$table -> set_header(0, get_lang('Name'),false);
+	$table -> set_header(1, get_lang('Time'),false);
+	$table -> set_header(2, get_lang('Progress'),false);
+	$table -> set_header(3, get_lang('Score'),false);	
+	$table -> set_header(4, get_lang('Student_publication'),false);
+	$table -> set_header(5, get_lang('Messages'),false);
+	$table -> set_header(6, get_lang('LatestLogin'),false);
+	$table -> set_header(7, get_lang('Details'),false);
+     
+      	 
+	foreach($a_students as $student_id)
+	{
+		$student_datas = UserManager :: get_user_info_by_id($student_id);
+		
+		$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0 ;
+		$nb_courses_student = 0;
+		foreach($a_courses as $course_code)
+		{
+			if(CourseManager :: is_user_subscribed_in_course($student_id,$course_code, true))
+			{
+				$avg_time_spent += Tracking :: get_time_spent_on_the_platform($student_id, $course_code);
+				$avg_student_score += Tracking :: get_avg_student_score($student_id, $course_code);
+				$avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code);
+				$total_assignments += Tracking :: count_student_assignments($student_id, $course_code);
+				$total_messages += Tracking :: count_student_messages($student_id, $course_code);
+				$nb_courses_student++;
+			}
+		}
+		$avg_time_spent = $avg_time_spent / $nb_courses_student;
+		$avg_student_score = $avg_student_score / $nb_courses_student;
+		$avg_student_progress = $avg_student_progress / $nb_courses_student;
+		
+		$row = array();
+		$row[] = $student_datas['firstname'].' '.$student_datas['lastname'];
+		$row[] = api_time_to_hms($avg_time_spent);
+		$row[] = $avg_student_progress.' %';
+		$row[] = $avg_student_score.' %';		
+		$row[] = $total_assignments;
+		$row[] = $total_messages;
+		$row[] = Tracking :: get_last_connection_date($student_id);
+		$row[] = '<a href="myStudents.php?student='.$student_id.'">-></a>';
+		
+		$table -> addRow($row);
+
+	}
+	$table -> display();
+	echo '</table>';
+}
+else
+{
+	echo get_lang('NoStudent');
+}
+exit;
+ 
+ 
+ 
+ 
+ 
+ 
+ 
 	$a_students=array();
 	
 	//La personne est admin
@@ -347,127 +424,7 @@ $tbl_session_rel_user 		= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
 	
 	usort($a_students,"mysort");
 	
-	$a_header[]=get_lang('LastName');
-	$a_header[]=get_lang('FirstName');
-	$a_header[]=get_lang('Email');
 	
-	$a_data=array();
-
-	if(count($a_students)>0)
-	{
-		echo '<table class="data_table">
-			 	<tr>
-					<th>
-						'.get_lang('LastName').'
-					</th>
-					<th>
-						'.get_lang('FirstName').'
-					</th>
-					<th>
-						'.get_lang('Email').'
-					</th>
-					<th>
-						'.get_lang('Tracking').'
-					</th>
-				</tr>
-          	 ';
-          	 
-		foreach($a_students as $a_current_student)
-		{
-			
-			if($i%2==0){
-				$s_css_class="row_odd";
-				
-				if($i%20==0 && $i!=0){
-					/*echo '<tr>
-							<th>
-								'.get_lang('Lastname').'
-							</th>
-							<th>
-								'.get_lang('Firstname').'
-							</th>
-							<th>
-								'.get_lang('Email').'
-							</th>
-							<th>
-								'.get_lang('Tutor').'
-							</th>
-							<th>
-								'.get_lang('Courses').'
-							</th>
-							<th>
-								'.get_lang('TakenSessions').'
-							</th>
-						</tr>
-		          	 ';*/
-		          	 echo '<tr>
-							<th>
-								'.get_lang('LastName').'
-							</th>
-							<th>
-								'.get_lang('FirstName').'
-							</th>
-							<th>
-								'.get_lang('Email').'
-							</th>
-							<th>
-								'.get_lang('Tracking').'
-							</th>
-						</tr>
-		          	 ';
-				}
-			}
-			else{
-				$s_css_class="row_even";
-			}
-			
-			$i++;
-			
-			echo '<tr class="'.$s_css_class.'">
-					<td>
-				 ';
-			echo		"<a href='myStudents.php?student=".$a_current_student[0]."#infosStudent'>".$a_current_student[1]."</a>";
-			echo '	</td>
-					<td>
-						<a href="myStudents.php?student='.$a_current_student[0].'#infosStudent">'.$a_current_student[2].'</a>
-					</td>
-					<td>
-				 ';
-			if(!empty($a_current_student[3]))
-			{	
-				echo	'<a href="mailto:'.$a_current_student[3].'">'.$a_current_student[3].'</a>';
-			}
-			else
-			{
-				//echo get_lang('NoEmail');
-			}
-			echo '	</td>';
-			
-			
-			if($a_current_student["teacher"]==true){
-				echo '<td align="center">';
-				if(api_get_setting('use_session_mode')=='true'){
-					echo '<a href="coaches.php?id_student='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'coachs.gif" alt="'.get_lang("StudentTutors").'" title="'.get_lang("StudentTutors").'"></a>&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_current_student[0].'#sessionSuivie"><img src="'.api_get_path(WEB_IMG_PATH).'agenda.gif" alt="'.get_lang("StudentSessions").'" title="'.get_lang("StudentSessions").'"></a>&nbsp;';
-				}		
-				echo '<a href="cours.php?type=student&user_id='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'course.gif" alt="'.get_lang("StudentCourses").'" title="'.get_lang("StudentCourses").'"></a>';				
-			}
-			else{
-				echo '<td></td>';
-			}
-			  echo '</tr>';
-
-				 
-			$a_data[$a_student['user_id']]["lastname"]=$a_student['lastname'];
-			$a_data[$a_student['user_id']]["firstname"]=$a_student['firstname'];
-			$a_data[$a_student['user_id']]["email"]=$a_student['email'];
-
-		}
-		echo '</table>';
-	}
-	else
-	{
-		echo get_lang('NoStudent');
-	}
 	
 
 	if(isset($_POST['export'])){

+ 1 - 1
main/user/userInfo.php

@@ -99,7 +99,7 @@ $userIdViewer = $_user['user_id']; // id fo the user currently online
 $allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
 $allowedToEditDef = api_is_allowed_to_edit();
 $is_allowedToTrack = api_is_allowed_to_edit() && $_configuration['tracking_enabled'];
-
+echo $is_allowedToTrack;
 // Library connection
 include ("userInfoLib.php");