[svn r11397] improve reporting for the coach

skala
Eric Marguin 19 years ago
parent df49b92110
commit f5215b9346
  1. BIN
      main/img/printmgr.gif
  2. 37
      main/inc/lib/tracking.lib.php
  3. 2
      main/messaging/email_editor.php
  4. 123
      main/mySpace/index.php
  5. 424
      main/mySpace/myStudents.php
  6. 450
      main/mySpace/student.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -414,6 +414,43 @@ class Tracking {
$rs = api_sql_query($sql, __LINE__, __FILE__); $rs = api_sql_query($sql, __LINE__, __FILE__);
return mysql_num_rows($rs); return mysql_num_rows($rs);
} }
function count_student_visited_links ($student_id, $course_code)
{
// protect datas
$student_id = intval($student_id);
$course_code = addslashes($course_code);
// table definition
$tbl_stats_links = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
$sql = 'SELECT 1
FROM '.$tbl_stats_links.'
WHERE links_user_id='.$student_id.'
AND links_cours_id="'.$course_code.'"';
$rs = api_sql_query($sql, __LINE__, __FILE__);
return mysql_num_rows($rs);
}
function count_student_downloaded_documents ($student_id, $course_code)
{
// protect datas
$student_id = intval($student_id);
$course_code = addslashes($course_code);
// table definition
$tbl_stats_documents = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$sql = 'SELECT 1
FROM '.$tbl_stats_documents.'
WHERE down_user_id='.$student_id.'
AND down_cours_id="'.$course_code.'"';
$rs = api_sql_query($sql, __LINE__, __FILE__);
return mysql_num_rows($rs);
}
} }

@ -77,7 +77,7 @@ Display::display_header(get_lang('SendEmail'));
<label for="email_title"><?php echo get_lang('EmailTitle');?></label> <label for="email_title"><?php echo get_lang('EmailTitle');?></label>
</td> </td>
<td> <td>
<input name="email_title" id="email_title" value="<?php echo $_POST['email_title'];?>"></input> <input name="email_title" id="email_title" value="<?php echo $_POST['email_title'];?>" size="60"></input>
</td> </td>
</tr> </tr>
<tr> <tr>

