myStudents.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  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']) : '';
  317. if (!CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
  318. if (isset($courses[$key])) {
  319. unset($courses[$key]);
  320. }
  321. } else {
  322. $avg_student_progress = Tracking::get_avg_student_progress(
  323. $user_info['user_id'],
  324. $course_code,
  325. array(),
  326. $sessionId
  327. );
  328. //the score inside the Reporting table
  329. $avg_student_score = Tracking::get_avg_student_score(
  330. $user_info['user_id'],
  331. $course_code,
  332. array(),
  333. $sessionId
  334. );
  335. }
  336. $avg_student_progress = round($avg_student_progress, 2);
  337. // time spent on the course
  338. $courseInfo = api_get_course_info($course_code);
  339. $time_spent_on_the_course = 0;
  340. if (!empty($courseInfo)) {
  341. $time_spent_on_the_course = api_time_to_hms(
  342. Tracking:: get_time_spent_on_the_course(
  343. $user_info['user_id'],
  344. $courseInfo['real_id'],
  345. $sessionId
  346. )
  347. );
  348. }
  349. // get information about connections on the platform by student
  350. $first_connection_date = Tracking :: get_first_connection_date($user_info['user_id']);
  351. if ($first_connection_date == '') {
  352. $first_connection_date = get_lang('NoConnexion');
  353. }
  354. $last_connection_date = Tracking :: get_last_connection_date($user_info['user_id'], true);
  355. if ($last_connection_date == '') {
  356. $last_connection_date = get_lang('NoConnexion');
  357. }
  358. // cvs information
  359. $csv_content[] = array(
  360. get_lang('Information', '')
  361. );
  362. $csv_content[] = array (
  363. get_lang('Name', ''),
  364. get_lang('Email', ''),
  365. get_lang('Tel', '')
  366. );
  367. $csv_content[] = array(
  368. $user_info['complete_name'],
  369. $user_info['email'],
  370. $user_info['phone']
  371. );
  372. $csv_content[] = array();
  373. // csv tracking
  374. $csv_content[] = array(
  375. get_lang('Tracking', '')
  376. );
  377. $csv_content[] = array(
  378. get_lang('FirstLoginInPlatform', ''),
  379. get_lang('LatestLoginInPlatform', ''),
  380. get_lang('TimeSpentInTheCourse', ''),
  381. get_lang('Progress', ''),
  382. get_lang('Score', '')
  383. );
  384. $csv_content[] = array(
  385. strip_tags($first_connection_date),
  386. strip_tags($last_connection_date),
  387. $time_spent_on_the_course,
  388. $avg_student_progress . '%',
  389. $avg_student_score
  390. );
  391. //Show title
  392. $info_course = CourseManager :: get_course_information($course_code);
  393. $coachs_name = '';
  394. $session_name = '';
  395. $nb_login = Tracking :: count_login_per_student($user_info['user_id'], $info_course['real_id']);
  396. //get coach and session_name if there is one and if session_mode is activated
  397. if ($sessionId > 0) {
  398. $session_info = api_get_session_info($sessionId);
  399. $session_coach_id = $session_info['session_admin_id'];
  400. $course_coachs = api_get_coachs_from_course($sessionId, $info_course['real_id']);
  401. $nb_login = '';
  402. if (!empty($course_coachs)) {
  403. $info_tutor_name = array();
  404. foreach ($course_coachs as $course_coach) {
  405. $info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
  406. }
  407. $info_course['tutor_name'] = implode(",",$info_tutor_name);
  408. } elseif ($session_coach_id != 0) {
  409. $session_coach_id = intval($session_info['id_coach']);
  410. $coach_info = api_get_user_info($session_coach_id);
  411. $info_course['tutor_name'] = $coach_info['complete_name'];
  412. }
  413. $coachs_name = $info_course['tutor_name'];
  414. $session_name = $session_info['name'];
  415. } // end
  416. $info_course = CourseManager :: get_course_information($get_course_code);
  417. $table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
  418. echo Display::page_subheader($table_title);
  419. echo '<table width="100%" border="0">';
  420. echo '<tr>';
  421. $userPicture = UserManager::getUserPicture($user_info['user_id']);
  422. echo '<img src="' . $userPicture . '" />';
  423. echo '</td>';
  424. ?>
  425. <td width="40%" valign="top">
  426. <table width="100%" class="data_table">
  427. <tr>
  428. <th><?php echo get_lang('Information'); ?></th>
  429. </tr>
  430. <tr>
  431. <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
  432. </tr>
  433. <tr>
  434. <td><?php echo get_lang('Email') . ' : ';
  435. if (!empty ($user_info['email'])) {
  436. echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
  437. } else {
  438. echo get_lang('NoEmail');
  439. } ?>
  440. </td>
  441. </tr>
  442. <tr>
  443. <td> <?php echo get_lang('Tel') . ' : ';
  444. if (!empty ($user_info['phone'])) {
  445. echo $user_info['phone'];
  446. } else {
  447. echo get_lang('NoTel');
  448. }
  449. ?>
  450. </td>
  451. </tr>
  452. <tr>
  453. <td> <?php echo get_lang('OfficialCode') . ' : ';
  454. if (!empty ($user_info['official_code'])) {
  455. echo $user_info['official_code'];
  456. } else {
  457. echo get_lang('NoOfficialCode');
  458. }
  459. ?>
  460. </td>
  461. </tr>
  462. <tr>
  463. <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td>
  464. </tr>
  465. <?php
  466. // Display timezone if the user selected one and if the admin allows the use of user's timezone
  467. $timezone = null;
  468. $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'],'timezone');
  469. $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
  470. if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
  471. $timezone = $timezone_user['timezone'];
  472. }
  473. if ($timezone !== null) {
  474. ?>
  475. <tr>
  476. <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td>
  477. </tr>
  478. <?php
  479. }
  480. ?>
  481. </table>
  482. </td>
  483. <td class="borderLeft" width="35%" valign="top">
  484. <table width="100%" class="data_table">
  485. <tr>
  486. <th colspan="2"><?php echo get_lang('Tracking'); ?></th>
  487. </tr>
  488. <tr><td align="right"><?php echo get_lang('FirstLoginInPlatform') ?></td>
  489. <td align="left"><?php echo $first_connection_date ?></td>
  490. </tr>
  491. <tr>
  492. <td align="right"><?php echo get_lang('LatestLoginInPlatform') ?></td>
  493. <td align="left"><?php echo $last_connection_date ?></td>
  494. </tr>
  495. <?php if (isset($_GET['details']) && $_GET['details'] == 'true') {?>
  496. <tr>
  497. <td align="right"><?php echo get_lang('TimeSpentInTheCourse') ?></td>
  498. <td align="left"><?php echo $time_spent_on_the_course ?></td>
  499. </tr>
  500. <tr>
  501. <td align="right">
  502. <?php
  503. echo get_lang('Progress').' ';
  504. Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?>
  505. </td>
  506. <td align="left"><?php echo $avg_student_progress.'%' ?></td>
  507. </tr>
  508. <tr>
  509. <td align="right">
  510. <?php
  511. echo get_lang('Score').' ';
  512. Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
  513. </td>
  514. <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;} ?></td>
  515. </tr>
  516. <?php
  517. if (!empty($nb_login)) {
  518. echo '<tr><td align="right">'.get_lang('CountToolAccess').'</td>';
  519. echo '<td align="left"> '.$nb_login.'</td>';
  520. echo '</tr>';
  521. }
  522. } ?>
  523. </table>
  524. </td>
  525. </tr>
  526. </table>
  527. <?php
  528. $table_title = '';
  529. if (!empty($sessionId)) {
  530. $session_name = api_get_session_name($sessionId);
  531. $table_title = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'';
  532. }
  533. if (!empty($info_course['title'])) {
  534. $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].' ':'';
  535. }
  536. echo Display::page_subheader($table_title);
  537. if (empty($_GET['details'])) {
  538. $csv_content[] = array();
  539. $csv_content[] = array(
  540. get_lang('Session', ''),
  541. get_lang('Course', ''),
  542. get_lang('Time', ''),
  543. get_lang('Progress', ''),
  544. get_lang('Score', ''),
  545. get_lang('AttendancesFaults', ''),
  546. get_lang('Evaluations')
  547. );
  548. $attendance = new Attendance();
  549. foreach ($courses_in_session as $key => $courses) {
  550. $sessionId = $key;
  551. $session_info = api_get_session_info($sessionId);
  552. $session_name = '';
  553. if ($session_info) {
  554. $session_name = $session_info['name'];
  555. }
  556. $access_start_date = '';
  557. if (!empty($session_info['access_start_date']) && $session_info['access_start_date'] != '0000-00-00') {
  558. $access_start_date = api_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
  559. }
  560. $access_end_date = '';
  561. if (!empty($session_info['access_end_date']) && $session_info['access_end_date'] != '0000-00-00') {
  562. $access_end_date = api_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
  563. }
  564. $date_session = '';
  565. if (!empty($access_start_date) && !empty($access_end_date)) {
  566. $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
  567. }
  568. $title = '';
  569. if (empty($sessionId)) {
  570. $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
  571. } else {
  572. //$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
  573. }
  574. // Courses
  575. echo '<h3>'.$title.'</h3>';
  576. echo '<table class="data_table">';
  577. echo '<tr>
  578. <th>'.get_lang('Course').'</th>
  579. <th>'.get_lang('Time').'</th>
  580. <th>'.get_lang('Progress').'</th>
  581. <th>'.get_lang('Score').'</th>
  582. <th>'.get_lang('AttendancesFaults').'</th>
  583. <th>'.get_lang('Evaluations').'</th>
  584. <th>'.get_lang('Details').'</th>
  585. </tr>';
  586. if (!empty($courses)) {
  587. foreach ($courses as $courseId) {
  588. $courseInfo = api_get_course_info_by_id($courseId);
  589. $courseId = $courseInfo['real_id'];
  590. $course_code = $courseInfo['code'];
  591. if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
  592. $course_info = CourseManager :: get_course_information($course_code);
  593. $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId));
  594. // get average of faults in attendances by student
  595. $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $sessionId);
  596. if (!empty($results_faults_avg['total'])) {
  597. if (api_is_drh()) {
  598. $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>';
  599. } else {
  600. $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
  601. }
  602. } else {
  603. $attendances_faults_avg = '0/0 (0%)';
  604. }
  605. // Get evaluations by student
  606. $cats = Category::load(null, null, $course_code, null, null, $sessionId);
  607. $scoretotal = array();
  608. if (isset($cats) && isset($cats[0])) {
  609. if (!empty($sessionId)) {
  610. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
  611. } else {
  612. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
  613. }
  614. }
  615. $scoretotal_display = '0/0 (0%)';
  616. if (!empty($scoretotal)) {
  617. $scoretotal_display = round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
  618. }
  619. $progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
  620. $score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $sessionId);
  621. $progress = empty($progress) ? '0%' : $progress.'%';
  622. $score = empty($score) ? '0%' : $score.'%';
  623. $csv_content[] = array(
  624. $session_name,
  625. $course_info['title'],
  626. $time_spent_on_course,
  627. $progress,
  628. $score,
  629. $attendances_faults_avg,
  630. $scoretotal_display
  631. );
  632. echo '<tr>
  633. <td >'.$course_info['title'].'</td>
  634. <td >'.$time_spent_on_course .'</td>
  635. <td >'.$progress.'</td>
  636. <td >'.$score.'</td>
  637. <td >'.$attendances_faults_avg.'</td>
  638. <td >'.$scoretotal_display.'</td>';
  639. if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  640. 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">
  641. <img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
  642. } else {
  643. 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">
  644. <img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
  645. }
  646. echo '</tr>';
  647. }
  648. }
  649. } else {
  650. echo "<tr><td colspan='5'>".get_lang('NoCourse')."</td></tr>";
  651. }
  652. echo '</table>';
  653. }
  654. } else {
  655. if ($user_info['status'] != INVITEE) {
  656. $csv_content[] = array();
  657. $csv_content[] = array(str_replace('&nbsp;', '', $table_title));
  658. $t_lp = Database :: get_course_table(TABLE_LP_MAIN);
  659. // csv export headers
  660. $csv_content[] = array();
  661. $csv_content[] = array(
  662. get_lang('Learnpath'),
  663. get_lang('Time'),
  664. get_lang('AverageScore'),
  665. get_lang('LatestAttemptAverageScore'),
  666. get_lang('Progress'),
  667. get_lang('LastConnexion')
  668. );
  669. if (empty($sessionId)) {
  670. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  671. WHERE session_id = 0 AND c_id = {$info_course['real_id']}
  672. ORDER BY lp.display_order";
  673. } else {
  674. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  675. WHERE c_id = {$info_course['real_id']}
  676. ORDER BY lp.display_order";
  677. }
  678. $rs_lp = Database::query($sql_lp);
  679. if (Database :: num_rows($rs_lp) > 0) {
  680. ?>
  681. <!-- LPs-->
  682. <table class="data_table">
  683. <tr>
  684. <th><?php echo get_lang('Learnpaths');?></th>
  685. <th><?php
  686. echo get_lang('Time').' ';
  687. Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  688. <th><?php
  689. echo get_lang('AverageScore').' ';
  690. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  691. <th><?php
  692. echo get_lang('LatestAttemptAverageScore').' ';
  693. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  694. <th><?php
  695. echo get_lang('Progress').' ';
  696. Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  697. <th><?php
  698. echo get_lang('LastConnexion').' ';
  699. Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  700. <?php
  701. echo '<th>'.get_lang('Details').'</th>';
  702. if (api_is_allowed_to_edit()) {
  703. echo '<th>'.get_lang('ResetLP').'</th>';
  704. }
  705. ?>
  706. </tr>
  707. <?php
  708. $i = 0;
  709. while ($learnpath = Database :: fetch_array($rs_lp)) {
  710. $lp_id = intval($learnpath['id']);
  711. $lp_name = $learnpath['name'];
  712. $any_result = false;
  713. // Get progress in lp
  714. $progress = Tracking::get_avg_student_progress(
  715. $student_id,
  716. $course_code,
  717. array($lp_id),
  718. $sessionId
  719. );
  720. if ($progress === null) {
  721. $progress = '0%';
  722. } else {
  723. $any_result = true;
  724. }
  725. // Get time in lp
  726. $total_time = Tracking::get_time_spent_in_lp(
  727. $student_id,
  728. $course_code,
  729. array($lp_id),
  730. $sessionId
  731. );
  732. if (!empty($total_time)) {
  733. $any_result = true;
  734. }
  735. // Get last connection time in lp
  736. $start_time = Tracking::get_last_connection_time_in_lp(
  737. $student_id,
  738. $course_code,
  739. $lp_id,
  740. $sessionId
  741. );
  742. if (!empty($start_time)) {
  743. $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
  744. } else {
  745. $start_time = '-';
  746. }
  747. if (!empty($total_time)) $any_result = true;
  748. // Quiz in lp
  749. $score = Tracking::get_avg_student_score(
  750. $student_id,
  751. $course_code,
  752. array($lp_id),
  753. $sessionId
  754. );
  755. // Latest exercise results in a LP
  756. $score_latest = Tracking:: get_avg_student_score(
  757. $student_id,
  758. $course_code,
  759. array($lp_id),
  760. $sessionId,
  761. false,
  762. true
  763. );
  764. if ($i % 2 == 0) $css_class = "row_even";
  765. else $css_class = "row_odd";
  766. $i++;
  767. // csv export content
  768. $csv_content[] = array (
  769. api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
  770. api_time_to_hms($total_time),
  771. $score . '%',
  772. $score_latest . '%',
  773. $progress.'%',
  774. $start_time
  775. );
  776. echo '<tr class="'.$css_class.'">';
  777. echo Display::tag('td', stripslashes($lp_name));
  778. echo Display::tag('td', api_time_to_hms($total_time));
  779. if (!is_null($score)) {
  780. if (is_numeric($score)) {
  781. $score = $score.'%';
  782. }
  783. }
  784. echo Display::tag('td', $score);
  785. if (!is_null($score_latest)) {
  786. if (is_numeric($score_latest)) {
  787. $score_latest = $score_latest.'%';
  788. }
  789. }
  790. echo Display::tag('td', $score_latest);
  791. if (is_numeric($progress)) {
  792. $progress = $progress.'%';
  793. } else {
  794. $progress = '-';
  795. }
  796. echo Display::tag('td', $progress);
  797. //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
  798. //which implies several other changes not a priority right now
  799. echo Display::tag('td', $start_time);
  800. if ($any_result === true) {
  801. $from = '';
  802. if ($from_myspace) {
  803. $from ='&from=myspace';
  804. }
  805. $link = Display::url(
  806. '<img src="../img/2rightarrow.gif" border="0" />',
  807. '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
  808. );
  809. echo Display::tag('td', $link);
  810. }
  811. if (api_is_allowed_to_edit()) {
  812. echo '<td>';
  813. if ($any_result === true) {
  814. 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.'">';
  815. echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
  816. echo '</a>';
  817. }
  818. echo '</td>';
  819. echo '</tr>';
  820. }
  821. $data_learnpath[$i][] = $lp_name;
  822. $data_learnpath[$i][] = $progress . '%';
  823. }
  824. } else {
  825. //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
  826. }
  827. ?>
  828. </table>
  829. <?php } ?>
  830. <!-- line about exercises -->
  831. <?php if ($user_info['status'] != INVITEE) { ?>
  832. <table class="data_table">
  833. <tr>
  834. <th><?php echo get_lang('Exercises'); ?></th>
  835. <th><?php echo get_lang('LearningPath');?></th>
  836. <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
  837. <th><?php echo get_lang('Attempts'); ?></th>
  838. <th><?php echo get_lang('LatestAttempt'); ?></th>
  839. <th><?php echo get_lang('AllAttempts'); ?></th>
  840. </tr>
  841. <?php
  842. $csv_content[] = array();
  843. $csv_content[] = array(
  844. get_lang('Exercises'),
  845. get_lang('LearningPath'),
  846. get_lang('AvgCourseScore'),
  847. get_lang('Attempts')
  848. );
  849. $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
  850. $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
  851. WHERE
  852. quiz.c_id = ".$info_course['real_id']." AND
  853. (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
  854. active IN (0, 1)
  855. ORDER BY quiz.title ASC ";
  856. $result_exercices = Database::query($sql);
  857. $i = 0;
  858. if (Database :: num_rows($result_exercices) > 0) {
  859. while ($exercices = Database :: fetch_array($result_exercices)) {
  860. $exercise_id = intval($exercices['id']);
  861. $count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $sessionId, 2);
  862. $score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 1, 0);
  863. if (!isset($score_percentage) && $count_attempts > 0) {
  864. $scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 2, 1);
  865. $score_percentage = $scores_lp[0];
  866. $lp_name = $scores_lp[1];
  867. } else {
  868. $lp_name = '-';
  869. }
  870. $lp_name = !empty($lp_name) ? $lp_name : get_lang('NoLearnpath');
  871. if ($i % 2) {
  872. $css_class = 'row_odd';
  873. } else {
  874. $css_class = 'row_even';
  875. }
  876. echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
  877. echo '<td>';
  878. if (!empty($lp_name)) {
  879. echo $lp_name;
  880. } else {
  881. echo '-';
  882. }
  883. echo '</td>';
  884. echo '<td>';
  885. if ($count_attempts > 0) {
  886. echo $score_percentage . '%';
  887. } else {
  888. echo '-';
  889. $score_percentage = 0;
  890. }
  891. echo '</td>';
  892. echo '<td>'.$count_attempts.'</td>';
  893. echo '<td>';
  894. $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
  895. WHERE
  896. exe_exo_id ="'.$exercise_id.'" AND
  897. exe_user_id ="'.$student_id.'" AND
  898. c_id = '.$courseInfo['real_id'].' AND
  899. session_id ="'.$sessionId.'" AND
  900. status = ""
  901. ORDER BY exe_date DESC
  902. LIMIT 1';
  903. $result_last_attempt = Database::query($sql);
  904. if (Database :: num_rows($result_last_attempt) > 0) {
  905. $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
  906. if ($count_attempts > 0)
  907. 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).'">
  908. <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
  909. }
  910. echo '</td>';
  911. echo '<td>';
  912. $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
  913. echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
  914. echo '</td></tr>';
  915. $data_exercices[$i][] = $exercices['title'];
  916. $data_exercices[$i][] = $score_percentage . '%';
  917. $data_exercices[$i][] = $count_attempts;
  918. $csv_content[] = array(
  919. $exercices['title'],
  920. $lp_name,
  921. $score_percentage,
  922. $count_attempts
  923. );
  924. $i++;
  925. }
  926. } else {
  927. echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
  928. }
  929. echo '</table>';
  930. }
  931. //@when using sessions we do not show the survey list
  932. if (empty($sessionId)) {
  933. $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
  934. $survey_data = array();
  935. foreach($survey_list as $survey) {
  936. $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
  937. $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
  938. if (in_array($student_id, $user_list)) {
  939. $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL);
  940. }
  941. $data = array('title' => $survey['title'], 'done' => $survey_done);
  942. $survey_data[] = $data;
  943. }
  944. if (!empty($survey_list)) {
  945. $table = new HTML_Table(array('class' => 'data_table'));
  946. $header_names = array(get_lang('Survey'), get_lang('Answered'));
  947. $row = 0;
  948. $column = 0;
  949. foreach ($header_names as $item) {
  950. $table->setHeaderContents($row, $column, $item);
  951. $column++;
  952. }
  953. $row = 1;
  954. if (!empty($survey_data)) {
  955. foreach ($survey_data as $data) {
  956. $column = 0;
  957. $table->setCellContents($row, $column, $data);
  958. $class = 'class="row_odd"';
  959. if($row % 2) {
  960. $class = 'class="row_even"';
  961. }
  962. $table->setRowAttributes($row, $class, true);
  963. $column++;
  964. $row++;
  965. }
  966. }
  967. echo $table->toHtml();
  968. }
  969. }
  970. // line about other tools
  971. echo '<table class="data_table">';
  972. $csv_content[] = array ();
  973. $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
  974. $messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
  975. $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
  976. $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
  977. $documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
  978. $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
  979. $csv_content[] = array(
  980. get_lang('OtherTools')
  981. );
  982. $csv_content[] = array(
  983. get_lang('Student_publication'),
  984. $nb_assignments
  985. );
  986. $csv_content[] = array(
  987. get_lang('Messages'),
  988. $messages
  989. );
  990. $csv_content[] = array(
  991. get_lang('LinksDetails'),
  992. $links
  993. );
  994. $csv_content[] = array(
  995. get_lang('DocumentsDetails'),
  996. $documents
  997. );
  998. $csv_content[] = array(
  999. get_lang('UploadedDocuments'),
  1000. $uploaded_documents
  1001. );
  1002. $csv_content[] = array(
  1003. get_lang('ChatLastConnection'),
  1004. $chat_last_connection
  1005. );
  1006. ?>
  1007. <tr>
  1008. <th colspan="2"><?php echo get_lang('OtherTools'); ?></th>
  1009. </tr>
  1010. <tr><!-- assignments -->
  1011. <td width="40%"><?php echo get_lang('Student_publication') ?></td>
  1012. <td><?php echo $nb_assignments ?></td>
  1013. </tr>
  1014. <tr><!-- messages -->
  1015. <td><?php echo get_lang('Forum').' - '.get_lang('NumberOfPostsForThisUser') ?></td>
  1016. <td><?php echo $messages ?></td>
  1017. </tr>
  1018. <tr><!-- links -->
  1019. <td><?php echo get_lang('LinksDetails') ?></td>
  1020. <td><?php echo $links ?></td>
  1021. </tr>
  1022. <tr><!-- downloaded documents -->
  1023. <td><?php echo get_lang('DocumentsDetails') ?></td>
  1024. <td><?php echo $documents ?></td>
  1025. </tr>
  1026. <tr><!-- uploaded documents -->
  1027. <td><?php echo get_lang('UploadedDocuments') ?></td>
  1028. <td><?php echo $uploaded_documents ?></td>
  1029. </tr>
  1030. <tr><!-- Chats -->
  1031. <td><?php echo get_lang('ChatLastConnection') ?></td>
  1032. <td><?php echo $chat_last_connection; ?></td>
  1033. </tr>
  1034. </table>
  1035. </td>
  1036. </tr>
  1037. </table>
  1038. <?php
  1039. } //end details
  1040. }
  1041. if ($export) {
  1042. ob_end_clean();
  1043. switch ($export) {
  1044. case 'csv':
  1045. Export::arrayToCsv($csv_content, 'reporting_student');
  1046. break;
  1047. case 'xls':
  1048. Export::arrayToXls($csv_content, 'reporting_student');
  1049. break;
  1050. }
  1051. exit;
  1052. }
  1053. Display :: display_footer();