function show_image(image,width,height) { width = parseInt(width) + 20; height = parseInt(height) + 20; window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\'); } '; $export_csv = isset ($_GET['export']) && $_GET['export'] == 'csv' ? true : false; if ($export_csv) { ob_start(); } $csv_content = array (); $from_myspace = false; if (isset ($_GET['from']) && $_GET['from'] == 'myspace') { $from_myspace = true; $this_section = "session_my_space"; } else { $this_section = SECTION_COURSES; } $nameTools = get_lang("StudentDetails"); //$nameTools = SECTION_PLATFORM_ADMIN; $cidReset = true; $get_course_code = Security :: remove_XSS($_GET['course']); if (isset ($_GET['details'])) { if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') { $course_info = CourseManager :: get_course_information($get_course_code); if (empty ($cidReq)) { $interbreadcrumb[] = array ( "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'], 'name' => $course_info['title'] ); } $interbreadcrumb[] = array ( "url" => "../user/user.php?cidReq=" . $get_course_code, "name" => get_lang("Users") ); } else if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') { $course_info = CourseManager :: get_course_information($get_course_code); if (empty ($cidReq)) { //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']); } $interbreadcrumb[] = array ( "url" => "../tracking/courseLog.php?cidReq=" . $get_course_code . '&studentlist=true&id_session=' . (empty ($_SESSION['id_session']) ? '' : $_SESSION['id_session']), "name" => get_lang("Tracking") ); } else if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') { $interbreadcrumb[] = array ( 'url' => '../admin/index.php', "name" => get_lang('PlatformAdmin') ); $interbreadcrumb[] = array ( 'url' => "../admin/session_list.php", "name" => get_lang('SessionList') ); $interbreadcrumb[] = array ( 'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']), "name" => get_lang('SessionOverview') ); } 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=" . Security :: remove_XSS($_GET['id_coach']), "name" => get_lang("CoachStudents") ); $interbreadcrumb[] = array ( "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']), "name" => get_lang("StudentDetails") ); } else { $interbreadcrumb[] = array ( "url" => "student.php", "name" => get_lang("MyStudents") ); $interbreadcrumb[] = array ( "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']), "name" => get_lang("StudentDetails") ); } } $nameTools = get_lang("DetailsStudentInCourse"); } else { if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') { $interbreadcrumb[] = array ( 'url' => '../admin/index.php', "name" => get_lang('PlatformAdmin') ); $interbreadcrumb[] = array ( 'url' => "../admin/session_list.php", "name" => get_lang('SessionList') ); $interbreadcrumb[] = array ( 'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']), "name" => get_lang('SessionOverview') ); } 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=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $_GET['id_session'], "name" => get_lang("CoachStudents") ); } else { $interbreadcrumb[] = array ( "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']), "name" => get_lang("CoachStudents") ); } } else { $interbreadcrumb[] = array ( "url" => "student.php", "name" => get_lang("MyStudents") ); } } } api_block_anonymous_users(); if (!api_is_allowed_to_edit() && !api_is_coach() && $_user['status'] != DRH && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) { api_not_allowed(true); } Display :: display_header($nameTools); /* * ====================================================================================== * FUNCTIONS * ====================================================================================== */ 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='" . Database :: escape_string($course_code) . "' AND status='1'"; $result = Database::query($sql, __FILE__, __LINE__); if (Database :: 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(TABLE_LP_VIEW); //$tbl_course_lp_view_item = Database :: get_course_table(TABLE_LP_ITEM_VIEW); //$tbl_course_lp_item = Database :: get_course_table(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"] != "") { $user_id = intval($_GET['user_id']); } else { $user_id = $_user['user_id']; } if (!empty ($_GET['student'])) { $student_id = intval($_GET['student']); // infos about user $info_user = UserManager :: get_user_info_by_id($student_id); if ($_user['status'] == DRH && $info_user['hr_dept_id'] != $_user['user_id']) { api_not_allowed(); } $info_user['name'] = api_get_person_name($info_user['firstname'], $info_user['lastname']); // Actions bar echo '
'; echo ' ' . get_lang('Print') . ''; echo ' ' . get_lang('ExportAsCSV') . ''; if (!empty ($info_user['email'])) { $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . Display :: encrypted_mailto_link($info_user['email'], get_lang('SendMail')); } else { $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . get_lang('SendMail'); } echo $send_mail; if (!empty ($_GET['student']) && !empty ($_GET['course'])) { //only show link to connection details if course and student were defined in the URL echo '' . Display :: return_icon('statistics.gif', get_lang('AccessDetails')) . ' ' . get_lang('AccessDetails') . ''; } echo '
'; // is the user online ? $student_online = Security :: remove_XSS($_GET['student']); $users_online = WhoIsOnline(30); foreach ($users_online as $online) { if (in_array($_GET['student'], $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=' . Database :: escape_string($info_user['user_id']); $rs = Database::query($sql, __FILE__, __LINE__); $courses = array (); while ($row = Database :: fetch_array($rs)) { $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($info_user['user_id']); $rs = Database::query($sql, __FILE__, __LINE__); while ($row = Database :: fetch_array($rs)) { $courses[$row['course_code']] = $row['course_code']; } $course_id = Security :: remove_XSS($_GET['course']); if (!CourseManager :: is_user_subscribed_in_course($info_user['user_id'], $course_id, true)) { unset ($courses[$key]); } else { $nb_courses++; $avg_student_progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_id); //the score inside the Reporting table $avg_student_score = Tracking :: get_average_test_scorm_and_lp($info_user['user_id'], $course_id); } $avg_student_progress = round($avg_student_progress, 2); $avg_student_score = round($avg_student_score, 2); $first_connection_date = Tracking :: get_first_connection_date($info_user['user_id']); if ($first_connection_date == '') { $first_connection_date = get_lang('NoConnexion'); } $last_connection_date = Tracking :: get_last_connection_date($info_user['user_id'], true); if ($last_connection_date == '') { $last_connection_date = get_lang('NoConnexion'); } $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_id)); // cvs informations $csv_content[] = array ( get_lang('Informations', '') ); $csv_content[] = array ( get_lang('Name', ''), get_lang('Email', ''), get_lang('Tel', '') ); $csv_content[] = array ( $info_user['name'], $info_user['email'], $info_user['phone'] ); $csv_content[] = array (); // csv tracking $csv_content[] = array ( get_lang('Tracking', '') ); $csv_content[] = array ( get_lang('FirstLogin', ''), get_lang('LatestLogin', ''), get_lang('TimeSpentInTheCourse', ''), get_lang('Progress', ''), get_lang('Score', '') ); $csv_content[] = array ( strip_tags($first_connection_date), strip_tags($last_connection_date), $time_spent_on_the_course, $avg_student_progress . '%', $avg_student_score . '%' ); ?> '; // get the path,width and height from original picture $image_file = $image_array['dir'] . $image_array['file']; $big_image = $image_array['dir'] . 'big_' . $image_array['file']; $big_image_size = api_getimagesize($big_image); $big_image_width = $big_image_size[0]; $big_image_height = $big_image_size[1]; $url_big_image = $big_image . '?rnd=' . time(); $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . api_get_person_name($info_user['lastname'], $info_user['firstname']) . '" ' . 'style="float:' . ($text_dir == 'rtl' ? 'left' : 'right') . '; padding:5px;" '; if ($image_array['file'] == 'unknown.jpg') { echo ''; } else { echo ''; } echo ''; ?>
' . $info_user['email'] . ''; } else { echo get_lang('NoEmail'); } ?>
'absmiddle', 'hspace' => '3px' )); ?>
'absmiddle', 'hspace' => '3px' )); ?>
0) { $le_session_id = intval(Database :: result($rs, 0, 0)); if ($le_session_id > 0) { // get session name and coach of the session $sql = 'SELECT name, id_coach FROM ' . $tbl_session . ' WHERE id=' . $le_session_id; $rs = Database::query($sql, __FILE__, __LINE__); $session_name = Database :: result($rs, 0, 'name'); $session_coach_id = intval(Database :: result($rs, 0, 'id_coach')); // get coach of the course in the session $sql = 'SELECT id_user FROM ' . $tbl_session_course_user . ' WHERE id_session=' . $le_session_id . ' AND course_code = "' . Database :: escape_string($_GET['course']) . '" AND status=2'; /* $sql = 'SELECT id_coach FROM ' . $tbl_session_course . ' WHERE id_session=' . $le_session_id . ' AND course_code = "' . Database :: escape_string($_GET['course']) . '"'; */ $rs = Database::query($sql, __FILE__, __LINE__); //$session_course_coach_id = intval(Database :: result($rs, 0, 0)); $course_coachs = array(); while ($row_coachs = Database::fetch_array($rs)) { $course_coachs[] = $row_coachs['id_user']; } if (!empty($course_coachs)) { $info_tutor_name = array(); foreach ($course_coachs as $course_coach) { $coach_infos = UserManager :: get_user_info_by_id($course_coach); $info_tutor_name[] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); } $info_course['tutor_name'] = implode(",",$info_tutor_name); } /*if ($session_course_coach_id != 0) { $coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id); $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); }*/ elseif ($session_coach_id != 0) { $coach_infos = UserManager :: get_user_info_by_id($session_coach_id); $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); } } } } // end if(api_get_setting('use_session_mode')=='true') $date_start = ''; if (!empty ($info_course['date_start'])) { $date_start = explode('-', $info_course['date_start']); $date_start = $date_start[2] . '/' . $date_start[1] . '/' . $date_start[0]; } $date_end = ''; if (!empty ($info_course['date_end'])) { $date_end = explode('-', $info_course['date_end']); $date_end = $date_end[2] . '/' . $date_end[1] . '/' . $date_end[0]; } $dateSession = get_lang('From') . ' ' . $date_start . ' ' . get_lang('To') . ' ' . $date_end; $nb_login = Tracking :: count_login_per_student($info_user['user_id'], $_GET['course']); $table_title = $info_course['title'] . ' | ' . get_lang('CountToolAccess') . ' : ' . $nb_login . '  |  ' . get_lang('Tutor') . ' : ' . stripslashes($info_course['tutor_name']) . ((!empty ($session_name)) ? ' | ' . get_lang('Session') . ' : ' . $session_name : ''); $csv_content[] = array (); $csv_content[] = array (str_replace(' ', '', $table_title)); ?>
 
0) { $i = 0; while ($learnpath = Database :: fetch_array($result_learnpath)) { $any_result = false; $progress = learnpath :: get_db_progress($learnpath['id'], $student_id, '%', $info_course['db_name'], true); if ($progress === null) { $progress = '0%'; } else { $any_result = true; } // calculates time $sql = 'SELECT SUM(total_time) FROM ' . $t_lpiv . ' AS item_view INNER JOIN ' . $t_lpv . ' AS view ON item_view.lp_view_id = view.id AND view.lp_id = ' . $learnpath['id'] . ' AND view.user_id = ' . intval($_GET['student']); $rs = Database::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 ' . $t_lpiv . ' AS item_view INNER JOIN ' . $t_lpv . ' AS view ON item_view.lp_view_id = view.id AND view.lp_id = ' . $learnpath['id'] . ' AND view.user_id = ' . intval($_GET['student']); $rs = Database::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 $score = Tracking :: get_avg_student_score(intval($_GET['student']), Database :: escape_string($_GET['course']), array ( $learnpath['id'] )); if (empty ($score)) { //$score = 0; } if ($i % 2 == 0) { $css_class = "row_odd"; } else { $css_class = "row_even"; } $i++; $csv_content[] = array ( api_html_entity_decode(stripslashes($learnpath['name']), ENT_QUOTES, $charset), api_time_to_hms($total_time), $score . '%', $progress, date('Y-m-d', $start_time) ); ?> "; } ?>
'absmiddle', 'hspace' => '3px' )); ?> 'absmiddle', 'hspace' => '3px' )); ?> 'absmiddle', 'hspace' => '3px' )); ?> 'absmiddle', 'hspace' => '3px' )); ?>
0) { echo format_locale_date(get_lang('DateFormatLongWithoutDay'), $start_time); } else { echo '-'; } ?>
" . get_lang('NoLearnpath') . "
0) { while ($exercices = Database :: fetch_array($result_exercices)) { $sql_essais = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercices AS ex WHERE ex.exe_cours_id = '" . $info_course['code'] . "' AND ex.exe_exo_id = " . $exercices['id'] . " AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND exe_user_id='" . Database :: escape_string($is_student) . "'"; $result_essais = Database::query($sql_essais, __FILE__, __LINE__); $essais = Database :: fetch_array($result_essais); $sql_score = "SELECT exe_id, exe_result,exe_weighting FROM $tbl_stats_exercices WHERE exe_user_id = " . Database :: escape_string($is_student) . " AND exe_cours_id = '" . $info_course['code'] . "' AND exe_exo_id = " . $exercices['id'] . " AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1"; $result_score = Database::query($sql_score, __FILE__, __LINE__); $score = 0; while ($scores = Database :: fetch_array($result_score)) { $score = $score + $scores['exe_result']; $weighting = $weighting + $scores['exe_weighting']; $exe_id = $scores['exe_id']; } $score_percentage = 0; if ($weighting != 0) { //i.e 10.50 $score_percentage = round(($score * 100) / $weighting, 2); } else { $score_percentage = null; } $weighting = 0; $csv_content[] = array ( $exercices['title'], $score_percentage . '%', $essais['essais'] ); if ($i % 2 == 0) { $css_class = "row_odd"; } else { $css_class = "row_even"; } $i++; echo ' "; echo " "; $data_exercices[$i][] = $exercices['title']; $data_exercices[$i][] = $score_percentage . '%'; $data_exercices[$i][] = $essais['essais']; //$data_exercices[$i][] = corrections; $i++; } } else { echo " "; } } else { echo " "; } ?>
'absmiddle', 'hspace' => '3px')) ?>
'; echo $exercices['title']; echo " "; if ($essais['essais'] > 0) { echo $score_percentage . '%'; } else { echo '/'; $score_percentage = 0; } echo " "; echo $essais['essais']; echo " "; $sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $exercices['id'] . '" AND exe_user_id="' . Security :: remove_XSS($_GET['student']) . '" AND exe_cours_id="' . $info_course['code'] . '" AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1'; $result_last_attempt = Database::query($sql_last_attempt, __FILE__, __LINE__); if (Database :: num_rows($result_last_attempt) > 0) { $id_last_attempt = Database :: result($result_last_attempt, 0, 0); if ($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 ($courses as $course_code) { if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { $course_info = CourseManager :: get_course_information($course_code); $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code)); $progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_code); $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code); $progress = empty($progress) ? '0%' : $progress.'%'; $score = empty($score) ? '0%' : $score.'%'; $csv_content[] = array ( $course_info['title'], $time_spent_on_course, $progress, $score ); echo ' ' . $course_info['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) ?>


" . $exName['title'] . " "; while ($exerciceDetails = Database :: fetch_array($result_exercice_details)) { $sqlAnswer = " SELECT qa.comment, qa.answer FROM " . $t_qa . " as qa WHERE qa.question_id = " . $exerciceDetails['id']; $resultAnswer = Database::query($sqlAnswer, __FILE__, __LINE__); echo ""; echo " " . $exerciceDetails['question'] . ' /' . $exerciceDetails['ponderation'] . " "; while ($answer = Database :: fetch_array($resultAnswer)) { echo " " . $answer['answer'] . " "; if (!empty ($answer['comment'])) echo $answer['comment']; else echo get_lang('NoComment'); echo " "; } } echo ""; } //YW - commented out because it doesn't seem to be used //$header = array_merge($headerLearnpath,$headerExercices,$headerProductions); } if ($export_csv) { ob_end_clean(); Export :: export_table_csv($csv_content, 'reporting_student'); } /* ============================================================================== FOOTER ============================================================================== */ Display :: display_footer();