@ -9,12 +9,20 @@ $cidReset=true;
require ('../inc/global.inc.php'); require ('../inc/global.inc.php');
require (api_get_path(LIBRARY_PATH).'tracking.lib.php'); require (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).'course.lib.php');
$nameTools= get_lang("MySpace"); require_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$csv_content = array();
$nameTools= get_lang("MySpace");
$this_section = "session_my_space"; $this_section = "session_my_space";
api_block_anonymous_users(); api_block_anonymous_users();
if(!$export_csv)
{
Display :: display_header($nameTools); Display :: display_header($nameTools);
}
// Database table definitions // Database table definitions
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -33,6 +41,19 @@ $isCoach = api_is_coach();
if($isCoach) if($isCoach)
{ {
/****************************************
* Print and export
****************************************/
if(!$export_csv)
{
echo '<div align="right">
<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.$_SERVER['PHP_SELF'].'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div>';
}
/**************************************** /****************************************
* Infos about students of the coach * Infos about students of the coach
****************************************/ ****************************************/
@ -45,8 +66,10 @@ if($isCoach)
$avgTotalProgress = 0; $avgTotalProgress = 0;
$avgResultsToExercises = 0; $avgResultsToExercises = 0;
$nb_inactive_students = 0; $nb_inactive_students = 0;
$nb_posts = $nb_assignments = 0;
foreach($a_students as $student_id) foreach($a_students as $student_id)
{ {
// inactive students
if($last_connection_date = Tracking :: get_last_connection_date($student_id)) if($last_connection_date = Tracking :: get_last_connection_date($student_id))
{ {
list($last_connection_date, $last_connection_hour) = explode(' ',$last_connection_date); list($last_connection_date, $last_connection_hour) = explode(' ',$last_connection_date);
@ -72,6 +95,8 @@ if($isCoach)
if(CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) if(CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true))
{ {
$nb_courses_student++; $nb_courses_student++;
$nb_posts += Tracking :: count_student_messages($student_id,$course_code);
$nb_assignments += Tracking :: count_student_assignments($student_id,$course_code);
$avgStudentProgress += Tracking :: get_avg_student_progress($student_id,$course_code); $avgStudentProgress += Tracking :: get_avg_student_progress($student_id,$course_code);
$avgStudentScore += Tracking :: get_avg_student_score($student_id,$course_code); $avgStudentScore += Tracking :: get_avg_student_score($student_id,$course_code);
} }
@ -97,7 +122,30 @@ if($isCoach)
// average time spent on the platform // average time spent on the platform
$avgTimeSpent = $totalTimeSpent / $nbStudents; $avgTimeSpent = $totalTimeSpent / $nbStudents;
// average assignments
$nb_assignments = $nb_assignments / $nbStudents;
// average posts
$nb_posts = $nb_posts / $nbStudents;
//csv part
if($export_csv)
{
$csv_content[] = array( get_lang('Probationers'));
$csv_content[] = array( get_lang('InactivesStudents'),$nb_inactive_students );
$csv_content[] = array( get_lang('AverageTimeSpentOnThePlatform'),$avgTimeSpent);
$csv_content[] = array( get_lang('AverageCoursePerStudent'),$avgCoursesPerStudent);
$csv_content[] = array( get_lang('AverageProgressInLearnpath'),$avgTotalProgress);
$csv_content[] = array( get_lang('AverageResultsToTheExercices'),$avgResultsToExercises);
$csv_content[] = array( get_lang('AveragePostsInForum'),$nb_posts);
$csv_content[] = array( get_lang('AverageAssignments'),$nb_assignments);
$csv_content[] = array();
}
// html part
else
{
echo ' echo '
<div class="admin_section"> <div class="admin_section">
<h4> <h4>
@ -108,7 +156,7 @@ if($isCoach)
<td> <td>
'.get_lang('InactivesStudents').' '.get_lang('InactivesStudents').'
</td> </td>
<td> <td align="right">
'.$nb_inactive_students.' '.$nb_inactive_students.'
</td> </td>
</tr> </tr>
@ -116,7 +164,7 @@ if($isCoach)
<td> <td>
'.get_lang('AverageTimeSpentOnThePlatform').' '.get_lang('AverageTimeSpentOnThePlatform').'
</td> </td>
<td> <td align="right">
'.api_time_to_hms($avgTimeSpent).' '.api_time_to_hms($avgTimeSpent).'
</td> </td>
</tr> </tr>
@ -124,7 +172,7 @@ if($isCoach)
<td> <td>
'.get_lang('AverageCoursePerStudent').' '.get_lang('AverageCoursePerStudent').'
</td> </td>
<td> <td align="right">
'.$avgCoursesPerStudent.' '.$avgCoursesPerStudent.'
</td> </td>
</tr> </tr>
@ -132,7 +180,7 @@ if($isCoach)
<td> <td>
'.get_lang('AverageProgressInLearnpath').' '.get_lang('AverageProgressInLearnpath').'
</td> </td>
<td> <td align="right">
'.round($avgTotalProgress,1).' % '.round($avgTotalProgress,1).' %
</td> </td>
</tr> </tr>
@ -140,14 +188,30 @@ if($isCoach)
<td> <td>
'.get_lang('AverageResultsToTheExercices').' '.get_lang('AverageResultsToTheExercices').'
</td> </td>
<td align="right">
'.round($avgResultsToExercises,1).' %
</td>
</tr>
<tr>
<td> <td>
'.round($avgResultsToExercises,1).' '.get_lang('AveragePostsInForum').'
</td>
<td align="right">
'.round($nb_posts,1).'
</td>
</tr>
<tr>
<td>
'.get_lang('AverageAssignments').'
</td>
<td align="right">
'.round($nb_assignments,1).'
</td> </td>
</tr> </tr>
</table> </table>
<a href="student.php">'.get_lang('SeeStudentList').'</a> <a href="student.php">'.get_lang('SeeStudentList').'</a>
</div>'; </div>';
}
/**************************************** /****************************************
@ -186,6 +250,23 @@ if($isCoach)
$a_courses = array_merge($a_courses, Tracking::get_courses_list_from_session($a_session['id'])); $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); $nb_courses_per_session = round(count($a_courses)/$nbSessions,1);
//csv part
if($export_csv)
{
$csv_content[] = array( get_lang('Sessions'));
$csv_content[] = array( get_lang('NbActiveSessions').';'.$nb_sessions_current);
$csv_content[] = array( get_lang('NbPastSessions').';'.$nb_sessions_past);
$csv_content[] = array( get_lang('NbFutureSessions').';'.$nb_sessions_future);
$csv_content[] = array( get_lang('NbStudentPerSession').';'.round($nbStudents/$nbSessions,1));
$csv_content[] = array( get_lang('NbCoursesPerSession').';'.$nb_courses_per_session);
$csv_content[] = array();
}
// html part
else
{
echo ' echo '
<div class="admin_section"> <div class="admin_section">
<h4> <h4>
@ -196,7 +277,7 @@ if($isCoach)
<td> <td>
'.get_lang('NbActiveSessions').' '.get_lang('NbActiveSessions').'
</td> </td>
<td> <td align="right">
'.$nb_sessions_current.' '.$nb_sessions_current.'
</td> </td>
</tr> </tr>
@ -204,7 +285,7 @@ if($isCoach)
<td> <td>
'.get_lang('NbPastSessions').' '.get_lang('NbPastSessions').'
</td> </td>
<td> <td align="right">
'.$nb_sessions_past.' '.$nb_sessions_past.'
</td> </td>
</tr> </tr>
@ -212,7 +293,7 @@ if($isCoach)
<td> <td>
'.get_lang('NbFutureSessions').' '.get_lang('NbFutureSessions').'
</td> </td>
<td> <td align="right">
'.$nb_sessions_future.' '.$nb_sessions_future.'
</td> </td>
</tr> </tr>
@ -220,7 +301,7 @@ if($isCoach)
<td> <td>
'.get_lang('NbStudentPerSession').' '.get_lang('NbStudentPerSession').'
</td> </td>
<td> <td align="right">
'.round($nbStudents/$nbSessions,1).' '.round($nbStudents/$nbSessions,1).'
</td> </td>
</tr> </tr>
@ -228,19 +309,20 @@ if($isCoach)
<td> <td>
'.get_lang('NbCoursesPerSession').' '.get_lang('NbCoursesPerSession').'
</td> </td>
<td> <td align="right">
'.$nb_courses_per_session.' '.$nb_courses_per_session.'
</td> </td>
</tr> </tr>
</table> </table>
<a href="student.php">'.get_lang('SeeSessionList').'</a> <a href="student.php">'.get_lang('SeeSessionList').'</a>
</div>'; </div>';
Display::display_footer();
exit;
} }
}
else
{
//Trainers //Trainers
@ -528,14 +610,21 @@ if(api_get_setting('use_session_mode')=='true'){
</h4> </h4>
</div>'; </div>';
} }
}
// send the csv file if asked
if($export_csv)
{
Export :: export_table_csv($csv_content, 'reporting_index');
}
/* /*
============================================================================== ==============================================================================
FOOTER FOOTER
============================================================================== ==============================================================================
*/ */
if(!$export_csv)
{
Display::display_footer(); Display::display_footer();
}
?> ?>

@ -8,21 +8,29 @@ $language_file = array ('registration', 'index', 'tracking', 'exercice');
$cidReset=true; $cidReset=true;
include ('../inc/global.inc.php'); include ('../inc/global.inc.php');
include_once(api_get_path(LIBRARY_PATH).'tracking.lib.php'); include_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
include_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
include_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php'); include_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
include_once(api_get_path(LIBRARY_PATH).'course.lib.php'); include_once(api_get_path(LIBRARY_PATH).'course.lib.php');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
if($export_csv)
{
ob_start();
}
$csv_content = array();
$this_section = "session_my_space"; $this_section = "session_my_space";
$nameTools=get_lang("MyStudents"); $nameTools=get_lang("StudentDetails");
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
if(isset($_GET["user_id"]) && $_GET["user_id"]!="" && !isset($_GET["type"])){ if(isset($_GET['details']))
$interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers')); {
} $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student'], "name" => get_lang("StudentDetails"));
$nameTools=get_lang("DetailsStudentInCourse");
if(isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $_GET["type"]=="coach"){
$interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors'));
} }
api_block_anonymous_users(); api_block_anonymous_users();
@ -34,90 +42,6 @@ $language_file = array ('registration', 'index', 'tracking', 'exercice');
* ====================================================================================== * ======================================================================================
*/ */
function exportCsv($a_infosUser,$tableTitle,$a_header,$a_dataLearnpath,$a_dataExercices,$a_dataProduction)
{
global $archiveDirName;
$fileName = 'test.csv';
$archivePath = api_get_path(SYS_PATH).$archiveDirName.'/';
$archiveURL = api_get_path(WEB_CODE_PATH).'course_info/download.php?archive=';
if(!$open = fopen($archivePath.$fileName,'w+'))
{
$message = get_lang('noOpen');
}
else
{
$info = '';
$info .= $a_infosUser['name'];
$info .= "\r\n";
$info .= $a_infosUser['email'];
$info .= "\r\n";
$info .= $a_infosUser['phone'];
/*$info .= "\r\n";
$info .= $a_infosUser['adresse'];*/
$info .= "\r\n";
$info .= "\r\n";
$info .= $tableTitle;
$info .= "\r\n";
for($i=0;$i<4;$i++)
{
$info .= $a_header[$i].';';
}
$info .= "\r\n";
foreach($a_dataLearnpath as $a_learnpath)
{
foreach($a_learnpath as $learnpath)
{
$info .= $learnpath.';';
}
$info .= "\r\n";
}
for($i=4;$i<8;$i++)
{
$info .= $a_header[$i].';';
}
$info .= "\r\n";
foreach($a_dataExercices as $a_exercice)
{
foreach($a_exercice as $exercice)
{
$info .= $exercice.';';
}
$info .= "\r\n";
}
for($i=8;$i<12;$i++)
{
$info .= $a_header[$i].';';
}
$info .= "\r\n";
foreach($a_dataProduction as $a_production)
{
foreach($a_production as $production)
{
$info .= $production.';';
}
$info .= "\r\n";
}
fwrite($open,$info);
fclose($open);
chmod($fileName,0777);
$message = get_lang('UsageDatacreated');
header("Location:".$archiveURL.$fileName);
}
return $message;
}
function calculHours($seconds) function calculHours($seconds)
@ -194,6 +118,13 @@ else
if(!empty($_GET['student'])) if(!empty($_GET['student']))
{ {
echo '<div align="right">
<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div>';
// is the user online ? // is the user online ?
$statistics_database = Database :: get_statistic_database(); $statistics_database = Database :: get_statistic_database();
$a_usersOnline = WhoIsOnline($_GET['student'], $statistics_database, 30); $a_usersOnline = WhoIsOnline($_GET['student'], $statistics_database, 30);
@ -231,6 +162,20 @@ if(!empty($_GET['student']))
} }
$avg_student_progress = round($avg_student_progress / $nb_courses,1); $avg_student_progress = round($avg_student_progress / $nb_courses,1);
$avg_student_score = round($avg_student_score / $nb_courses,1); $avg_student_score = round($avg_student_score / $nb_courses,1);
$last_connection_date = Tracking::get_last_connection_date($a_infosUser['user_id']);
$time_spent_on_the_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($a_infosUser['user_id']));
// cvs informations
$csv_content[] = array(get_lang('Informations'));
$csv_content[] = array(get_lang('Name'), get_lang('Email'), get_lang('Tel'));
$csv_content[] = array($a_infosUser['name'], $a_infosUser['email'],$a_infosUser['phone']);
$csv_content[] = array();
// csv tracking
$csv_content[] = array(get_lang('Tracking'));
$csv_content[] = array(get_lang('LatestLogin'), get_lang('TimeSpentOnThePlatform'), get_lang('Progress'), get_lang('Score'));
$csv_content[] = array($last_connection_date, $time_spent_on_the_platform , $avg_student_progress.' %',$avg_student_score.' %');
?> ?>
@ -329,7 +274,7 @@ if(!empty($_GET['student']))
<?php echo get_lang('LatestLogin') ?> <?php echo get_lang('LatestLogin') ?>
</td> </td>
<td class="none"> <td class="none">
<?php echo Tracking::get_last_connection_date($a_infosUser['user_id']) ?> <?php echo $last_connection_date ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -337,7 +282,7 @@ if(!empty($_GET['student']))
<?php echo get_lang('TimeSpentOnThePlatform') ?> <?php echo get_lang('TimeSpentOnThePlatform') ?>
</td> </td>
<td class="none"> <td class="none">
<?php echo api_time_to_hms(Tracking::get_time_spent_on_the_platform($a_infosUser['user_id'])) ?> <?php echo $time_spent_on_the_platform ?>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -398,18 +343,12 @@ if(!empty($_GET['student']))
</tr> </tr>
</table> </table>
<table class="data_table"> <table class="data_table">
<tr><td colspan="5" style="border-width: 0px;">&nbsp;</td></tr> <tr>
</a> <td colspan="5" style="border-width: 0px;">&nbsp;</td>
</tr>
<?php <?php
if(!empty($_GET['details'])) if(!empty($_GET['details']))
{ {
?>
<br /><br />
<div align="left">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?student=<?php echo $a_infosUser['user_id']; ?>#infosStudent"><?php echo get_lang('Back'); ?></a>
</div>
<br />
<?php
$sqlInfosCourse = " SELECT course.code, $sqlInfosCourse = " SELECT course.code,
course.title, course.title,
@ -437,6 +376,8 @@ if(!empty($_GET['student']))
$dateSession = get_lang('From').' '.$date_start.' '.get_lang('To').' '.$date_end; $dateSession = get_lang('From').' '.$date_start.' '.get_lang('To').' '.$date_end;
$tableTitle = $a_infosCours['title'].'&nbsp; | &nbsp;'.get_lang('Tutor').' : '.$a_infosCours['tutor_name']; $tableTitle = $a_infosCours['title'].'&nbsp; | &nbsp;'.get_lang('Tutor').' : '.$a_infosCours['tutor_name'];
$csv_content[] = array();
$csv_content[] = array($tableTitle);
?> ?>
<tr class="tableName"> <tr class="tableName">
@ -444,17 +385,20 @@ if(!empty($_GET['student']))
<strong><?php echo $tableTitle; ?></strong> <strong><?php echo $tableTitle; ?></strong>
</td> </td>
</tr> </tr>
<tr> <!-- line about learnpaths -->
<td>
<table class="data_table">
<tr> <tr>
<th class="head"> <th>
<?php echo get_lang('Learnpath'); ?> <?php echo get_lang('Learnpaths'); ?>
</th> </th>
<th class="head" colspan="2"> <th>
<?php echo get_lang('Time'); ?> <?php echo get_lang('Time'); ?>
</th> </th>
<th class="head"> <th>
<?php echo get_lang('Progress'); ?> <?php echo get_lang('Progress'); ?>
</th> </th>
<th class="head" colspan="2"> <th>
<?php echo get_lang('LastConnexion'); ?> <?php echo get_lang('LastConnexion'); ?>
</th> </th>
</tr> </tr>
@ -467,6 +411,9 @@ if(!empty($_GET['student']))
$resultLearnpath = api_sql_query($sqlLearnpath); $resultLearnpath = api_sql_query($sqlLearnpath);
$csv_content[] = array();
$csv_content[] = array(get_lang('Learnpath'),get_lang('Time'),get_lang('Progress'),get_lang('LastConnexion'));
if(mysql_num_rows($resultLearnpath)>0) if(mysql_num_rows($resultLearnpath)>0)
{ {
$i = 0; $i = 0;
@ -492,6 +439,29 @@ if(!empty($_GET['student']))
$progress = round(($a_nbItem['nbItem'] * 100)/$a_totalItem['totalItem']); $progress = round(($a_nbItem['nbItem'] * 100)/$a_totalItem['totalItem']);
// calculates time
$sql = 'SELECT SUM(total_time)
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' AS item_view
INNER JOIN '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' AS view
ON item_view.lp_view_id = view.id
AND view.lp_id = '.$a_learnpath['id'].'
AND view.user_id = '.$_GET['student'];
$rs = api_sql_query($sql, __FILE__, __LINE__);
$total_time = mysql_result($rs, 0, 0);
// calculates last connection time
$sql = 'SELECT MAX(start_time)
FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' AS item_view
INNER JOIN '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' AS view
ON item_view.lp_view_id = view.id
AND view.lp_id = '.$a_learnpath['id'].'
AND view.user_id = '.$_GET['student'];
$rs = api_sql_query($sql, __FILE__, __LINE__);
$start_time = mysql_result($rs, 0, 0);
if($i%2==0){ if($i%2==0){
$s_css_class="row_odd"; $s_css_class="row_odd";
} }
@ -501,19 +471,21 @@ if(!empty($_GET['student']))
$i++; $i++;
$csv_content[] = array(stripslashes($a_learnpath['name']),api_time_to_hms($total_time),$progress.' %',date('Y-m-d',$start_time));
?> ?>
<tr class="<?php echo $s_css_class;?>"> <tr class="<?php echo $s_css_class;?>">
<td> <td>
<?php echo stripslashes($a_learnpath['name']); ?> <?php echo stripslashes($a_learnpath['name']); ?>
</td> </td>
<td colspan="2"> <td align="center">
<?php echo api_time_to_hms($total_time) ?>
</td> </td>
<td align="center"> <td align="center">
<?php echo $progress.' %'; ?> <?php echo $progress.' %'; ?>
</td> </td>
<td colspan="2"> <td align="center">
<?php echo date('Y-m-d',$start_time) ?>
</td> </td>
</tr> </tr>
@ -535,28 +507,29 @@ if(!empty($_GET['student']))
"; ";
} }
?> ?>
</table>
</td>
</tr>
<tr> <!-- line about exercises -->
<td>
<table class="data_table">
<tr> <tr>
<th class="head"> <th>
<?php echo get_lang('Exercices'); ?> <?php echo get_lang('Exercices'); ?>
</th> </th>
<th class="head"> <th>
<?php echo get_lang('Score') ?> <?php echo get_lang('Score') ?>
</th> </th>
<th class="head"> <th>
<?php echo get_lang('Details'); ?>
</th>
<th class="head">
<?php echo get_lang('Attempts'); ?> <?php echo get_lang('Attempts'); ?>
</th> </th>
<th class="head"> <th>
<?php echo get_lang('Correction'); ?>
</th>
<th class="head">
<?php echo get_lang('CorrectTest'); ?> <?php echo get_lang('CorrectTest'); ?>
</th> </th>
</tr> </tr>
<?php <?php
$a_headerExercices = array(get_lang('Exercices'),get_lang('Score'),get_lang('Attempts'),get_lang('Correction')); $csv_content[] = array();
$csv_content[] = array(get_lang('Exercices'),get_lang('Score'),get_lang('Attempts'));
$sqlExercices = " SELECT quiz.title,id $sqlExercices = " SELECT quiz.title,id
FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz FROM ".$a_infosCours['db_name'].".".$tbl_course_quiz." AS quiz
"; ";
@ -575,11 +548,12 @@ if(!empty($_GET['student']))
$resultEssais = api_sql_query($sqlEssais); $resultEssais = api_sql_query($sqlEssais);
$a_essais = mysql_fetch_array($resultEssais); $a_essais = mysql_fetch_array($resultEssais);
$sqlScore = "SELECT exe_result,exe_weighting $sqlScore = "SELECT exe_id, exe_result,exe_weighting
FROM $tbl_stats_exercices FROM $tbl_stats_exercices
WHERE exe_user_id = ".$_GET['student']." WHERE exe_user_id = ".$_GET['student']."
AND exe_cours_id = '".$a_infosCours['code']."' AND exe_cours_id = '".$a_infosCours['code']."'
AND exe_exo_id = ".$a_exercices['id'] AND exe_exo_id = ".$a_exercices['id']."
ORDER BY exe_date DESC LIMIT 1"
; ;
$resultScore = api_sql_query($sqlScore); $resultScore = api_sql_query($sqlScore);
@ -588,11 +562,14 @@ if(!empty($_GET['student']))
{ {
$score = $score + $a_score['exe_result']; $score = $score + $a_score['exe_result'];
$weighting = $weighting + $a_score['exe_weighting']; $weighting = $weighting + $a_score['exe_weighting'];
$exe_id = $a_score['exe_id'];
} }
$pourcentageScore = round(($score*100)/$weighting); $pourcentageScore = round(($score*100)/$weighting);
$weighting = 0; $weighting = 0;
$csv_content[] = array($a_exercices['title'], $pourcentageScore.' %', $a_essais['essais']);
if($i%2==0){ if($i%2==0){
$s_css_class="row_odd"; $s_css_class="row_odd";
} }
@ -611,21 +588,14 @@ if(!empty($_GET['student']))
echo " <td align='center'> echo " <td align='center'>
"; ";
echo $pourcentageScore.' %'; echo $pourcentageScore.' %';
echo " </td>
<td align='center'>
";
echo "<a href='".$_SERVER['PHP_SELF']."?student=".$_GET['student']."&details=true&course=".$_GET['course']."&exe_id=".$a_exercices['id']."#infosExe'> -> </a>";
echo " </td> echo " </td>
<td align='center'> <td align='center'>
"; ";
echo $a_essais['essais']; echo $a_essais['essais'];
echo " </td>
<td>
";
echo " </td> echo " </td>
<td align='center'> <td align='center'>
"; ";
echo "<a href=''> -> </a>"; echo '<a href="../exercice/exercise_show.php?id='.$exe_id.'&cidReq='.$a_infosCours['code'].'"> <img src="'.api_get_path(WEB_IMG_PATH).'quiz.gif" border="0"> </a>';
echo " </td> echo " </td>
</tr> </tr>
"; ";
@ -649,114 +619,67 @@ if(!empty($_GET['student']))
} }
?> ?>
<tr> </table>
<th class="head"> </td>
<?php echo get_lang('Productions'); ?>
</th>
<th class="head" colspan="2">
<?php echo get_lang('LimitDate'); ?>
</th>
<th class="head">
<?php echo get_lang('SentDate'); ?>
</th>
<th class="head">
<?php echo get_lang('Comments'); ?>
</th>
<th class="head">
<?php echo get_lang('Annotate'); ?>
</th>
</tr> </tr>
<tr><!-- line about other tools -->
<td>
<table class="data_table">
<?php <?php
$csv_content[] = array();
$a_headerProductions = array(get_lang('Productions'),get_lang('LimitDate'),get_lang('SentDate'),get_lang('Comments')); $nb_assignments = Tracking :: count_student_assignments($a_infosUser['user_id'], $a_infosCours['code']);
$sqlProduction = " SELECT title,sent_date $messages = Tracking :: count_student_messages($a_infosUser['user_id'], $a_infosCours['code']);
FROM ".$a_infosCours['db_name'].".".$course_student_publication." $links = Tracking :: count_student_visited_links($a_infosUser['user_id'], $a_infosCours['code']);
"; $documents = Tracking :: count_student_downloaded_documents($a_infosUser['user_id'], $a_infosCours['code']);
$resultProduction = api_sql_query($sqlProduction);
if(mysql_num_rows($resultProduction)>0)
{
$i = 0;
while($a_production = mysql_fetch_array($resultProduction))
{
//$tmp_limitDate = $newDate = mktime(0 , 0 , 0 , date("m") , date("d") , date("Y"));
$tmp_limitDate = $newDate = mktime(0 , 0 , 0 ,8 , 20 , 2006);
$a_sentDate = explode(' ',$a_production['sent_date']);
$a_sentDate = explode('-',$a_sentDate[0]);
$tmp_sentDate = mktime(0,0,0,$a_sentDate[1],$a_sentDate[2],$a_sentDate[0]);
$sentDate = $a_sentDate[2].'/'.$a_sentDate[1].'/'.$a_sentDate[0];
if($i%2==0){
$s_css_class="row_odd";
}
else{
$s_css_class="row_even";
}
$i++;
echo "<tr class='$s_css_class'> $csv_content[] = array(get_lang('Student_publication'), $nb_assignments);
$csv_content[] = array(get_lang('Messages'), $messages);
$csv_content[] = array(get_lang('LinksDetails'), $links);
$csv_content[] = array(get_lang('DocumentsDetails'), $documents);
?>
<tr>
<th colspan="2">
<?php echo get_lang('OtherTools'); ?>
</th>
</tr>
<tr><!-- assignments -->
<td width="40%">
<?php echo get_lang('Student_publication') ?>
</td>
<td> <td>
"; <?php echo $nb_assignments ?>
echo $a_production['title']; </td>
echo " </td>
";
echo " <td align='center' colspan='2'>
";
echo " </td>
";
if($tmp_sentDate > $tmp_limitDate)
{
echo "<td align='center' class='redText'>";
$tmp_retard = $tmp_sentDate - $tmp_limitDate;
$retard = round($tmp_retard/86400);
echo $retard.' '.get_lang('DayOfDelay');
echo "</td>";
}
else
{
echo "<td align='center'>";
echo $sentDate;
echo "</td>";
}
echo " <td align='center'>
";
$remarque = '';
if($remarque == '')
{
echo "--";
}
echo " </td>
<td align='center'>
";
echo "<a href=''> -> </a>";
echo " </td>
</tr> </tr>
"; <tr><!-- messages -->
<td>
$dataProduction[$i][] = $a_production['title']; <?php echo get_lang('Messages') ?>
//$dataProduction[$i][] = $a_production['sent_date']; </td>
$dataProduction[$i][] = $a_production['sent_date']; <td>
//$dataProduction[$i][] = remarques; <?php echo $messages ?>
$i++;
}
}
else
{
echo " <tr>
<td colspan='6'>
".get_lang('NoProduction')."
</td> </td>
</tr> </tr>
"; <tr><!-- links -->
} <td>
<?php echo get_lang('LinksDetails') ?>
</td>
<td>
<?php echo $links ?>
</td>
</tr>
<tr><!-- documents -->
<td>
<?php echo get_lang('DocumentsDetails') ?>
</td>
<td>
<?php echo $documents ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
} }
else else
{ {
@ -781,28 +704,34 @@ if(!empty($_GET['student']))
<?php <?php
if(count($a_courses)>0) if(count($a_courses)>0)
{ {
$csv_content[] = array();
$csv_content[] = array(get_lang('Course'),get_lang('Time'),get_lang('Progress'),get_lang('Score'));
foreach($a_courses as $course_code) foreach($a_courses as $course_code)
{ {
$course_infos = CourseManager :: get_course_information($course_code); $course_infos = CourseManager :: get_course_information($course_code);
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($a_infosUser['user_id'], $course_code));
$progress = Tracking :: get_avg_student_progress($a_infosUser['user_id'], $course_code).' %';
$score = Tracking :: get_avg_student_score($a_infosUser['user_id'], $course_code).' %';
$csv_content[] = array($course_infos['title'], $time_spent_on_course, $progress, $score);
echo ' echo '
<tr> <tr>
<td> <td align="right">
'.$course_infos['title'].' '.$course_infos['title'].'
</td> </td>
<td> <td align="right">
'.api_time_to_hms(Tracking :: get_time_spent_on_the_course($a_infosUser['user_id'], $course_code)).' '.$time_spent_on_course.'
</td> </td>
<td> <td align="right">
'.Tracking :: get_avg_student_progress($a_infosUser['user_id'], $course_code).' % '.$progress.'
</td> </td>
<td> <td align="right">
'.Tracking :: get_avg_student_score($a_infosUser['user_id'], $course_code).' % '.$score.'
</td> </td>
<td> <td align="center" width="10">
<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'#infosStudent"> -> </a> <a href="'.$_SERVER['PHP_SELF'].'?student='.$a_infosUser['user_id'].'&details=true&course='.$course_infos['code'].'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>
</td> </td>
</tr>
'; ';
} }
} }
@ -903,12 +832,13 @@ if(!empty($_GET['student']))
} }
$a_header = array_merge($a_headerLearnpath,$a_headerExercices,$a_headerProductions); $a_header = array_merge($a_headerLearnpath,$a_headerExercices,$a_headerProductions);
if($_GET['csv'] == "true")
{
$exportResult = exportCsv($a_infosUser,$tableTitle,$a_header,$dataLearnpath,$dataExercices,$dataProduction);
Display :: display_error_message($exportResult);
} }
if($export_csv)
{
ob_end_clean();
Export :: export_table_csv($csv_content, 'reporting_student');
} }
/* /*

@ -2,17 +2,24 @@
/* /*
* Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
*/ */
ob_start();
// name of the language file that needs to be included // name of the language file that needs to be included
$language_file = array ('registration', 'index', 'tracking'); $language_file = array ('registration', 'index', 'tracking');
$cidReset=true; $cidReset=true;
require ('../inc/global.inc.php'); require ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php'); require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php');
require_once (api_get_path(LIBRARY_PATH).'export.lib.inc.php');
require_once (api_get_path(LIBRARY_PATH).'course.lib.php'); require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php'); require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
if($export_csv)
{
ob_start();
}
$csv_content = array();
$nameTools= get_lang("Students"); $nameTools= get_lang("Students");
$this_section = "session_my_space"; $this_section = "session_my_space";
@ -29,6 +36,7 @@ $language_file = array ('registration', 'index', 'tracking');
$interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors')); $interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors'));
} }
Display :: display_header($nameTools); Display :: display_header($nameTools);
// Database Table Definitions // Database Table Definitions
@ -46,225 +54,20 @@ $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
=============================================================================== ===============================================================================
*/ */
function exportCsv($a_header,$a_data) function count_student_coached()
{
global $archiveDirName;
$fileName = 'students.csv';
$archivePath = api_get_path(SYS_PATH).$archiveDirName.'/';
$archiveURL = api_get_path(WEB_CODE_PATH).'course_info/download.php?archive=';
if(!$open = fopen($archivePath.$fileName,'w+'))
{
$message = get_lang('noOpen');
}
else
{
$info = '';
foreach($a_header as $header)
{ {
$info .= $header.';'; global $a_students;
return count($a_students);
} }
$info .= "\r\n";
foreach($a_data as $data) function sort_users($a, $b)
{ {
foreach($data as $infos) global $tracking_column;
{ if($a[$tracking_column] > $b[$tracking_column])
$info .= $infos.';';
}
$info .= "\r\n";
}
fwrite($open,$info);
fclose($open);
chmod($fileName,0777);
header("Location:".$archiveURL.$fileName);
}
return $message;
}
/**
* Returns an array of students of courses (who belong to no sessions) which in the given user is a teacher
* @param int teacher_id The id of the teacher
*/
function getStudentsFromCoursesNoSession($i_teacher_id, $a_students){
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
//$sql_select_courses="SELECT course_rel_user.course_code, src.course_code as test FROM $tbl_course_user as course_rel_user LEFT OUTER JOIN $tbl_session_course as src ON course_rel_user.course_code=src.course_code WHERE user_id='$i_teacher_id' AND status='1' AND src.course_code IS NULL";
$sql_select_courses="SELECT course_rel_user.course_code FROM $tbl_course_user as course_rel_user WHERE user_id='$i_teacher_id' AND status='1'";
$result_courses=api_sql_query($sql_select_courses);
while($a_courses=mysql_fetch_array($result_courses)){
$s_course_code=$a_courses["course_code"];
$sqlStudents = "SELECT user.user_id,lastname,firstname,email FROM $tbl_course_user as course_rel_user, $tbl_user as user WHERE course_rel_user.user_id=user.user_id AND course_rel_user.status='5' AND course_rel_user.course_code='$s_course_code'";
$result_students=api_sql_query($sqlStudents);
if(mysql_num_rows($result_students)>0){
while($a_students_temp=mysql_fetch_array($result_students)){
$a_current_student=array();
//If the user has already been added to the table
if(!array_key_exists($a_students,$a_students_temp["user_id"])){
$a_current_student[]=$a_students_temp["user_id"];
$a_current_student[]=$a_students_temp["lastname"];
$a_current_student[]=$a_students_temp["firstname"];
$a_current_student[]=$a_students_temp["email"];
$a_students[$a_students_temp["user_id"]]=$a_current_student;
$a_students[$a_students_temp["user_id"]]["teacher"]=true;
}
}
}
}
return $a_students;
}
/**
* Returns an array of students of courses (who belong to at least one session) which in the given user is a teacher
* @param int teacher_id The id of the teacher
*/
function getStudentsFromCoursesFromSessions($i_teacher_id, $a_students){
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$sql_select_courses="SELECT course_rel_user.course_code FROM $tbl_course_user as course_rel_user, $tbl_session_course as session_rel_course WHERE user_id='$i_teacher_id' AND status='1' AND session_rel_course.course_code=course_rel_user.course_code";
$result_courses=api_sql_query($sql_select_courses);
while($a_courses=mysql_fetch_array($result_courses)){
$s_course_code=$a_courses["course_code"];
$sqlStudents = "SELECT DISTINCT user.user_id,lastname,firstname,email FROM $tbl_session_course_user as srcru, $tbl_user as user WHERE srcru.id_user=user.user_id AND srcru.course_code='$s_course_code'";
$result_students=api_sql_query($sqlStudents);
if(mysql_num_rows($result_students)>0){
while($a_students_temp=mysql_fetch_array($result_students)){
$a_current_student=array();
//If the user has already been added to the table
if(!array_key_exists($a_students,$a_students_temp["user_id"])){
$a_current_student[]=$a_students_temp["user_id"];
$a_current_student[]=$a_students_temp["lastname"];
$a_current_student[]=$a_students_temp["firstname"];
$a_current_student[]=$a_students_temp["email"];
$a_students[$a_students_temp["user_id"]]=$a_current_student;
$a_students[$a_students_temp["user_id"]]["teacher"]=true;
}
}
}
}
return $a_students;
}
/**
* Returns an array of students of courses which in the given user is a coach
* @param int coach_id The id of the coach
*/
function getStudentsFromCoursesFromSessionsCoach($i_coach_id, $a_students){
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$sql_select_courses="SELECT course_code, id_session FROM $tbl_session_course as session_rel_course WHERE session_rel_course.id_coach='$i_coach_id'";
$result_courses=api_sql_query($sql_select_courses);
while($a_courses=mysql_fetch_array($result_courses)){
$s_course_code=$a_courses["course_code"];
$i_id_session=$a_courses["id_session"];
$sqlStudents="SELECT user.user_id,lastname,firstname,email
FROM $tbl_session_course_user as srcru, $tbl_user as user
WHERE srcru.course_code='$s_course_code' AND srcru.id_session='$i_id_session' AND srcru.id_user=user.user_id
";
$result_students=api_sql_query($sqlStudents);
if(mysql_num_rows($result_students)>0){
while($a_students_temp=mysql_fetch_array($result_students)){
$a_current_student=array();
//If the user has already been added to the table
if(!array_key_exists($a_students,$a_students_temp["user_id"])){
$a_current_student[]=$a_students_temp["user_id"];
$a_current_student[]=$a_students_temp["lastname"];
$a_current_student[]=$a_students_temp["firstname"];
$a_current_student[]=$a_students_temp["email"];
$a_students[$a_students_temp["user_id"]]=$a_current_student;
$a_students[$a_students_temp["user_id"]]["teacher"]=false;
}
}
}
}
return $a_students;
}
function mysort($a , $b){
if($a[1]>$b[1]){
return 1; return 1;
} else
else if($b[1]>$a[1]){
return -1; return -1;
} }
else {
return 0;
}
}
function count_student_coached()
{
global $a_students;
return count($a_students);
}
/* /*
=============================================================================== ===============================================================================
@ -272,24 +75,45 @@ function count_student_coached()
=============================================================================== ===============================================================================
*/ */
echo '<div align="right">
<a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
<a href="'.$_SERVER['PHP_SELF'].'?export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
</div>';
$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); $a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
$a_students = Tracking :: get_student_followed_by_coach($_user['user_id']); $a_students = Tracking :: get_student_followed_by_coach($_user['user_id']);
$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : 0;
$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC;
if(count($a_students)>0) if(count($a_students)>0)
{ {
$table = new SortableTable('tracking', 'count_student_coached'); $table = new SortableTable('tracking', 'count_student_coached');
$table -> set_header(0, get_lang('Name'),false); $table -> set_header(0, get_lang('LastName'));
$table -> set_header(1, get_lang('Time'),false); $table -> set_header(1, get_lang('FirstName'));
$table -> set_header(2, get_lang('Progress'),false); $table -> set_header(2, get_lang('Time'),false);
$table -> set_header(3, get_lang('Score'),false); $table -> set_header(3, get_lang('Progress'),false);
$table -> set_header(4, get_lang('Student_publication'),false); $table -> set_header(4, get_lang('Score'),false);
$table -> set_header(5, get_lang('Messages'),false); $table -> set_header(5, get_lang('Student_publication'),false);
$table -> set_header(6, get_lang('LatestLogin'),false); $table -> set_header(6, get_lang('Messages'),false);
$table -> set_header(7, get_lang('Details'),false); $table -> set_header(7, get_lang('LatestLogin'),false);
$table -> set_header(8, get_lang('Details'),false);
if($export_csv)
{
$csv_content[] = array (
get_lang('LastName'),
get_lang('FirstName'),
get_lang('Time'),
get_lang('Progress'),
get_lang('Score'),
get_lang('Student_publication'),
get_lang('Messages'),
get_lang('LatestLogin')
);
}
$all_datas = array();
foreach($a_students as $student_id) foreach($a_students as $student_id)
{ {
$student_datas = UserManager :: get_user_info_by_id($student_id); $student_datas = UserManager :: get_user_info_by_id($student_id);
@ -313,182 +137,56 @@ if(count($a_students)>0)
$avg_student_progress = $avg_student_progress / $nb_courses_student; $avg_student_progress = $avg_student_progress / $nb_courses_student;
$row = array(); $row = array();
$row[] = $student_datas['firstname'].' '.$student_datas['lastname']; $row[] = $student_datas['lastname'];
$row[] = $student_datas['firstname'];
$row[] = api_time_to_hms($avg_time_spent); $row[] = api_time_to_hms($avg_time_spent);
$row[] = $avg_student_progress.' %'; $row[] = $avg_student_progress.' %';
$row[] = $avg_student_score.' %'; $row[] = $avg_student_score.' %';
$row[] = $total_assignments; $row[] = $total_assignments;
$row[] = $total_messages; $row[] = $total_messages;
$row[] = Tracking :: get_last_connection_date($student_id); $row[] = Tracking :: get_last_connection_date($student_id);
$row[] = '<a href="myStudents.php?student='.$student_id.'">-></a>';
$table -> addRow($row); if($export_csv)
}
$table -> display();
echo '</table>';
}
else
{ {
echo get_lang('NoStudent'); $csv_content[] = $row;
} }
exit;
$a_students=array(); $row[] = '<a href="myStudents.php?student='.$student_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
//La personne est admin $all_datas[] = $row;
if(api_is_platform_admin() && !isset($_GET["user_id"])){
$sqlStudent = " SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE status = '5'
ORDER BY lastname ASC
";
$resultStudent = api_sql_query($sqlStudent);
while($a_students_temp=mysql_fetch_array($resultStudent)){
$a_current_student=array();
//If the user has already been added to the table
$a_current_student[]=$a_students_temp["user_id"];
$a_current_student[]=$a_students_temp["lastname"];
$a_current_student[]=$a_students_temp["firstname"];
$a_current_student[]=$a_students_temp["email"];
$a_students[$a_students_temp["user_id"]]=$a_current_student;
$a_students[$a_students_temp["user_id"]]["teacher"]=true;
}
}
elseif(api_is_platform_admin() && isset($_GET["user_id"])){
$sqlStudent = " SELECT user_id,lastname,firstname,email
FROM $tbl_user
WHERE user_id='".$_GET["user_id"]."'
ORDER BY lastname ASC
";
$resultStudent = api_sql_query($sqlStudent);
$a_current_student[]=mysql_result($resultStudent,0,"user_id");
$a_current_student[]=mysql_result($resultStudent,0,"lastname");
$a_current_student[]=mysql_result($resultStudent,0,"firstname");
$a_current_student[]=mysql_result($resultStudent,0,"email");
$a_students[$_GET["user_id"]]=$a_current_student;
$a_students[$_GET["user_id"]]["teacher"]=true;
}
else{
if(isset($_GET["user_id"])){
//It's a teacher
if(!isset($_GET["type"])){
$a_students=getStudentsFromCoursesNoSession($_GET["user_id"], $a_students);
$a_students=getStudentsFromCoursesFromSessions($_GET["user_id"], $a_students);
}
//It's a coach
else{
$a_students=getStudentsFromCoursesFromSessionsCoach($_user['user_id'], $a_students);
}
}
else{
$a_students=getStudentsFromCoursesNoSession($_user['user_id'], $a_students);
$a_students=getStudentsFromCoursesFromSessions($_user['user_id'], $a_students);
$a_students=getStudentsFromCoursesFromSessionsCoach($_user['user_id'], $a_students);
} }
usort($all_datas, 'sort_users');
if($tracking_direction == 'ASC')
rsort($all_datas);
if($export_csv)
{
usort($csv_content, 'sort_users');
} }
usort($a_students,"mysort"); foreach($all_datas as $row)
{
$table -> addRow($row,'align="right"');
if(isset($_POST['export'])){
exportCsv($a_header,$a_data);
} }
echo "<br /><br />"; $table -> display();
echo "<form method='post' action='student.php'>
<input type='submit' name='export' value='".get_lang('exportExcel')."'/>
<form>";
if(!empty($_GET['student']))
{
$sqlSessionSuivie = " SELECT session.name
FROM $tbl_session as session
INNER JOIN $tbl_session_rel_user as relUser
ON session.id = relUser.id_session
AND relUser.id_user = ".$_GET['student']
;
$resultSessionSuivie = api_sql_query($sqlSessionSuivie);
echo "<br /><br />";
echo "<a name='sessionSuivie'></a>";
if(mysql_num_rows($resultSessionSuivie)>0)
{
echo "<table class='data_table'>
<tr class='tableName'>
<td colspan='2'>
<strong>".get_lang('TakenSessions')."</strong>
</td>
</tr>
<tr>
<th>
".get_lang('Session')."
</th>
<th>
".get_lang('FollowUp')."
</th>
</tr>
";
while($a_sessionSuivie = mysql_fetch_array($resultSessionSuivie))
{
echo "<tr>
<td>
".$a_sessionSuivie['name']."
</td>
<td align='center'>
<a href='../../myStudents.php?student=".$_GET['student']."#infosStudent'> -> </a>
</td>
</tr>
";
}
echo "</table>";
} }
else else
{ {
echo "<h4>".get_lang('TakenSessions')."</h4><br />"; echo get_lang('NoStudent');
echo get_lang('NoSession');
} }
// send the csv file if asked
if($export_csv)
{
ob_end_clean();
Export :: export_table_csv($csv_content, 'reporting_student_list');
} }
/* /*
============================================================================== ==============================================================================
FOOTER FOOTER

Loading…
Cancel
Save