myStudents.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Implements the tracking of students in the Reporting pages
  5. * @package chamilo.reporting
  6. */
  7. require_once '../inc/global.inc.php';
  8. api_block_anonymous_users();
  9. if (!api_is_allowed_to_create_course() &&
  10. !api_is_session_admin() &&
  11. !api_is_drh() &&
  12. !api_is_student_boss()
  13. ) {
  14. // Check if the user is tutor of the course
  15. $user_course_status = CourseManager::get_tutor_in_course_status(
  16. api_get_user_id(),
  17. api_get_course_id()
  18. );
  19. if ($user_course_status != 1) {
  20. api_not_allowed(true);
  21. }
  22. }
  23. $htmlHeadXtra[] = '<script>
  24. function show_image(image,width,height) {
  25. width = parseInt(width) + 20;
  26. height = parseInt(height) + 20;
  27. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
  28. }
  29. </script>';
  30. $export = isset($_GET['export']) ? $_GET['export'] : false;
  31. $sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
  32. $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
  33. if (empty($sessionId)) {
  34. $sessionId = api_get_session_id();
  35. }
  36. if ($export) {
  37. ob_start();
  38. }
  39. $csv_content = array();
  40. $from_myspace = false;
  41. if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
  42. $from_myspace = true;
  43. $this_section = SECTION_TRACKING;
  44. } else {
  45. $this_section = SECTION_COURSES;
  46. }
  47. $nameTools = get_lang('StudentDetails');
  48. $get_course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : '';
  49. if (isset($_GET['details'])) {
  50. if ($origin == 'user_course') {
  51. $course_info = CourseManager :: get_course_information($get_course_code);
  52. if (empty ($cidReq)) {
  53. $interbreadcrumb[] = array (
  54. "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
  55. 'name' => $course_info['title']
  56. );
  57. }
  58. $interbreadcrumb[] = array (
  59. "url" => "../user/user.php?cidReq=" . $get_course_code,
  60. "name" => get_lang("Users")
  61. );
  62. } else
  63. if ($origin == 'tracking_course') {
  64. $course_info = CourseManager :: get_course_information($get_course_code);
  65. $interbreadcrumb[] = array (
  66. "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
  67. "name" => get_lang("Tracking")
  68. );
  69. } else
  70. if ($origin == 'resume_session') {
  71. $interbreadcrumb[] = array (
  72. 'url' => "../session/session_list.php",
  73. "name" => get_lang('SessionList')
  74. );
  75. $interbreadcrumb[] = array (
  76. 'url' => "../session/resume_session.php?id_session=" . $sessionId,
  77. "name" => get_lang('SessionOverview')
  78. );
  79. } else {
  80. $interbreadcrumb[] = array (
  81. "url" => "index.php",
  82. "name" => get_lang('MySpace')
  83. );
  84. if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  85. $interbreadcrumb[] = array (
  86. "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
  87. "name" => get_lang("CoachStudents")
  88. );
  89. $interbreadcrumb[] = array (
  90. "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
  91. "name" => get_lang("StudentDetails")
  92. );
  93. } else {
  94. $interbreadcrumb[] = array (
  95. "url" => "student.php",
  96. "name" => get_lang("MyStudents")
  97. );
  98. $interbreadcrumb[] = array (
  99. "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
  100. "name" => get_lang("StudentDetails")
  101. );
  102. }
  103. }
  104. $nameTools = get_lang("DetailsStudentInCourse");
  105. } else {
  106. if ($origin == 'resume_session') {
  107. $interbreadcrumb[] = array (
  108. 'url' => "../session/session_list.php",
  109. "name" => get_lang('SessionList')
  110. );
  111. if (!empty($sessionId)) {
  112. $interbreadcrumb[] = array(
  113. 'url' => "../session/resume_session.php?id_session=".$sessionId,
  114. "name" => get_lang('SessionOverview')
  115. );
  116. }
  117. } else {
  118. $interbreadcrumb[] = array (
  119. "url" => "index.php",
  120. "name" => get_lang('MySpace')
  121. );
  122. if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  123. if ($sessionId) {
  124. $interbreadcrumb[] = array (
  125. "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId,
  126. "name" => get_lang("CoachStudents")
  127. );
  128. } else {
  129. $interbreadcrumb[] = array (
  130. "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
  131. "name" => get_lang("CoachStudents")
  132. );
  133. }
  134. } else {
  135. $interbreadcrumb[] = array (
  136. "url" => "student.php",
  137. "name" => get_lang("MyStudents")
  138. );
  139. }
  140. }
  141. }
  142. // Database Table Definitions
  143. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  144. $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
  145. if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
  146. $user_id = intval($_GET['user_id']);
  147. } else {
  148. $user_id = api_get_user_id();
  149. }
  150. $student_id = intval($_GET['student']);
  151. // Action behaviour
  152. $check = Security::check_token('get');
  153. if ($check) {
  154. switch ($_GET['action']) {
  155. case 'reset_lp':
  156. $course = isset($_GET['course']) ? $_GET['course'] : "";
  157. $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : "";
  158. if (api_is_allowed_to_edit() &&
  159. !empty($course) &&
  160. !empty($lp_id) &&
  161. !empty($student_id)
  162. ) {
  163. $course_info = api_get_course_info($course);
  164. Event::delete_student_lp_events(
  165. $student_id,
  166. $lp_id,
  167. $course_info,
  168. $sessionId
  169. );
  170. // @todo delete the stats.track_e_exercises records.
  171. // First implement this http://support.chamilo.org/issues/1334
  172. $message = Display::return_message(
  173. get_lang('LPWasReset'),
  174. 'success'
  175. );
  176. }
  177. break;
  178. default:
  179. break;
  180. }
  181. Security::clear_token();
  182. }
  183. // user info
  184. $user_info = api_get_user_info($student_id);
  185. $courses_in_session = array();
  186. //See #4676
  187. $drh_can_access_all_courses = false;
  188. if (api_is_drh() || api_is_platform_admin() || api_is_student_boss()) {
  189. $drh_can_access_all_courses = true;
  190. }
  191. $courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
  192. $courses_in_session_by_coach = array();
  193. $sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_id());
  194. // RRHH or session admin
  195. if (api_is_session_admin() || api_is_drh()) {
  196. $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
  197. $session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
  198. if (!empty($session_by_session_admin)) {
  199. foreach ($session_by_session_admin as $session_coached_by_user) {
  200. $courses_followed_by_coach = Tracking :: get_courses_list_from_session($session_coached_by_user['id']);
  201. $courses_in_session_by_coach[$session_coached_by_user['id']] = $courses_followed_by_coach;
  202. }
  203. }
  204. }
  205. // Teacher or admin
  206. if (!empty($sessions_coached_by_user)) {
  207. foreach ($sessions_coached_by_user as $session_coached_by_user) {
  208. $sid = intval($session_coached_by_user['id']);
  209. $courses_followed_by_coach = Tracking :: get_courses_followed_by_coach(api_get_user_id(), $sid);
  210. $courses_in_session_by_coach[$sid] = $courses_followed_by_coach;
  211. }
  212. }
  213. $sql = "SELECT c_id
  214. FROM $tbl_course_user
  215. WHERE
  216. relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
  217. user_id = ".intval($user_info['user_id']);
  218. $rs = Database::query($sql);
  219. while ($row = Database :: fetch_array($rs)) {
  220. if ($drh_can_access_all_courses) {
  221. $courses_in_session[0][] = $row['c_id'];
  222. } else {
  223. if (isset($courses[$row['c_id']])) {
  224. $courses_in_session[0][] = $row['c_id'];
  225. }
  226. }
  227. }
  228. // Get the list of sessions where the user is subscribed as student
  229. $sql = 'SELECT session_id, c_id
  230. FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
  231. WHERE user_id=' . intval($user_info['user_id']);
  232. $rs = Database::query($sql);
  233. $tmp_sessions = array();
  234. while ($row = Database :: fetch_array($rs)) {
  235. $tmp_sessions[] = $row['session_id'];
  236. if ($drh_can_access_all_courses) {
  237. if (in_array($row['session_id'], $tmp_sessions)) {
  238. $courses_in_session[$row['session_id']][] = $row['c_id'];
  239. }
  240. } else {
  241. if (isset($courses_in_session_by_coach[$row['session_id']])) {
  242. if (in_array($row['session_id'], $tmp_sessions)) {
  243. $courses_in_session[$row['session_id']][] = $row['c_id'];
  244. }
  245. }
  246. }
  247. }
  248. $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
  249. api_get_user_id(),
  250. api_get_course_info()
  251. );
  252. if (api_is_drh() && !api_is_platform_admin()) {
  253. if (!empty($student_id)) {
  254. if (api_drh_can_access_all_session_content()) {
  255. //@todo securize drh with student id
  256. /*$users = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id());
  257. $userList = array();
  258. foreach ($users as $user) {
  259. $userList[] = $user['user_id'];
  260. }
  261. if (!in_array($student_id, $userList)) {
  262. api_not_allowed(true);
  263. }*/
  264. } else {
  265. if (!($isDrhOfCourse)) {
  266. if (api_is_drh() &&
  267. !UserManager::is_user_followed_by_drh($student_id, api_get_user_id())
  268. ) {
  269. api_not_allowed(true);
  270. }
  271. }
  272. }
  273. }
  274. }
  275. Display :: display_header($nameTools);
  276. if (isset($message)) {
  277. echo $message;
  278. }
  279. $token = Security::get_token();
  280. if (!empty($student_id)) {
  281. // Actions bar
  282. echo '<div class="actions">';
  283. echo '<a href="javascript: window.history.go(-1);" ">'.
  284. Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
  285. echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
  286. Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
  287. echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv">'.
  288. Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
  289. echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=xls">'.
  290. Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
  291. if (!empty ($user_info['email'])) {
  292. $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
  293. Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
  294. } else {
  295. $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
  296. }
  297. echo $send_mail;
  298. if (!empty($student_id) && !empty($_GET['course'])) {
  299. // Only show link to connection details if course and student were defined in the URL
  300. echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&origin=' . $origin. '&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
  301. Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
  302. }
  303. if (api_can_login_as($student_id)) {
  304. echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$student_id.'&sec_token='.$token.'">'.
  305. Display::return_icon('login_as.png', get_lang('LoginAs'), null, ICON_SIZE_MEDIUM).'</a>&nbsp;&nbsp;';
  306. }
  307. echo '</div>';
  308. // is the user online ?
  309. if (user_is_online($_GET['student'])) {
  310. $online = get_lang('Yes');
  311. } else {
  312. $online = get_lang('No');
  313. }
  314. // get average of score and average of progress by student
  315. $avg_student_progress = $avg_student_score = 0;
  316. $course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : null;
  317. if (CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
  318. $avg_student_progress = Tracking::get_avg_student_progress(
  319. $user_info['user_id'],
  320. $course_code,
  321. array(),
  322. $sessionId
  323. );
  324. //the score inside the Reporting table
  325. $avg_student_score = Tracking::get_avg_student_score(
  326. $user_info['user_id'],
  327. $course_code,
  328. array(),
  329. $sessionId
  330. );
  331. }
  332. $avg_student_progress = round($avg_student_progress, 2);
  333. // time spent on the course
  334. $courseInfo = api_get_course_info($course_code);
  335. $time_spent_on_the_course = 0;
  336. if (!empty($courseInfo)) {
  337. $time_spent_on_the_course = api_time_to_hms(
  338. Tracking:: get_time_spent_on_the_course(
  339. $user_info['user_id'],
  340. $courseInfo['real_id'],
  341. $sessionId
  342. )
  343. );
  344. }
  345. // get information about connections on the platform by student
  346. $first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
  347. if ($first_connection_date == '') {
  348. $first_connection_date = get_lang('NoConnexion');
  349. }
  350. $last_connection_date = Tracking :: get_last_connection_date($user_info['user_id'], true);
  351. if ($last_connection_date == '') {
  352. $last_connection_date = get_lang('NoConnexion');
  353. }
  354. // cvs information
  355. $csv_content[] = array(
  356. get_lang('Information', '')
  357. );
  358. $csv_content[] = array (
  359. get_lang('Name', ''),
  360. get_lang('Email', ''),
  361. get_lang('Tel', '')
  362. );
  363. $csv_content[] = array(
  364. $user_info['complete_name'],
  365. $user_info['email'],
  366. $user_info['phone']
  367. );
  368. $csv_content[] = array();
  369. // csv tracking
  370. $csv_content[] = array(
  371. get_lang('Tracking', '')
  372. );
  373. $csv_content[] = array(
  374. get_lang('FirstLoginInPlatform', ''),
  375. get_lang('LatestLoginInPlatform', ''),
  376. get_lang('TimeSpentInTheCourse', ''),
  377. get_lang('Progress', ''),
  378. get_lang('Score', '')
  379. );
  380. $csv_content[] = array(
  381. strip_tags($first_connection_date),
  382. strip_tags($last_connection_date),
  383. $time_spent_on_the_course,
  384. $avg_student_progress . '%',
  385. $avg_student_score
  386. );
  387. //Show title
  388. $info_course = CourseManager :: get_course_information($course_code);
  389. $coachs_name = '';
  390. $session_name = '';
  391. $nb_login = Tracking :: count_login_per_student($user_info['user_id'], $info_course['real_id']);
  392. //get coach and session_name if there is one and if session_mode is activated
  393. if ($sessionId > 0) {
  394. $session_info = api_get_session_info($sessionId);
  395. $session_coach_id = $session_info['session_admin_id'];
  396. $course_coachs = api_get_coachs_from_course($sessionId, $info_course['real_id']);
  397. $nb_login = '';
  398. if (!empty($course_coachs)) {
  399. $info_tutor_name = array();
  400. foreach ($course_coachs as $course_coach) {
  401. $info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
  402. }
  403. $info_course['tutor_name'] = implode(",",$info_tutor_name);
  404. } elseif ($session_coach_id != 0) {
  405. $session_coach_id = intval($session_info['id_coach']);
  406. $coach_info = api_get_user_info($session_coach_id);
  407. $info_course['tutor_name'] = $coach_info['complete_name'];
  408. }
  409. $coachs_name = $info_course['tutor_name'];
  410. $session_name = $session_info['name'];
  411. } // end
  412. $info_course = CourseManager :: get_course_information($get_course_code);
  413. $table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
  414. echo Display::page_subheader($table_title);
  415. echo '<table width="100%" border="0">';
  416. echo '<tr>';
  417. $userPicture = UserManager::getUserPicture($user_info['user_id']);
  418. echo '<img src="' . $userPicture . '" />';
  419. echo '</td>';
  420. ?>
  421. <td width="40%" valign="top">
  422. <table width="100%" class="data_table">
  423. <tr>
  424. <th><?php echo get_lang('Information'); ?></th>
  425. </tr>
  426. <tr>
  427. <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
  428. </tr>
  429. <tr>
  430. <td><?php echo get_lang('Email') . ' : ';
  431. if (!empty ($user_info['email'])) {
  432. echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
  433. } else {
  434. echo get_lang('NoEmail');
  435. } ?>
  436. </td>
  437. </tr>
  438. <tr>
  439. <td> <?php echo get_lang('Tel') . ' : ';
  440. if (!empty ($user_info['phone'])) {
  441. echo $user_info['phone'];
  442. } else {
  443. echo get_lang('NoTel');
  444. }
  445. ?>
  446. </td>
  447. </tr>
  448. <tr>
  449. <td> <?php echo get_lang('OfficialCode') . ' : ';
  450. if (!empty ($user_info['official_code'])) {
  451. echo $user_info['official_code'];
  452. } else {
  453. echo get_lang('NoOfficialCode');
  454. }
  455. ?>
  456. </td>
  457. </tr>
  458. <tr>
  459. <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td>
  460. </tr>
  461. <?php
  462. // Display timezone if the user selected one and if the admin allows the use of user's timezone
  463. $timezone = null;
  464. $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'],'timezone');
  465. $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
  466. if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
  467. $timezone = $timezone_user['timezone'];
  468. }
  469. if ($timezone !== null) {
  470. ?>
  471. <tr>
  472. <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td>
  473. </tr>
  474. <?php
  475. }
  476. ?>
  477. </table>
  478. </td>
  479. <td class="borderLeft" width="35%" valign="top">
  480. <table width="100%" class="data_table">
  481. <tr>
  482. <th colspan="2"><?php echo get_lang('Tracking'); ?></th>
  483. </tr>
  484. <tr><td align="right"><?php echo get_lang('FirstLoginInPlatform') ?></td>
  485. <td align="left"><?php echo $first_connection_date ?></td>
  486. </tr>
  487. <tr>
  488. <td align="right"><?php echo get_lang('LatestLoginInPlatform') ?></td>
  489. <td align="left"><?php echo $last_connection_date ?></td>
  490. </tr>
  491. <?php if (isset($_GET['details']) && $_GET['details'] == 'true') {?>
  492. <tr>
  493. <td align="right"><?php echo get_lang('TimeSpentInTheCourse') ?></td>
  494. <td align="left"><?php echo $time_spent_on_the_course ?></td>
  495. </tr>
  496. <tr>
  497. <td align="right">
  498. <?php
  499. echo get_lang('Progress').' ';
  500. Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?>
  501. </td>
  502. <td align="left"><?php echo $avg_student_progress.'%' ?></td>
  503. </tr>
  504. <tr>
  505. <td align="right">
  506. <?php
  507. echo get_lang('Score').' ';
  508. Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
  509. </td>
  510. <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;} ?></td>
  511. </tr>
  512. <?php
  513. if (!empty($nb_login)) {
  514. echo '<tr><td align="right">'.get_lang('CountToolAccess').'</td>';
  515. echo '<td align="left"> '.$nb_login.'</td>';
  516. echo '</tr>';
  517. }
  518. } ?>
  519. </table>
  520. </td>
  521. </tr>
  522. </table>
  523. <?php
  524. $table_title = '';
  525. if (!empty($sessionId)) {
  526. $session_name = api_get_session_name($sessionId);
  527. $table_title = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'';
  528. }
  529. if (!empty($info_course['title'])) {
  530. $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].' ':'';
  531. }
  532. echo Display::page_subheader($table_title);
  533. if (empty($_GET['details'])) {
  534. $csv_content[] = array();
  535. $csv_content[] = array(
  536. get_lang('Session', ''),
  537. get_lang('Course', ''),
  538. get_lang('Time', ''),
  539. get_lang('Progress', ''),
  540. get_lang('Score', ''),
  541. get_lang('AttendancesFaults', ''),
  542. get_lang('Evaluations')
  543. );
  544. $attendance = new Attendance();
  545. foreach ($courses_in_session as $key => $courses) {
  546. $sessionId = $key;
  547. $session_info = api_get_session_info($sessionId);
  548. $session_name = '';
  549. if ($session_info) {
  550. $session_name = $session_info['name'];
  551. }
  552. $access_start_date = '';
  553. if (!empty($session_info['access_start_date']) && $session_info['access_start_date'] != '0000-00-00') {
  554. $access_start_date = api_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
  555. }
  556. $access_end_date = '';
  557. if (!empty($session_info['access_end_date']) && $session_info['access_end_date'] != '0000-00-00') {
  558. $access_end_date = api_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
  559. }
  560. $date_session = '';
  561. if (!empty($access_start_date) && !empty($access_end_date)) {
  562. $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
  563. }
  564. $title = '';
  565. if (empty($sessionId)) {
  566. $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
  567. } else {
  568. $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
  569. }
  570. // Courses
  571. echo '<h3>'.$title.'</h3>';
  572. echo '<table class="data_table courses-tracking">';
  573. echo '<tr>
  574. <th>'.get_lang('Course').'</th>
  575. <th>'.get_lang('Time').'</th>
  576. <th>'.get_lang('Progress').'</th>
  577. <th>'.get_lang('Score').'</th>
  578. <th>'.get_lang('AttendancesFaults').'</th>
  579. <th>'.get_lang('Evaluations').'</th>
  580. <th>'.get_lang('Details').'</th>
  581. </tr>';
  582. if (!empty($courses)) {
  583. foreach ($courses as $courseId) {
  584. $courseInfo = api_get_course_info_by_id($courseId);
  585. $courseId = $courseInfo['real_id'];
  586. $course_code = $courseInfo['code'];
  587. if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
  588. $course_info = CourseManager :: get_course_information($course_code);
  589. $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId));
  590. // get average of faults in attendances by student
  591. $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $sessionId);
  592. if (!empty($results_faults_avg['total'])) {
  593. if (api_is_drh()) {
  594. $attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&id_session='.$sessionId.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
  595. } else {
  596. $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
  597. }
  598. } else {
  599. $attendances_faults_avg = '0/0 (0%)';
  600. }
  601. // Get evaluations by student
  602. $cats = Category::load(null, null, $course_code, null, null, $sessionId);
  603. $scoretotal = array();
  604. if (isset($cats) && isset($cats[0])) {
  605. if (!empty($sessionId)) {
  606. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
  607. } else {
  608. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
  609. }
  610. }
  611. $scoretotal_display = '0/0 (0%)';
  612. if (!empty($scoretotal)) {
  613. $scoretotal_display = round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
  614. }
  615. $progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
  616. $score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $sessionId);
  617. $progress = empty($progress) ? '0%' : $progress.'%';
  618. $score = empty($score) ? '0%' : $score.'%';
  619. $csv_content[] = array(
  620. $session_name,
  621. $course_info['title'],
  622. $time_spent_on_course,
  623. $progress,
  624. $score,
  625. $attendances_faults_avg,
  626. $scoretotal_display
  627. );
  628. echo '<tr>
  629. <td ><a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['directory'] .'/?id_session=' . $sessionId . '">'.$course_info['title'].'</a></td>
  630. <td >'.$time_spent_on_course .'</td>
  631. <td >'.$progress.'</td>
  632. <td >'.$score.'</td>
  633. <td >'.$attendances_faults_avg.'</td>
  634. <td >'.$scoretotal_display.'</td>';
  635. if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  636. echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.$origin.'&id_session='.$sessionId.'#infosStudent">
  637. <img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
  638. } else {
  639. echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.$origin.'&id_session='.$sessionId.'#infosStudent">
  640. <img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
  641. }
  642. echo '</tr>';
  643. }
  644. }
  645. } else {
  646. echo "<tr><td colspan='5'>".get_lang('NoCourse')."</td></tr>";
  647. }
  648. echo '</table>';
  649. }
  650. } else {
  651. if ($user_info['status'] != INVITEE) {
  652. $csv_content[] = array();
  653. $csv_content[] = array(str_replace('&nbsp;', '', $table_title));
  654. $t_lp = Database :: get_course_table(TABLE_LP_MAIN);
  655. // csv export headers
  656. $csv_content[] = array();
  657. $csv_content[] = array(
  658. get_lang('Learnpath'),
  659. get_lang('Time'),
  660. get_lang('AverageScore'),
  661. get_lang('LatestAttemptAverageScore'),
  662. get_lang('Progress'),
  663. get_lang('LastConnexion')
  664. );
  665. if (empty($sessionId)) {
  666. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  667. WHERE session_id = 0 AND c_id = {$info_course['real_id']}
  668. ORDER BY lp.display_order";
  669. } else {
  670. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  671. WHERE c_id = {$info_course['real_id']}
  672. ORDER BY lp.display_order";
  673. }
  674. $rs_lp = Database::query($sql_lp);
  675. if (Database :: num_rows($rs_lp) > 0) {
  676. ?>
  677. <!-- LPs-->
  678. <table class="data_table">
  679. <tr>
  680. <th><?php echo get_lang('Learnpaths');?></th>
  681. <th><?php
  682. echo get_lang('Time').' ';
  683. Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  684. <th><?php
  685. echo get_lang('AverageScore').' ';
  686. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  687. <th><?php
  688. echo get_lang('LatestAttemptAverageScore').' ';
  689. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  690. <th><?php
  691. echo get_lang('Progress').' ';
  692. Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  693. <th><?php
  694. echo get_lang('LastConnexion').' ';
  695. Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  696. <?php
  697. echo '<th>'.get_lang('Details').'</th>';
  698. if (api_is_allowed_to_edit()) {
  699. echo '<th>'.get_lang('ResetLP').'</th>';
  700. }
  701. ?>
  702. </tr>
  703. <?php
  704. $i = 0;
  705. while ($learnpath = Database :: fetch_array($rs_lp)) {
  706. $lp_id = intval($learnpath['id']);
  707. $lp_name = $learnpath['name'];
  708. $any_result = false;
  709. // Get progress in lp
  710. $progress = Tracking::get_avg_student_progress(
  711. $student_id,
  712. $course_code,
  713. array($lp_id),
  714. $sessionId
  715. );
  716. if ($progress === null) {
  717. $progress = '0%';
  718. } else {
  719. $any_result = true;
  720. }
  721. // Get time in lp
  722. $total_time = Tracking::get_time_spent_in_lp(
  723. $student_id,
  724. $course_code,
  725. array($lp_id),
  726. $sessionId
  727. );
  728. if (!empty($total_time)) {
  729. $any_result = true;
  730. }
  731. // Get last connection time in lp
  732. $start_time = Tracking::get_last_connection_time_in_lp(
  733. $student_id,
  734. $course_code,
  735. $lp_id,
  736. $sessionId
  737. );
  738. if (!empty($start_time)) {
  739. $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
  740. } else {
  741. $start_time = '-';
  742. }
  743. if (!empty($total_time)) $any_result = true;
  744. // Quiz in lp
  745. $score = Tracking::get_avg_student_score(
  746. $student_id,
  747. $course_code,
  748. array($lp_id),
  749. $sessionId
  750. );
  751. // Latest exercise results in a LP
  752. $score_latest = Tracking:: get_avg_student_score(
  753. $student_id,
  754. $course_code,
  755. array($lp_id),
  756. $sessionId,
  757. false,
  758. true
  759. );
  760. if ($i % 2 == 0) $css_class = "row_even";
  761. else $css_class = "row_odd";
  762. $i++;
  763. // csv export content
  764. $csv_content[] = array (
  765. api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
  766. api_time_to_hms($total_time),
  767. $score . '%',
  768. $score_latest . '%',
  769. $progress.'%',
  770. $start_time
  771. );
  772. echo '<tr class="'.$css_class.'">';
  773. echo Display::tag('td', stripslashes($lp_name));
  774. echo Display::tag('td', api_time_to_hms($total_time));
  775. if (!is_null($score)) {
  776. if (is_numeric($score)) {
  777. $score = $score.'%';
  778. }
  779. }
  780. echo Display::tag('td', $score);
  781. if (!is_null($score_latest)) {
  782. if (is_numeric($score_latest)) {
  783. $score_latest = $score_latest.'%';
  784. }
  785. }
  786. echo Display::tag('td', $score_latest);
  787. if (is_numeric($progress)) {
  788. $progress = $progress.'%';
  789. } else {
  790. $progress = '-';
  791. }
  792. echo Display::tag('td', $progress);
  793. //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
  794. //which implies several other changes not a priority right now
  795. echo Display::tag('td', $start_time);
  796. if ($any_result === true) {
  797. $from = '';
  798. if ($from_myspace) {
  799. $from ='&from=myspace';
  800. }
  801. $link = Display::url(
  802. '<img src="../img/2rightarrow.gif" border="0" />',
  803. 'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).$from.'&origin='.$origin.'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$sessionId
  804. );
  805. echo Display::tag('td', $link);
  806. }
  807. if (api_is_allowed_to_edit()) {
  808. echo '<td>';
  809. if ($any_result === true) {
  810. echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.$origin.'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">';
  811. echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
  812. echo '</a>';
  813. }
  814. echo '</td>';
  815. echo '</tr>';
  816. }
  817. $data_learnpath[$i][] = $lp_name;
  818. $data_learnpath[$i][] = $progress . '%';
  819. }
  820. } else {
  821. //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
  822. }
  823. ?>
  824. </table>
  825. <?php } ?>
  826. <!-- line about exercises -->
  827. <?php if ($user_info['status'] != INVITEE) { ?>
  828. <table class="data_table">
  829. <tr>
  830. <th><?php echo get_lang('Exercises'); ?></th>
  831. <th><?php echo get_lang('LearningPath');?></th>
  832. <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
  833. <th><?php echo get_lang('Attempts'); ?></th>
  834. <th><?php echo get_lang('LatestAttempt'); ?></th>
  835. <th><?php echo get_lang('AllAttempts'); ?></th>
  836. </tr>
  837. <?php
  838. $csv_content[] = array();
  839. $csv_content[] = array(
  840. get_lang('Exercises'),
  841. get_lang('LearningPath'),
  842. get_lang('AvgCourseScore'),
  843. get_lang('Attempts')
  844. );
  845. $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
  846. $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
  847. WHERE
  848. quiz.c_id = ".$info_course['real_id']." AND
  849. (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
  850. active IN (0, 1)
  851. ORDER BY quiz.title ASC ";
  852. $result_exercices = Database::query($sql);
  853. $i = 0;
  854. if (Database :: num_rows($result_exercices) > 0) {
  855. while ($exercices = Database :: fetch_array($result_exercices)) {
  856. $exercise_id = intval($exercices['id']);
  857. $count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $sessionId, 2);
  858. $score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 1, 0);
  859. if (!isset($score_percentage) && $count_attempts > 0) {
  860. $scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 2, 1);
  861. $score_percentage = $scores_lp[0];
  862. $lp_name = $scores_lp[1];
  863. } else {
  864. $lp_name = '-';
  865. }
  866. $lp_name = !empty($lp_name) ? $lp_name : get_lang('NoLearnpath');
  867. if ($i % 2) {
  868. $css_class = 'row_odd';
  869. } else {
  870. $css_class = 'row_even';
  871. }
  872. echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
  873. echo '<td>';
  874. if (!empty($lp_name)) {
  875. echo $lp_name;
  876. } else {
  877. echo '-';
  878. }
  879. echo '</td>';
  880. echo '<td>';
  881. if ($count_attempts > 0) {
  882. echo $score_percentage . '%';
  883. } else {
  884. echo '-';
  885. $score_percentage = 0;
  886. }
  887. echo '</td>';
  888. echo '<td>'.$count_attempts.'</td>';
  889. echo '<td>';
  890. $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
  891. WHERE
  892. exe_exo_id ="'.$exercise_id.'" AND
  893. exe_user_id ="'.$student_id.'" AND
  894. c_id = '.$courseInfo['real_id'].' AND
  895. session_id ="'.$sessionId.'" AND
  896. status = ""
  897. ORDER BY exe_date DESC
  898. LIMIT 1';
  899. $result_last_attempt = Database::query($sql);
  900. if (Database :: num_rows($result_last_attempt) > 0) {
  901. $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
  902. if ($count_attempts > 0)
  903. echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
  904. <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
  905. }
  906. echo '</td>';
  907. echo '<td>';
  908. $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
  909. echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
  910. echo '</td></tr>';
  911. $data_exercices[$i][] = $exercices['title'];
  912. $data_exercices[$i][] = $score_percentage . '%';
  913. $data_exercices[$i][] = $count_attempts;
  914. $csv_content[] = array(
  915. $exercices['title'],
  916. $lp_name,
  917. $score_percentage,
  918. $count_attempts
  919. );
  920. $i++;
  921. }
  922. } else {
  923. echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
  924. }
  925. echo '</table>';
  926. }
  927. //@when using sessions we do not show the survey list
  928. if (empty($sessionId)) {
  929. $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
  930. $survey_data = array();
  931. foreach($survey_list as $survey) {
  932. $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
  933. $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
  934. if (in_array($student_id, $user_list)) {
  935. $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL);
  936. }
  937. $data = array('title' => $survey['title'], 'done' => $survey_done);
  938. $survey_data[] = $data;
  939. }
  940. if (!empty($survey_list)) {
  941. $table = new HTML_Table(array('class' => 'data_table'));
  942. $header_names = array(get_lang('Survey'), get_lang('Answered'));
  943. $row = 0;
  944. $column = 0;
  945. foreach ($header_names as $item) {
  946. $table->setHeaderContents($row, $column, $item);
  947. $column++;
  948. }
  949. $row = 1;
  950. if (!empty($survey_data)) {
  951. foreach ($survey_data as $data) {
  952. $column = 0;
  953. $table->setCellContents($row, $column, $data);
  954. $class = 'class="row_odd"';
  955. if($row % 2) {
  956. $class = 'class="row_even"';
  957. }
  958. $table->setRowAttributes($row, $class, true);
  959. $column++;
  960. $row++;
  961. }
  962. }
  963. echo $table->toHtml();
  964. }
  965. }
  966. // line about other tools
  967. echo '<table class="data_table">';
  968. $csv_content[] = array ();
  969. $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
  970. $messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
  971. $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
  972. $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
  973. $documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
  974. $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
  975. $csv_content[] = array(
  976. get_lang('OtherTools')
  977. );
  978. $csv_content[] = array(
  979. get_lang('Student_publication'),
  980. $nb_assignments
  981. );
  982. $csv_content[] = array(
  983. get_lang('Messages'),
  984. $messages
  985. );
  986. $csv_content[] = array(
  987. get_lang('LinksDetails'),
  988. $links
  989. );
  990. $csv_content[] = array(
  991. get_lang('DocumentsDetails'),
  992. $documents
  993. );
  994. $csv_content[] = array(
  995. get_lang('UploadedDocuments'),
  996. $uploaded_documents
  997. );
  998. $csv_content[] = array(
  999. get_lang('ChatLastConnection'),
  1000. $chat_last_connection
  1001. );
  1002. ?>
  1003. <tr>
  1004. <th colspan="2"><?php echo get_lang('OtherTools'); ?></th>
  1005. </tr>
  1006. <tr><!-- assignments -->
  1007. <td width="40%"><?php echo get_lang('Student_publication') ?></td>
  1008. <td><?php echo $nb_assignments ?></td>
  1009. </tr>
  1010. <tr><!-- messages -->
  1011. <td><?php echo get_lang('Forum').' - '.get_lang('NumberOfPostsForThisUser') ?></td>
  1012. <td><?php echo $messages ?></td>
  1013. </tr>
  1014. <tr><!-- links -->
  1015. <td><?php echo get_lang('LinksDetails') ?></td>
  1016. <td><?php echo $links ?></td>
  1017. </tr>
  1018. <tr><!-- downloaded documents -->
  1019. <td><?php echo get_lang('DocumentsDetails') ?></td>
  1020. <td><?php echo $documents ?></td>
  1021. </tr>
  1022. <tr><!-- uploaded documents -->
  1023. <td><?php echo get_lang('UploadedDocuments') ?></td>
  1024. <td><?php echo $uploaded_documents ?></td>
  1025. </tr>
  1026. <tr><!-- Chats -->
  1027. <td><?php echo get_lang('ChatLastConnection') ?></td>
  1028. <td><?php echo $chat_last_connection; ?></td>
  1029. </tr>
  1030. </table>
  1031. </td>
  1032. </tr>
  1033. </table>
  1034. <?php
  1035. } //end details
  1036. }
  1037. if ($export) {
  1038. ob_end_clean();
  1039. switch ($export) {
  1040. case 'csv':
  1041. Export::arrayToCsv($csv_content, 'reporting_student');
  1042. break;
  1043. case 'xls':
  1044. Export::arrayToXls($csv_content, 'reporting_student');
  1045. break;
  1046. }
  1047. exit;
  1048. }
  1049. Display :: display_footer();