api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']); $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$_GET['course'], "name" => get_lang("Users")); } else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') { $course_infos = CourseManager :: get_course_information($_GET['course']); if(empty($cidReq)) $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']); $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$_GET['course'].'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking")); } else { $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){ $interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents")); $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student'].'&id_coach='.$_GET['id_coach'], "name" => get_lang("StudentDetails")); } else{ $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student'], "name" => get_lang("StudentDetails")); } } $nameTools=get_lang("DetailsStudentInCourse"); } else { $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){ if(isset($_GET['id_session']) && intval($_GET['id_session'])!=0){ $interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach']."&id_session=".$_GET['id_session'], "name" => get_lang("CoachStudents")); } else{ $interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents")); } } else{ $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); } } api_block_anonymous_users(); if(empty($_SESSION['is_allowedCreateCourse']) && !api_is_coach() && $_user['status']!=DRH && $_user['status']!=SESSIONADMIN){ api_not_allowed(true); } Display :: display_header($nameTools); /* * ====================================================================================== * FUNCTIONS * ====================================================================================== */ function calculHours($seconds) { //How many hours ? $hours = floor($seconds / 3600); //How many minutes ? $min = floor(($seconds - ($hours * 3600)) / 60); if ($min < 10) $min = "0".$min; //How many seconds $sec = $seconds - ($hours * 3600) - ($min * 60); if ($sec < 10) $sec = "0".$sec; return $hours."h".$min."m".$sec."s" ; } function is_teacher($course_code){ global $_user; $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $sql="SELECT 1 FROM $tbl_course_user WHERE user_id='".$_user["user_id"]."' AND course_code='".$course_code."' AND status='1'"; $result=api_sql_query($sql); if(mysql_result($result)!=1){ return true; } else{ return false; } } /* *=============================================================================== * MAIN CODE *=============================================================================== */ // Database Table Definitions $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $tbl_stats_exercices_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); //$tbl_course_lp_view = Database :: get_course_table('lp_view'); //$tbl_course_lp_view_item = Database :: get_course_table('lp_item_view'); //$tbl_course_lp_item = Database :: get_course_table('lp_item'); $tbl_course_lp_view = 'lp_view'; $tbl_course_lp_view_item = 'lp_item_view'; $tbl_course_lp_item = 'lp_item'; $tbl_course_lp = 'lp'; $tbl_course_quiz = 'quiz'; $course_quiz_question = 'quiz_question'; $course_quiz_rel_question = 'quiz_rel_question'; $course_quiz_answer = 'quiz_answer'; $course_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION); if(isset($_GET["user_id"]) && $_GET["user_id"]!="") { $i_user_id=$_GET["user_id"]; } else { $i_user_id = $_user['user_id']; } if(!empty($_GET['student'])) { $student_id = intval($_GET['student']); // infos about user $a_infosUser = UserManager::get_user_info_by_id($student_id); if($_user['status']==DRH && $a_infosUser['hr_dept_id']!=$_user['user_id']) { api_not_allowed(); } $a_infosUser['name'] = $a_infosUser['firstname'].' '.$a_infosUser['lastname']; echo '
 '.get_lang('Print').'  '.get_lang('ExportAsCSV').'
'; // is the user online ? $statistics_database = Database :: get_statistic_database(); $a_usersOnline = WhoIsOnline($_GET['student'], $statistics_database, 30); foreach($a_usersOnline as $a_online) { if(in_array($_GET['student'],$a_online)) { $online = get_lang('Yes'); break; } else { $online = get_lang('No'); } } $avg_student_progress = $avg_student_score = $nb_courses = 0; $sql = 'SELECT course_code FROM '.$tbl_course_user.' WHERE user_id='.$a_infosUser['user_id']; $rs = api_sql_query($sql, __FILE__, __LINE__); $a_courses = array(); while($row = Database :: fetch_array($rs)) { $a_courses[$row['course_code']] = $row['course_code']; } // get the list of sessions where the user is subscribed as student $sql = 'SELECT DISTINCT course_code FROM '.Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' WHERE id_user='.intval($a_infosUser['user_id']); $rs = api_sql_query($sql, __FILE__, __LINE__); while($row = Database :: fetch_array($rs)) { $a_courses[$row['course_code']] = $row['course_code']; } foreach ($a_courses as $key=>$course_code) { if(!CourseManager::is_user_subscribed_in_course($a_infosUser['user_id'], $course_code, true)) { unset($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); } } $avg_student_progress = round($avg_student_progress / $nb_courses,2); $avg_student_score = round($avg_student_score / $nb_courses,2); $first_connection_date = Tracking::get_first_connection_date($a_infosUser['user_id']); if($first_connection_date==''){ $first_connection_date=get_lang('NoConnexion'); } $last_connection_date = Tracking::get_last_connection_date($a_infosUser['user_id'],true); if($last_connection_date==''){ $last_connection_date=get_lang('NoConnexion'); } $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('FirstLogin'),get_lang('LatestLogin'), get_lang('TimeSpentOnThePlatform'), get_lang('Progress'), get_lang('Score')); $csv_content[] = array(strip_tags($first_connection_date),strip_tags($last_connection_date), $time_spent_on_the_platform , $avg_student_progress.' %',$avg_student_score.' %'); ?>
'; echo ''; echo ''; ?>
'.$a_infosUser['email'].''; } else { echo get_lang('NoEmail'); } ?>
"; echo ' '.$sendMail; echo ""; } else { echo ""; } ?>
0) { // get session name and coach of the session $sql = 'SELECT name, id_coach FROM '.$tbl_session.' WHERE id='.$le_session_id; $rs = api_sql_query($sql,__FILE__,__LINE__); $session_name = mysql_result($rs,0,'name'); $session_coach_id = intval(mysql_result($rs,0,'id_coach')); // get coach of the course in the session $sql = 'SELECT id_coach FROM '.$tbl_session_course.' WHERE id_session='.$le_session_id.' AND course_code = "'.Database::escape_string($_GET['course']).'"'; $rs = api_sql_query($sql,__FILE__,__LINE__); $session_course_coach_id = intval(mysql_result($rs,0,0)); if($session_course_coach_id!=0) { $coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id); $a_infosCours['tutor_name'] = $coach_infos['firstname'].' '.$coach_infos['lastname']; } else if($session_coach_id!=0) { $coach_infos = UserManager :: get_user_info_by_id($session_coach_id); $a_infosCours['tutor_name'] = $coach_infos['firstname'].' '.$coach_infos['lastname']; } } } // end if(api_get_setting('use_session_mode')=='true') $a_date_start = explode('-',$a_infosCours['date_start']); $date_start = $a_date_start[2].'/'.$a_date_start[1].'/'.$a_date_start[0]; $a_date_end = explode('-',$a_infosCours['date_end']); $date_end = $a_date_end[2].'/'.$a_date_end[1].'/'.$a_date_end[0]; $dateSession = get_lang('From').' '.$date_start.' '.get_lang('To').' '.$date_end; $nb_login = Tracking :: count_login_per_student($a_infosUser['user_id'], $_GET['course']); $tableTitle = $a_infosCours['title'].' | '.get_lang('CountToolAccess').' : '.$nb_login.'  |  '.get_lang('Tutor').' : '.stripslashes($a_infosCours['tutor_name']).((!empty($session_name)) ? ' | '.get_lang('Session').' : '.$session_name : ''); $csv_content[] = array(); $csv_content[] = array(str_replace(' ','',$tableTitle)); ?>
 
0) { $i = 0; while($a_learnpath = Database::fetch_array($resultLearnpath)) { $any_result = false; $progress = learnpath :: get_db_progress($a_learnpath['id'],$student_id, '%',$a_infosCours['db_name'],true); if($progress === null) { $progress = '0%'; } else { $any_result = true; } // 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 = '.intval($_GET['student']); $rs = api_sql_query($sql, __FILE__, __LINE__); $total_time = 0; if(Database::num_rows($rs)>0) { $total_time = Database::result($rs, 0, 0); if($total_time>0) $any_result = true; } // 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 = '.intval($_GET['student']); $rs = api_sql_query($sql, __FILE__, __LINE__); $start_time = null; if(Database::num_rows($rs)>0) { $start_time = Database::result($rs, 0, 0); if($start_time > 0) $any_result = true; } //QUIZZ IN LP $sql = 'SELECT id as item_id, max_score FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item WHERE lp_id='.$a_learnpath['id'].' AND item_type="quiz"'; $rsItems = api_sql_query($sql, __FILE__, __LINE__); //We get the last view id of this LP $sql='SELECT max(id) as id FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' WHERE lp_id='.$a_learnpath['id'].' AND user_id="'.intval($_GET['student']).'"'; $rs_last_lp_view_id = api_sql_query($sql, __FILE__, __LINE__); $lp_view_id = 0; if(Database::num_rows($rs_last_lp_view_id)>0) { $lp_view_id = Database::result($rs_last_lp_view_id,0,'id'); if($lp_view_id > 0) $any_result = true; } $total_score = $total_weighting = 0; if($lp_view_id) { while($item = Database :: fetch_array($rsItems, 'ASSOC')) { $sql = 'SELECT score as student_score FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' as lp_view_item WHERE lp_view_item.lp_item_id = '.$item['item_id'].' AND lp_view_id = "'.$lp_view_id.'"'; $rsScores = api_sql_query($sql, __FILE__, __LINE__); $total_score += mysql_result($rsScores, 0, 0); $total_weighting += $item['max_score']; } $any_result = true; } $sql = 'SELECT id, max_score FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_item.' AS lp_item WHERE lp_id='.$a_learnpath['id'].' AND item_type="sco" LIMIT 1'; $rs_lp_item_id_scorm = api_sql_query($sql, __FILE__, __LINE__); if(Database::num_rows($rs_lp_item_id_scorm)>0){ $lp_item_id = Database::result($rs_lp_item_id_scorm,0,'id'); $lp_item__max_score = Database::result($rs_lp_item_id_scorm,0,'max_score'); $total_weighting+=$lp_item__max_score; //We get the last view id of this LP $sql='SELECT max(id) as id FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view.' WHERE lp_id='.$a_learnpath['id'].' AND user_id="'.intval($_GET['student']).'"'; $rs_last_lp_view_id = api_sql_query($sql, __FILE__, __LINE__); $lp_view_id = Database::result($rs_last_lp_view_id,0,'id'); $sql='SELECT SUM(score)/count(lp_item_id) as score FROM '.$a_infosCours['db_name'].'.'.$tbl_course_lp_view_item.' WHERE lp_view_id="'.$lp_view_id.'" GROUP BY lp_view_id'; $rs_score = api_sql_query($sql, __FILE__, __LINE__); if(Database::num_rows($rs_score)>0) { $lp_scorm_score = Database::result($rs_score,0,'score'); $total_score+=$lp_scorm_score; $any_result = true; } } $score = 0; if($total_weighting != 0) { $score = round($total_score / $total_weighting * 100,2); } if($i%2==0){ $s_css_class="row_odd"; } else{ $s_css_class="row_even"; } $i++; $csv_content[] = array(stripslashes($a_learnpath['name']),api_time_to_hms($total_time),$score.'%',$progress,date('Y-m-d',$start_time)); ?> "; } ?>
0 ? $score.'%' : '-' ?> 0) echo format_locale_date(get_lang('DateFormatLongWithoutDay'),$start_time); else echo '-'; ?>
".get_lang('NoLearnpath')."
0) { while($a_exercices = mysql_fetch_array($resultExercices)) { $sqlEssais = " SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercices AS ex WHERE ex.exe_cours_id = '".$a_infosCours['code']."' AND ex.exe_exo_id = ".$a_exercices['id']." AND exe_user_id='".$_GET["student"]."'" ; $resultEssais = api_sql_query($sqlEssais); $a_essais = mysql_fetch_array($resultEssais); $sqlScore = "SELECT exe_id, exe_result,exe_weighting FROM $tbl_stats_exercices WHERE exe_user_id = ".$_GET['student']." AND exe_cours_id = '".$a_infosCours['code']."' AND exe_exo_id = ".$a_exercices['id']." ORDER BY exe_date DESC LIMIT 1"; $resultScore = api_sql_query($sqlScore); $score = 0; while($a_score = mysql_fetch_array($resultScore)) { $score = $score + $a_score['exe_result']; $weighting = $weighting + $a_score['exe_weighting']; $exe_id = $a_score['exe_id']; } $pourcentageScore = 0; if($weighting!=0) { $pourcentageScore = round(($score*100)/$weighting); } $weighting = 0; $csv_content[] = array($a_exercices['title'], $pourcentageScore.' %', $a_essais['essais']); if($i%2==0){ $s_css_class="row_odd"; } else{ $s_css_class="row_even"; } $i++; echo " "; echo " "; $dataExercices[$i][] = $a_exercices['title']; $dataExercices[$i][] = $pourcentageScore.'%'; $dataExercices[$i][] = $a_essais['essais']; //$dataExercices[$i][] = corrections; $i++; } } else { echo " "; } } else { echo " "; } ?>
"; echo $a_exercices['title']; echo " "; echo $pourcentageScore.' %'; echo " "; echo $a_essais['essais']; echo " "; $sql_last_attempt='SELECT exe_id FROM '.$tbl_stats_exercices.' WHERE exe_exo_id="'.$a_exercices['id'].'" AND exe_user_id="'.$_GET['student'].'" AND exe_cours_id="'.$a_infosCours['code'].'" ORDER BY exe_date DESC LIMIT 1'; $resultLastAttempt = api_sql_query($sql_last_attempt); if(Database::num_rows($resultLastAttempt)>0) { $id_last_attempt=mysql_result($resultLastAttempt,0,0); if($a_essais['essais']>0) echo ' '; } echo "
".get_lang('NoExercise')."
".get_lang('NoExercise')."
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) { if(CourseManager :: is_user_subscribed_in_course($student_id,$course_code, true)){ $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 ' '.$course_infos['title'].' '.$time_spent_on_course.' '.$progress.' '.$score.' '; if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){ echo ' '; } else{ echo ' '; } echo ''; } } } else { echo " ".get_lang('NoCourse')." "; } }//end of else !empty($details) ?>


".$a_exName['title']." "; while($a_exerciceDetails = mysql_fetch_array($resultExerciceDetails)) { $sqlAnswer = " SELECT qa.comment, qa.answer FROM ".$a_infosCours['db_name'].".".$course_quiz_answer." as qa WHERE qa.question_id = ".$a_exerciceDetails['id'] ; $resultAnswer = api_sql_query($sqlAnswer); echo ""; echo" ".$a_exerciceDetails['question'].' /'.$a_exerciceDetails['ponderation']." "; while($a_answer = mysql_fetch_array($resultAnswer)) { echo" ".$a_answer['answer']." "; if(!empty($a_answer['comment'])) echo $a_answer['comment']; else echo get_lang('NoComment'); echo " "; } } echo ""; } //YW - commented out because it doesn't seem to be used //$a_header = array_merge($a_headerLearnpath,$a_headerExercices,$a_headerProductions); } if($export_csv) { ob_end_clean(); Export :: export_table_csv($csv_content, 'reporting_student'); } /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer(); ?>