myStudents.php 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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(
  590. Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId)
  591. );
  592. // get average of faults in attendances by student
  593. $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $sessionId);
  594. if (!empty($results_faults_avg['total'])) {
  595. if (api_is_drh()) {
  596. $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>';
  597. } else {
  598. $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
  599. }
  600. } else {
  601. $attendances_faults_avg = '0/0 (0%)';
  602. }
  603. // Get evaluations by student
  604. $cats = Category::load(null, null, $course_code, null, null, $sessionId);
  605. $scoretotal = array();
  606. if (isset($cats) && isset($cats[0])) {
  607. if (!empty($sessionId)) {
  608. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
  609. } else {
  610. $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
  611. }
  612. }
  613. $scoretotal_display = '0/0 (0%)';
  614. if (!empty($scoretotal)) {
  615. $scoretotal_display = round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
  616. }
  617. $progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
  618. $score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $sessionId);
  619. $progress = empty($progress) ? '0%' : $progress.'%';
  620. $score = empty($score) ? '0%' : $score.'%';
  621. $csv_content[] = array(
  622. $session_name,
  623. $course_info['title'],
  624. $time_spent_on_course,
  625. $progress,
  626. $score,
  627. $attendances_faults_avg,
  628. $scoretotal_display
  629. );
  630. echo '<tr>
  631. <td ><a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['directory'] .'/?id_session=' . $sessionId . '">'.$course_info['title'].'</a></td>
  632. <td >'.$time_spent_on_course .'</td>
  633. <td >'.$progress.'</td>
  634. <td >'.$score.'</td>
  635. <td >'.$attendances_faults_avg.'</td>
  636. <td >'.$scoretotal_display.'</td>';
  637. if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  638. 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">
  639. '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
  640. } else {
  641. 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">
  642. '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a></td>';
  643. }
  644. echo '</tr>';
  645. }
  646. }
  647. } else {
  648. echo "<tr><td colspan='5'>".get_lang('NoCourse')."</td></tr>";
  649. }
  650. echo '</table>';
  651. }
  652. } else {
  653. if ($user_info['status'] != INVITEE) {
  654. $csv_content[] = array();
  655. $csv_content[] = array(str_replace('&nbsp;', '', $table_title));
  656. $t_lp = Database :: get_course_table(TABLE_LP_MAIN);
  657. // csv export headers
  658. $csv_content[] = array();
  659. $csv_content[] = array(
  660. get_lang('Learnpath'),
  661. get_lang('Time'),
  662. get_lang('AverageScore'),
  663. get_lang('LatestAttemptAverageScore'),
  664. get_lang('Progress'),
  665. get_lang('LastConnexion')
  666. );
  667. if (empty($sessionId)) {
  668. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  669. WHERE session_id = 0 AND c_id = {$info_course['real_id']}
  670. ORDER BY lp.display_order";
  671. } else {
  672. $sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
  673. WHERE c_id = {$info_course['real_id']}
  674. ORDER BY lp.display_order";
  675. }
  676. $rs_lp = Database::query($sql_lp);
  677. if (Database :: num_rows($rs_lp) > 0) {
  678. ?>
  679. <!-- LPs-->
  680. <table class="data_table">
  681. <tr>
  682. <th><?php echo get_lang('Learnpaths');?></th>
  683. <th><?php
  684. echo get_lang('Time').' ';
  685. Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  686. <th><?php
  687. echo get_lang('AverageScore').' ';
  688. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  689. <th><?php
  690. echo get_lang('LatestAttemptAverageScore').' ';
  691. Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
  692. <th><?php
  693. echo get_lang('Progress').' ';
  694. Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  695. <th><?php
  696. echo get_lang('LastConnexion').' ';
  697. Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
  698. <?php
  699. echo '<th>'.get_lang('Details').'</th>';
  700. if (api_is_allowed_to_edit()) {
  701. echo '<th>'.get_lang('ResetLP').'</th>';
  702. }
  703. ?>
  704. </tr>
  705. <?php
  706. $i = 0;
  707. while ($learnpath = Database :: fetch_array($rs_lp)) {
  708. $lp_id = intval($learnpath['id']);
  709. $lp_name = $learnpath['name'];
  710. $any_result = false;
  711. // Get progress in lp
  712. $progress = Tracking::get_avg_student_progress(
  713. $student_id,
  714. $course_code,
  715. array($lp_id),
  716. $sessionId
  717. );
  718. if ($progress === null) {
  719. $progress = '0%';
  720. } else {
  721. $any_result = true;
  722. }
  723. // Get time in lp
  724. $total_time = Tracking::get_time_spent_in_lp(
  725. $student_id,
  726. $course_code,
  727. array($lp_id),
  728. $sessionId
  729. );
  730. if (!empty($total_time)) {
  731. $any_result = true;
  732. }
  733. // Get last connection time in lp
  734. $start_time = Tracking::get_last_connection_time_in_lp(
  735. $student_id,
  736. $course_code,
  737. $lp_id,
  738. $sessionId
  739. );
  740. if (!empty($start_time)) {
  741. $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
  742. } else {
  743. $start_time = '-';
  744. }
  745. if (!empty($total_time)) $any_result = true;
  746. // Quiz in lp
  747. $score = Tracking::get_avg_student_score(
  748. $student_id,
  749. $course_code,
  750. array($lp_id),
  751. $sessionId
  752. );
  753. // Latest exercise results in a LP
  754. $score_latest = Tracking:: get_avg_student_score(
  755. $student_id,
  756. $course_code,
  757. array($lp_id),
  758. $sessionId,
  759. false,
  760. true
  761. );
  762. if ($i % 2 == 0) $css_class = "row_even";
  763. else $css_class = "row_odd";
  764. $i++;
  765. // csv export content
  766. $csv_content[] = array (
  767. api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
  768. api_time_to_hms($total_time),
  769. $score . '%',
  770. $score_latest . '%',
  771. $progress.'%',
  772. $start_time
  773. );
  774. echo '<tr class="'.$css_class.'">';
  775. echo Display::tag('td', stripslashes($lp_name));
  776. echo Display::tag('td', api_time_to_hms($total_time));
  777. if (!is_null($score)) {
  778. if (is_numeric($score)) {
  779. $score = $score.'%';
  780. }
  781. }
  782. echo Display::tag('td', $score);
  783. if (!is_null($score_latest)) {
  784. if (is_numeric($score_latest)) {
  785. $score_latest = $score_latest.'%';
  786. }
  787. }
  788. echo Display::tag('td', $score_latest);
  789. if (is_numeric($progress)) {
  790. $progress = $progress.'%';
  791. } else {
  792. $progress = '-';
  793. }
  794. echo Display::tag('td', $progress);
  795. //Do not change with api_convert_and_format_date, because this value came from the lp_item_view table
  796. //which implies several other changes not a priority right now
  797. echo Display::tag('td', $start_time);
  798. if ($any_result === true) {
  799. $from = '';
  800. if ($from_myspace) {
  801. $from ='&from=myspace';
  802. }
  803. $link = Display::url(
  804. '<img src="../img/icons/22/2rightarrow.png" border="0" />',
  805. '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
  806. );
  807. echo Display::tag('td', $link);
  808. }
  809. if (api_is_allowed_to_edit()) {
  810. echo '<td>';
  811. if ($any_result === true) {
  812. 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.'">';
  813. echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
  814. echo '</a>';
  815. }
  816. echo '</td>';
  817. echo '</tr>';
  818. }
  819. $data_learnpath[$i][] = $lp_name;
  820. $data_learnpath[$i][] = $progress . '%';
  821. }
  822. } else {
  823. //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
  824. }
  825. ?>
  826. </table>
  827. <?php } ?>
  828. <!-- line about exercises -->
  829. <?php if ($user_info['status'] != INVITEE) { ?>
  830. <table class="data_table">
  831. <tr>
  832. <th><?php echo get_lang('Exercises'); ?></th>
  833. <th><?php echo get_lang('LearningPath');?></th>
  834. <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
  835. <th><?php echo get_lang('Attempts'); ?></th>
  836. <th><?php echo get_lang('LatestAttempt'); ?></th>
  837. <th><?php echo get_lang('AllAttempts'); ?></th>
  838. </tr>
  839. <?php
  840. $csv_content[] = array();
  841. $csv_content[] = array(
  842. get_lang('Exercises'),
  843. get_lang('LearningPath'),
  844. get_lang('AvgCourseScore'),
  845. get_lang('Attempts')
  846. );
  847. $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
  848. $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
  849. WHERE
  850. quiz.c_id = ".$info_course['real_id']." AND
  851. (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
  852. active IN (0, 1)
  853. ORDER BY quiz.title ASC ";
  854. $result_exercices = Database::query($sql);
  855. $i = 0;
  856. if (Database :: num_rows($result_exercices) > 0) {
  857. while ($exercices = Database :: fetch_array($result_exercices)) {
  858. $exercise_id = intval($exercices['id']);
  859. $count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $sessionId, 2);
  860. $score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 1, 0);
  861. if (!isset($score_percentage) && $count_attempts > 0) {
  862. $scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 2, 1);
  863. $score_percentage = $scores_lp[0];
  864. $lp_name = $scores_lp[1];
  865. } else {
  866. $lp_name = '-';
  867. }
  868. $lp_name = !empty($lp_name) ? $lp_name : get_lang('NoLearnpath');
  869. if ($i % 2) {
  870. $css_class = 'row_odd';
  871. } else {
  872. $css_class = 'row_even';
  873. }
  874. echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
  875. echo '<td>';
  876. if (!empty($lp_name)) {
  877. echo $lp_name;
  878. } else {
  879. echo '-';
  880. }
  881. echo '</td>';
  882. echo '<td>';
  883. if ($count_attempts > 0) {
  884. echo $score_percentage . '%';
  885. } else {
  886. echo '-';
  887. $score_percentage = 0;
  888. }
  889. echo '</td>';
  890. echo '<td>'.$count_attempts.'</td>';
  891. echo '<td>';
  892. $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
  893. WHERE
  894. exe_exo_id ="'.$exercise_id.'" AND
  895. exe_user_id ="'.$student_id.'" AND
  896. c_id = '.$courseInfo['real_id'].' AND
  897. session_id ="'.$sessionId.'" AND
  898. status = ""
  899. ORDER BY exe_date DESC
  900. LIMIT 1';
  901. $result_last_attempt = Database::query($sql);
  902. if (Database :: num_rows($result_last_attempt) > 0) {
  903. $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
  904. if ($count_attempts > 0)
  905. 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).'">
  906. <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
  907. }
  908. echo '</td>';
  909. echo '<td>';
  910. $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
  911. echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
  912. echo '</td></tr>';
  913. $data_exercices[$i][] = $exercices['title'];
  914. $data_exercices[$i][] = $score_percentage . '%';
  915. $data_exercices[$i][] = $count_attempts;
  916. $csv_content[] = array(
  917. $exercices['title'],
  918. $lp_name,
  919. $score_percentage,
  920. $count_attempts
  921. );
  922. $i++;
  923. }
  924. } else {
  925. echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
  926. }
  927. echo '</table>';
  928. }
  929. //@when using sessions we do not show the survey list
  930. if (empty($sessionId)) {
  931. $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
  932. $survey_data = array();
  933. foreach($survey_list as $survey) {
  934. $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
  935. $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
  936. if (in_array($student_id, $user_list)) {
  937. $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL);
  938. }
  939. $data = array('title' => $survey['title'], 'done' => $survey_done);
  940. $survey_data[] = $data;
  941. }
  942. if (!empty($survey_list)) {
  943. $table = new HTML_Table(array('class' => 'data_table'));
  944. $header_names = array(get_lang('Survey'), get_lang('Answered'));
  945. $row = 0;
  946. $column = 0;
  947. foreach ($header_names as $item) {
  948. $table->setHeaderContents($row, $column, $item);
  949. $column++;
  950. }
  951. $row = 1;
  952. if (!empty($survey_data)) {
  953. foreach ($survey_data as $data) {
  954. $column = 0;
  955. $table->setCellContents($row, $column, $data);
  956. $class = 'class="row_odd"';
  957. if($row % 2) {
  958. $class = 'class="row_even"';
  959. }
  960. $table->setRowAttributes($row, $class, true);
  961. $column++;
  962. $row++;
  963. }
  964. }
  965. echo $table->toHtml();
  966. }
  967. }
  968. // line about other tools
  969. echo '<table class="data_table">';
  970. $csv_content[] = array ();
  971. $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
  972. $messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
  973. $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
  974. $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
  975. $documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
  976. $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
  977. $csv_content[] = array(
  978. get_lang('OtherTools')
  979. );
  980. $csv_content[] = array(
  981. get_lang('Student_publication'),
  982. $nb_assignments
  983. );
  984. $csv_content[] = array(
  985. get_lang('Messages'),
  986. $messages
  987. );
  988. $csv_content[] = array(
  989. get_lang('LinksDetails'),
  990. $links
  991. );
  992. $csv_content[] = array(
  993. get_lang('DocumentsDetails'),
  994. $documents
  995. );
  996. $csv_content[] = array(
  997. get_lang('UploadedDocuments'),
  998. $uploaded_documents
  999. );
  1000. $csv_content[] = array(
  1001. get_lang('ChatLastConnection'),
  1002. $chat_last_connection
  1003. );
  1004. ?>
  1005. <tr>
  1006. <th colspan="2"><?php echo get_lang('OtherTools'); ?></th>
  1007. </tr>
  1008. <tr><!-- assignments -->
  1009. <td width="40%"><?php echo get_lang('Student_publication') ?></td>
  1010. <td><?php echo $nb_assignments ?></td>
  1011. </tr>
  1012. <tr><!-- messages -->
  1013. <td><?php echo get_lang('Forum').' - '.get_lang('NumberOfPostsForThisUser') ?></td>
  1014. <td><?php echo $messages ?></td>
  1015. </tr>
  1016. <tr><!-- links -->
  1017. <td><?php echo get_lang('LinksDetails') ?></td>
  1018. <td><?php echo $links ?></td>
  1019. </tr>
  1020. <tr><!-- downloaded documents -->
  1021. <td><?php echo get_lang('DocumentsDetails') ?></td>
  1022. <td><?php echo $documents ?></td>
  1023. </tr>
  1024. <tr><!-- uploaded documents -->
  1025. <td><?php echo get_lang('UploadedDocuments') ?></td>
  1026. <td><?php echo $uploaded_documents ?></td>
  1027. </tr>
  1028. <tr><!-- Chats -->
  1029. <td><?php echo get_lang('ChatLastConnection') ?></td>
  1030. <td><?php echo $chat_last_connection; ?></td>
  1031. </tr>
  1032. </table>
  1033. </td>
  1034. </tr>
  1035. </table>
  1036. <?php
  1037. } //end details
  1038. }
  1039. if ($export) {
  1040. ob_end_clean();
  1041. switch ($export) {
  1042. case 'csv':
  1043. Export::arrayToCsv($csv_content, 'reporting_student');
  1044. break;
  1045. case 'xls':
  1046. Export::arrayToXls($csv_content, 'reporting_student');
  1047. break;
  1048. }
  1049. exit;
  1050. }
  1051. Display :: display_footer();