myStudents.php 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. <?php
  2. //$Id: myStudents.php 21874 2009-07-08 08:45:18Z herodoto $
  3. /* For licensing terms, see /dokeos_license.txt */
  4. /**
  5. * Implements the tracking of students in the Reporting pages
  6. * @package dokeos.mySpace
  7. */
  8. // name of the language file that needs to be included
  9. $language_file = array('registration', 'index', 'tracking', 'exercice', 'admin');
  10. require '../inc/global.inc.php';
  11. require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
  12. require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  13. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  14. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  15. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
  16. require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php';
  17. $htmlHeadXtra[] = '<script type="text/javascript">
  18. function show_image(image,width,height) {
  19. width = parseInt(width) + 20;
  20. height = parseInt(height) + 20;
  21. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
  22. }
  23. </script>';
  24. $export_csv = isset ($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  25. if ($export_csv) {
  26. ob_start();
  27. }
  28. $csv_content = array ();
  29. $from_myspace = false;
  30. if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
  31. $from_myspace = true;
  32. $this_section = "session_my_space";
  33. } else {
  34. $this_section = SECTION_COURSES;
  35. }
  36. $nameTools = get_lang("StudentDetails");
  37. //$nameTools = SECTION_PLATFORM_ADMIN;
  38. $cidReset = true;
  39. $get_course_code = Security :: remove_XSS($_GET['course']);
  40. if (isset ($_GET['details'])) {
  41. if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') {
  42. $course_info = CourseManager :: get_course_information($get_course_code);
  43. if (empty ($cidReq)) {
  44. $interbreadcrumb[] = array (
  45. "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
  46. 'name' => $course_info['title']
  47. );
  48. }
  49. $interbreadcrumb[] = array (
  50. "url" => "../user/user.php?cidReq=" . $get_course_code,
  51. "name" => get_lang("Users")
  52. );
  53. } else
  54. if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
  55. $course_info = CourseManager :: get_course_information($get_course_code);
  56. if (empty ($cidReq)) {
  57. //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']);
  58. }
  59. $interbreadcrumb[] = array (
  60. "url" => "../tracking/courseLog.php?cidReq=" . $get_course_code . '&studentlist=true&id_session=' . (empty ($_SESSION['id_session']) ? '' : $_SESSION['id_session']),
  61. "name" => get_lang("Tracking")
  62. );
  63. } else
  64. if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
  65. $interbreadcrumb[] = array (
  66. 'url' => '../admin/index.php',
  67. "name" => get_lang('PlatformAdmin')
  68. );
  69. $interbreadcrumb[] = array (
  70. 'url' => "../admin/session_list.php",
  71. "name" => get_lang('SessionList')
  72. );
  73. $interbreadcrumb[] = array (
  74. 'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
  75. "name" => get_lang('SessionOverview')
  76. );
  77. } else {
  78. $interbreadcrumb[] = array (
  79. "url" => "index.php",
  80. "name" => get_lang('MySpace')
  81. );
  82. if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  83. $interbreadcrumb[] = array (
  84. "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
  85. "name" => get_lang("CoachStudents")
  86. );
  87. $interbreadcrumb[] = array (
  88. "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
  89. "name" => get_lang("StudentDetails")
  90. );
  91. } else {
  92. $interbreadcrumb[] = array (
  93. "url" => "student.php",
  94. "name" => get_lang("MyStudents")
  95. );
  96. $interbreadcrumb[] = array (
  97. "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
  98. "name" => get_lang("StudentDetails")
  99. );
  100. }
  101. }
  102. $nameTools = get_lang("DetailsStudentInCourse");
  103. } else {
  104. if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
  105. $interbreadcrumb[] = array (
  106. 'url' => '../admin/index.php',
  107. "name" => get_lang('PlatformAdmin')
  108. );
  109. $interbreadcrumb[] = array (
  110. 'url' => "../admin/session_list.php",
  111. "name" => get_lang('SessionList')
  112. );
  113. $interbreadcrumb[] = array (
  114. 'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
  115. "name" => get_lang('SessionOverview')
  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 (isset ($_GET['id_session']) && intval($_GET['id_session']) != 0) {
  124. $interbreadcrumb[] = array (
  125. "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $_GET['id_session'],
  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. api_block_anonymous_users();
  143. if (!api_is_allowed_to_edit() && !api_is_coach() && $_user['status'] != DRH && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) {
  144. api_not_allowed(true);
  145. }
  146. Display :: display_header($nameTools);
  147. /*
  148. * ======================================================================================
  149. * FUNCTIONS
  150. * ======================================================================================
  151. */
  152. function is_teacher($course_code) {
  153. global $_user;
  154. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  155. $sql = "SELECT 1 FROM $tbl_course_user WHERE user_id='" . $_user["user_id"] . "' AND course_code='" . Database :: escape_string($course_code) . "' AND status='1'";
  156. $result = Database::query($sql, __FILE__, __LINE__);
  157. if (Database :: result($result) != 1) {
  158. return true;
  159. } else {
  160. return false;
  161. }
  162. }
  163. /*
  164. *===============================================================================
  165. * MAIN CODE
  166. *===============================================================================
  167. */
  168. // Database Table Definitions
  169. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  170. $tbl_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
  171. $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
  172. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  173. $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  174. $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
  175. $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  176. $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  177. $tbl_stats_exercices_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
  178. //$tbl_course_lp_view = Database :: get_course_table(TABLE_LP_VIEW);
  179. //$tbl_course_lp_view_item = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
  180. //$tbl_course_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
  181. $tbl_course_lp_view = 'lp_view';
  182. $tbl_course_lp_view_item = 'lp_item_view';
  183. $tbl_course_lp_item = 'lp_item';
  184. $tbl_course_lp = 'lp';
  185. $tbl_course_quiz = 'quiz';
  186. $course_quiz_question = 'quiz_question';
  187. $course_quiz_rel_question = 'quiz_rel_question';
  188. $course_quiz_answer = 'quiz_answer';
  189. $course_student_publication = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
  190. if (isset ($_GET["user_id"]) && $_GET["user_id"] != "") {
  191. $user_id = intval($_GET['user_id']);
  192. } else {
  193. $user_id = $_user['user_id'];
  194. }
  195. if (!empty ($_GET['student'])) {
  196. $student_id = intval($_GET['student']);
  197. // infos about user
  198. $info_user = UserManager :: get_user_info_by_id($student_id);
  199. if ($_user['status'] == DRH && $info_user['hr_dept_id'] != $_user['user_id']) {
  200. api_not_allowed();
  201. }
  202. $info_user['name'] = api_get_person_name($info_user['firstname'], $info_user['lastname']);
  203. // Actions bar
  204. echo '<div class="actions">';
  205. echo '<a href="javascript: void(0);" onclick="javascript: window.print();"><img src="../img/printmgr.gif">&nbsp;' . get_lang('Print') . '</a>';
  206. echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv"><img src="../img/excel.gif">&nbsp;' . get_lang('ExportAsCSV') . '</a>';
  207. if (!empty ($info_user['email'])) {
  208. $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . Display :: encrypted_mailto_link($info_user['email'], get_lang('SendMail'));
  209. } else {
  210. $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . get_lang('SendMail');
  211. }
  212. echo $send_mail;
  213. if (!empty ($_GET['student']) && !empty ($_GET['course'])) { //only show link to connection details if course and student were defined in the URL
  214. echo '<a href="access_details.php?student=' . Security :: remove_XSS($_GET['student']) . '&course=' . Security :: remove_XSS($_GET['course']) . '&amp;origin=' . Security :: remove_XSS($_GET['origin']) . '&amp;cidReq=' . Security :: remove_XSS($_GET['course']) . '">' . Display :: return_icon('statistics.gif', get_lang('AccessDetails')) . ' ' . get_lang('AccessDetails') . '</a>';
  215. }
  216. echo '</div>';
  217. // is the user online ?
  218. $student_online = Security :: remove_XSS($_GET['student']);
  219. $users_online = WhoIsOnline(30);
  220. foreach ($users_online as $online) {
  221. if (in_array($_GET['student'], $online)) {
  222. $online = get_lang('Yes');
  223. break;
  224. } else {
  225. $online = get_lang('No');
  226. }
  227. }
  228. $avg_student_progress = $avg_student_score = $nb_courses = 0;
  229. $sql = 'SELECT course_code FROM ' . $tbl_course_user . ' WHERE user_id=' . Database :: escape_string($info_user['user_id']);
  230. $rs = Database::query($sql, __FILE__, __LINE__);
  231. $courses = array ();
  232. while ($row = Database :: fetch_array($rs)) {
  233. $courses[$row['course_code']] = $row['course_code'];
  234. }
  235. // get the list of sessions where the user is subscribed as student
  236. $sql = 'SELECT DISTINCT course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user=' . intval($info_user['user_id']);
  237. $rs = Database::query($sql, __FILE__, __LINE__);
  238. while ($row = Database :: fetch_array($rs)) {
  239. $courses[$row['course_code']] = $row['course_code'];
  240. }
  241. $course_id = Security :: remove_XSS($_GET['course']);
  242. if (!CourseManager :: is_user_subscribed_in_course($info_user['user_id'], $course_id, true)) {
  243. unset ($courses[$key]);
  244. } else {
  245. $nb_courses++;
  246. $avg_student_progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_id);
  247. //the score inside the Reporting table
  248. $avg_student_score = Tracking :: get_average_test_scorm_and_lp($info_user['user_id'], $course_id);
  249. }
  250. $avg_student_progress = round($avg_student_progress, 2);
  251. $avg_student_score = round($avg_student_score, 2);
  252. $first_connection_date = Tracking :: get_first_connection_date($info_user['user_id']);
  253. if ($first_connection_date == '') {
  254. $first_connection_date = get_lang('NoConnexion');
  255. }
  256. $last_connection_date = Tracking :: get_last_connection_date($info_user['user_id'], true);
  257. if ($last_connection_date == '') {
  258. $last_connection_date = get_lang('NoConnexion');
  259. }
  260. $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_id));
  261. // cvs informations
  262. $csv_content[] = array (
  263. get_lang('Informations', '')
  264. );
  265. $csv_content[] = array (
  266. get_lang('Name', ''),
  267. get_lang('Email', ''),
  268. get_lang('Tel', '')
  269. );
  270. $csv_content[] = array (
  271. $info_user['name'],
  272. $info_user['email'],
  273. $info_user['phone']
  274. );
  275. $csv_content[] = array ();
  276. // csv tracking
  277. $csv_content[] = array (
  278. get_lang('Tracking', '')
  279. );
  280. $csv_content[] = array (
  281. get_lang('FirstLogin', ''),
  282. get_lang('LatestLogin', ''),
  283. get_lang('TimeSpentInTheCourse', ''),
  284. get_lang('Progress', ''),
  285. get_lang('Score', '')
  286. );
  287. $csv_content[] = array (
  288. strip_tags($first_connection_date),
  289. strip_tags($last_connection_date),
  290. $time_spent_on_the_course,
  291. $avg_student_progress . '%',
  292. $avg_student_score . '%'
  293. );
  294. ?>
  295. <a name="infosStudent"></a>
  296. <table width="100%" border="0" >
  297. <tr>
  298. <?php
  299. $image_array = UserManager :: get_user_picture_path_by_id($info_user['user_id'], 'web', false, true);
  300. echo '<td class="borderRight" width="10%" valign="top">';
  301. // get the path,width and height from original picture
  302. $image_file = $image_array['dir'] . $image_array['file'];
  303. $big_image = $image_array['dir'] . 'big_' . $image_array['file'];
  304. $big_image_size = api_getimagesize($big_image);
  305. $big_image_width = $big_image_size[0];
  306. $big_image_height = $big_image_size[1];
  307. $url_big_image = $big_image . '?rnd=' . time();
  308. $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' .
  309. 'alt="' . api_get_person_name($info_user['lastname'], $info_user['firstname']) . '" ' .
  310. 'style="float:' . ($text_dir == 'rtl' ? 'left' : 'right') . '; padding:5px;" ';
  311. if ($image_array['file'] == 'unknown.jpg') {
  312. echo '<img ' . $img_attributes . ' />';
  313. } else {
  314. echo '<input type="image" ' . $img_attributes . ' onclick="javascript: return show_image(\'' . $url_big_image . '\',\'' . $big_image_width . '\',\'' . $big_image_height . '\');"/>';
  315. }
  316. echo '</td>';
  317. ?>
  318. <td width="40%" valign="top">
  319. <table width="100%" class="data_table">
  320. <tr>
  321. <th>
  322. <?php echo get_lang('Information'); ?>
  323. </th>
  324. </tr>
  325. <tr>
  326. <td>
  327. <?php
  328. echo get_lang('Name') . ' : ';
  329. echo $info_user['name'];
  330. ?>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td>
  335. <?php
  336. echo get_lang('Email') . ' : ';
  337. if (!empty ($info_user['email'])) {
  338. echo '<a href="mailto:' . $info_user['email'] . '">' . $info_user['email'] . '</a>';
  339. } else {
  340. echo get_lang('NoEmail');
  341. }
  342. ?>
  343. </td>
  344. </tr>
  345. <tr>
  346. <td>
  347. <?php
  348. echo get_lang('Tel') . ' : ';
  349. if (!empty ($info_user['phone'])) {
  350. echo $info_user['phone'];
  351. } else {
  352. echo get_lang('NoTel');
  353. }
  354. ?>
  355. </td>
  356. </tr>
  357. <tr>
  358. <td>
  359. <?php
  360. echo get_lang('OfficialCode') . ' : ';
  361. if (!empty ($info_user['official_code'])) {
  362. echo $info_user['official_code'];
  363. } else {
  364. echo get_lang('NoOfficialCode');
  365. }
  366. ?>
  367. </td>
  368. </tr>
  369. <tr>
  370. <td>
  371. <?php
  372. echo get_lang('OnLine') . ' : ';
  373. echo $online;
  374. ?>
  375. </td>
  376. </tr>
  377. </table>
  378. </td>
  379. <td class="borderLeft" width="35%" valign="top">
  380. <table width="100%" class="data_table">
  381. <tr>
  382. <th colspan="2">
  383. <?php echo get_lang('Tracking'); ?>
  384. </th>
  385. </tr>
  386. <tr>
  387. <td align="right">
  388. <?php echo get_lang('FirstLogin') ?>
  389. </td>
  390. <td align="left">
  391. <?php echo $first_connection_date ?>
  392. </td>
  393. </tr>
  394. <tr>
  395. <td align="right">
  396. <?php echo get_lang('LatestLogin') ?>
  397. </td>
  398. <td align="left">
  399. <?php echo $last_connection_date ?>
  400. </td>
  401. </tr>
  402. <tr>
  403. <td align="right">
  404. <?php echo get_lang('TimeSpentInTheCourse') ?>
  405. </td>
  406. <td align="left">
  407. <?php echo $time_spent_on_the_course ?>
  408. </td>
  409. </tr>
  410. <tr>
  411. <td align="right">
  412. <?php
  413. echo get_lang('Progress');
  414. Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array (
  415. 'align' => 'absmiddle',
  416. 'hspace' => '3px'
  417. ));
  418. ?>
  419. </td>
  420. <td align="left">
  421. <?php echo $avg_student_progress.'%' ?>
  422. </td>
  423. </tr>
  424. <tr>
  425. <td align="right">
  426. <?php
  427. echo get_lang('Score');
  428. Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array (
  429. 'align' => 'absmiddle',
  430. 'hspace' => '3px'
  431. ));
  432. ?>
  433. </td>
  434. <td align="left">
  435. <?php echo $avg_student_score.'%' ?>
  436. </td>
  437. </tr>
  438. </table>
  439. </td>
  440. </tr>
  441. </table>
  442. <table class="data_table">
  443. <tr>
  444. <td colspan="5" style="border-width: 0px;">&nbsp;</td>
  445. </tr>
  446. <?php
  447. if (!empty ($_GET['details'])) {
  448. $course_code_info = Security :: remove_XSS($_GET['course']);
  449. $info_course = CourseManager :: get_course_information($course_code_info);
  450. //get coach and session_name if there is one and if session_mode is activated
  451. if (api_get_setting('use_session_mode') == 'true') {
  452. $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
  453. $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
  454. $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
  455. $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
  456. $sql = 'SELECT id_session
  457. FROM ' . $tbl_session_course_user . ' session_course_user
  458. WHERE session_course_user.id_user = ' . intval($info_user['user_id']) . '
  459. AND session_course_user.course_code = "' . Database :: escape_string($course_code_info) . '"
  460. ORDER BY id_session DESC';
  461. $rs = Database::query($sql, __FILE__, __LINE__);
  462. $num_row = Database :: num_rows($rs);
  463. if ($num_row > 0) {
  464. $le_session_id = intval(Database :: result($rs, 0, 0));
  465. if ($le_session_id > 0) {
  466. // get session name and coach of the session
  467. $sql = 'SELECT name, id_coach FROM ' . $tbl_session . '
  468. WHERE id=' . $le_session_id;
  469. $rs = Database::query($sql, __FILE__, __LINE__);
  470. $session_name = Database :: result($rs, 0, 'name');
  471. $session_coach_id = intval(Database :: result($rs, 0, 'id_coach'));
  472. // get coach of the course in the session
  473. $sql = 'SELECT id_user FROM ' . $tbl_session_course_user . '
  474. WHERE id_session=' . $le_session_id . '
  475. AND course_code = "' . Database :: escape_string($_GET['course']) . '" AND status=2';
  476. /*
  477. $sql = 'SELECT id_coach FROM ' . $tbl_session_course . '
  478. WHERE id_session=' . $le_session_id . '
  479. AND course_code = "' . Database :: escape_string($_GET['course']) . '"';
  480. */
  481. $rs = Database::query($sql, __FILE__, __LINE__);
  482. //$session_course_coach_id = intval(Database :: result($rs, 0, 0));
  483. $course_coachs = array();
  484. while ($row_coachs = Database::fetch_array($rs)) {
  485. $course_coachs[] = $row_coachs['id_user'];
  486. }
  487. if (!empty($course_coachs)) {
  488. $info_tutor_name = array();
  489. foreach ($course_coachs as $course_coach) {
  490. $coach_infos = UserManager :: get_user_info_by_id($course_coach);
  491. $info_tutor_name[] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
  492. }
  493. $info_course['tutor_name'] = implode(",",$info_tutor_name);
  494. }
  495. /*if ($session_course_coach_id != 0) {
  496. $coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id);
  497. $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
  498. }*/
  499. elseif ($session_coach_id != 0) {
  500. $coach_infos = UserManager :: get_user_info_by_id($session_coach_id);
  501. $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']);
  502. }
  503. }
  504. }
  505. } // end if(api_get_setting('use_session_mode')=='true')
  506. $date_start = '';
  507. if (!empty ($info_course['date_start'])) {
  508. $date_start = explode('-', $info_course['date_start']);
  509. $date_start = $date_start[2] . '/' . $date_start[1] . '/' . $date_start[0];
  510. }
  511. $date_end = '';
  512. if (!empty ($info_course['date_end'])) {
  513. $date_end = explode('-', $info_course['date_end']);
  514. $date_end = $date_end[2] . '/' . $date_end[1] . '/' . $date_end[0];
  515. }
  516. $dateSession = get_lang('From') . ' ' . $date_start . ' ' . get_lang('To') . ' ' . $date_end;
  517. $nb_login = Tracking :: count_login_per_student($info_user['user_id'], $_GET['course']);
  518. $table_title = $info_course['title'] . '&nbsp;|&nbsp;' . get_lang('CountToolAccess') . ' : ' . $nb_login . '&nbsp; | &nbsp;' . get_lang('Tutor') . ' : ' . stripslashes($info_course['tutor_name']) . ((!empty ($session_name)) ? ' | ' . get_lang('Session') . ' : ' . $session_name : '');
  519. $csv_content[] = array ();
  520. $csv_content[] = array (str_replace('&nbsp;', '', $table_title));
  521. ?>
  522. <tr>
  523. <td colspan="6">
  524. <strong><?php echo $table_title; ?></strong>
  525. </td>
  526. </tr>
  527. </table>
  528. <!-- line about learnpaths -->
  529. <table class="data_table">
  530. <tr>
  531. <th>
  532. <?php echo get_lang('Learnpaths');?>
  533. </th>
  534. <th>
  535. <?php
  536. echo get_lang('Time');
  537. Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array (
  538. 'align' => 'absmiddle',
  539. 'hspace' => '3px'
  540. ));
  541. ?>
  542. </th>
  543. <th>
  544. <?php
  545. echo get_lang('Score');
  546. Display :: display_icon('info3.gif', get_lang('LPTestScore'), array (
  547. 'align' => 'absmiddle',
  548. 'hspace' => '3px'
  549. ));
  550. ?>
  551. </th>
  552. <th>
  553. <?php
  554. echo get_lang('Progress');
  555. Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array (
  556. 'align' => 'absmiddle',
  557. 'hspace' => '3px'
  558. ));
  559. ?>
  560. </th>
  561. <th>
  562. <?php
  563. echo get_lang('LastConnexion');
  564. Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array (
  565. 'align' => 'absmiddle',
  566. 'hspace' => '3px'
  567. ));
  568. ?>
  569. </th>
  570. <th>
  571. <?php echo get_lang('Details');?>
  572. </th>
  573. </tr>
  574. <?php
  575. $headerLearnpath = array (
  576. get_lang('Learnpath'),
  577. get_lang('Time'),
  578. get_lang('Progress'),
  579. get_lang('LastConnexion')
  580. );
  581. $t_lp = Database :: get_course_table(TABLE_LP_MAIN, $info_course['db_name']);
  582. $t_lpi = Database :: get_course_table(TABLE_LP_ITEM, $info_course['db_name']);
  583. $t_lpv = Database :: get_course_table(TABLE_LP_VIEW, $info_course['db_name']);
  584. $t_lpiv = Database :: get_course_table(TABLE_LP_ITEM_VIEW, $info_course['db_name']);
  585. $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  586. $tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
  587. $tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION, $info_course['db_name']);
  588. $sql_learnpath = " SELECT lp.name,lp.id
  589. FROM $t_lp AS lp ORDER BY lp.name ASC";
  590. $result_learnpath = Database::query($sql_learnpath, __FILE__, __LINE__);
  591. $csv_content[] = array ();
  592. $csv_content[] = array (
  593. get_lang('Learnpath', ''),
  594. get_lang('Time', ''),
  595. get_lang('Score', ''),
  596. get_lang('Progress', ''),
  597. get_lang('LastConnexion', '')
  598. );
  599. if (Database :: num_rows($result_learnpath) > 0) {
  600. $i = 0;
  601. while ($learnpath = Database :: fetch_array($result_learnpath)) {
  602. $any_result = false;
  603. $progress = learnpath :: get_db_progress($learnpath['id'], $student_id, '%', $info_course['db_name'], true);
  604. if ($progress === null) {
  605. $progress = '0%';
  606. } else {
  607. $any_result = true;
  608. }
  609. // calculates time
  610. $sql = 'SELECT SUM(total_time)
  611. FROM ' . $t_lpiv . ' AS item_view
  612. INNER JOIN ' . $t_lpv . ' AS view
  613. ON item_view.lp_view_id = view.id
  614. AND view.lp_id = ' . $learnpath['id'] . '
  615. AND view.user_id = ' . intval($_GET['student']);
  616. $rs = Database::query($sql, __FILE__, __LINE__);
  617. $total_time = 0;
  618. if (Database :: num_rows($rs) > 0) {
  619. $total_time = Database :: result($rs, 0, 0);
  620. if ($total_time > 0)
  621. $any_result = true;
  622. }
  623. // calculates last connection time
  624. $sql = 'SELECT MAX(start_time)
  625. FROM ' . $t_lpiv . ' AS item_view
  626. INNER JOIN ' . $t_lpv . ' AS view
  627. ON item_view.lp_view_id = view.id
  628. AND view.lp_id = ' . $learnpath['id'] . '
  629. AND view.user_id = ' . intval($_GET['student']);
  630. $rs = Database::query($sql, __FILE__, __LINE__);
  631. $start_time = null;
  632. if (Database :: num_rows($rs) > 0) {
  633. $start_time = Database :: result($rs, 0, 0);
  634. if ($start_time > 0)
  635. $any_result = true;
  636. }
  637. //QUIZZ IN LP
  638. $score = Tracking :: get_avg_student_score(intval($_GET['student']), Database :: escape_string($_GET['course']), array (
  639. $learnpath['id']
  640. ));
  641. if (empty ($score)) {
  642. //$score = 0;
  643. }
  644. if ($i % 2 == 0) {
  645. $css_class = "row_odd";
  646. } else {
  647. $css_class = "row_even";
  648. }
  649. $i++;
  650. $csv_content[] = array (
  651. api_html_entity_decode(stripslashes($learnpath['name']), ENT_QUOTES, $charset),
  652. api_time_to_hms($total_time),
  653. $score . '%',
  654. $progress,
  655. date('Y-m-d', $start_time)
  656. );
  657. ?>
  658. <tr class="<?php echo $css_class;?>">
  659. <td>
  660. <?php echo stripslashes($learnpath['name']); ?>
  661. </td>
  662. <td align="center">
  663. <?php echo api_time_to_hms($total_time) ?>
  664. </td>
  665. <td align="center">
  666. <?php
  667. if (!is_null($score)) {
  668. echo $score . '%';
  669. } else {
  670. if ('0' == $progress {
  671. 0 }) {
  672. echo '/';
  673. } else {
  674. echo '0%';
  675. }
  676. $score = 0;
  677. }
  678. ?>
  679. </td>
  680. <td align="center">
  681. <?php echo $progress ?>
  682. </td>
  683. <td align="center">
  684. <?php
  685. if ($start_time != '' && $start_time > 0) {
  686. echo format_locale_date(get_lang('DateFormatLongWithoutDay'), $start_time);
  687. } else {
  688. echo '-';
  689. }
  690. ?>
  691. </td>
  692. <td align="center">
  693. <?php
  694. if ($any_result === true) {
  695. $from = '';
  696. if ($from_myspace) {
  697. $from ='&from=myspace';
  698. }
  699. ?>
  700. <a href="lp_tracking.php?course=<?php echo Security::remove_XSS($_GET['course']).$from; ?>&origin=<?php echo Security::remove_XSS($_GET['origin']) ?>&lp_id=<?php echo $learnpath['id']?>&student_id=<?php echo $info_user['user_id'] ?>">
  701. <img src="../img/2rightarrow.gif" border="0" />
  702. </a>
  703. <?php
  704. }
  705. ?>
  706. </td>
  707. </tr>
  708. <?php
  709. $data_learnpath[$i][] = $learnpath['name'];
  710. $data_learnpath[$i][] = $progress . '%';
  711. $i++;
  712. }
  713. } else {
  714. echo " <tr>
  715. <td colspan='6'>
  716. " . get_lang('NoLearnpath') . "
  717. </td>
  718. </tr>
  719. ";
  720. }
  721. ?>
  722. </table>
  723. <!-- line about exercises -->
  724. <table class="data_table">
  725. <tr>
  726. <th>
  727. <?php echo get_lang('Exercices'); ?>
  728. </th>
  729. <th>
  730. <?php echo get_lang('Score').Display :: return_icon('info3.gif', get_lang('LastScoreTest'), array('align' => 'absmiddle', 'hspace' => '3px')) ?>
  731. </th>
  732. <th>
  733. <?php echo get_lang('Attempts'); ?>
  734. </th>
  735. <th>
  736. <?php echo get_lang('CorrectTest'); ?>
  737. </th>
  738. </tr>
  739. <?php
  740. $csv_content[] = array ();
  741. $csv_content[] = array (
  742. get_lang('Exercices'),
  743. get_lang('Score'),
  744. get_lang('Attempts')
  745. );
  746. $info_course = CourseManager :: get_course_information(Security :: remove_XSS($_GET['course']));
  747. $t_tool = Database :: get_course_table(TABLE_TOOL_LIST, $info_course['db_name']);
  748. $sql = 'SELECT visibility FROM ' . $t_tool . ' WHERE name="quiz"';
  749. $result_visibility_quizz = Database::query($sql, __FILE__, __LINE__);
  750. $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST, $info_course['db_name']);
  751. if (Database :: result($result_visibility_quizz, 0, 'visibility') == 1) {
  752. $sql_exercices = "SELECT quiz.title,id
  753. FROM " . $t_quiz . " AS quiz
  754. WHERE active='1' ORDER BY quiz.title ASC
  755. ";
  756. $result_exercices = Database::query($sql_exercices, __FILE__, __LINE__);
  757. $i = 0;
  758. $is_student = Security :: remove_XSS($_GET['student']);
  759. if (Database :: num_rows($result_exercices) > 0) {
  760. while ($exercices = Database :: fetch_array($result_exercices)) {
  761. $sql_essais = "SELECT COUNT(ex.exe_id) as essais
  762. FROM $tbl_stats_exercices AS ex
  763. WHERE ex.exe_cours_id = '" . $info_course['code'] . "'
  764. AND ex.exe_exo_id = " . $exercices['id'] . "
  765. AND orig_lp_id = 0
  766. AND orig_lp_item_id = 0
  767. AND exe_user_id='" . Database :: escape_string($is_student) . "'";
  768. $result_essais = Database::query($sql_essais, __FILE__, __LINE__);
  769. $essais = Database :: fetch_array($result_essais);
  770. $sql_score = "SELECT exe_id, exe_result,exe_weighting
  771. FROM $tbl_stats_exercices
  772. WHERE exe_user_id = " . Database :: escape_string($is_student) . "
  773. AND exe_cours_id = '" . $info_course['code'] . "'
  774. AND exe_exo_id = " . $exercices['id'] . "
  775. AND orig_lp_id = 0
  776. AND orig_lp_item_id = 0
  777. ORDER BY exe_date DESC LIMIT 1";
  778. $result_score = Database::query($sql_score, __FILE__, __LINE__);
  779. $score = 0;
  780. while ($scores = Database :: fetch_array($result_score)) {
  781. $score = $score + $scores['exe_result'];
  782. $weighting = $weighting + $scores['exe_weighting'];
  783. $exe_id = $scores['exe_id'];
  784. }
  785. $score_percentage = 0;
  786. if ($weighting != 0) {
  787. //i.e 10.50
  788. $score_percentage = round(($score * 100) / $weighting, 2);
  789. } else {
  790. $score_percentage = null;
  791. }
  792. $weighting = 0;
  793. $csv_content[] = array (
  794. $exercices['title'],
  795. $score_percentage . '%',
  796. $essais['essais']
  797. );
  798. if ($i % 2 == 0) {
  799. $css_class = "row_odd";
  800. } else {
  801. $css_class = "row_even";
  802. }
  803. $i++;
  804. echo '<tr class="' . $css_class . '">
  805. <td>
  806. ';
  807. echo $exercices['title'];
  808. echo " </td>
  809. ";
  810. echo " <td align='center'>
  811. ";
  812. if ($essais['essais'] > 0) {
  813. echo $score_percentage . '%';
  814. } else {
  815. echo '/';
  816. $score_percentage = 0;
  817. }
  818. echo " </td>
  819. <td align='center'>
  820. ";
  821. echo $essais['essais'];
  822. echo " </td>
  823. <td align='center'>
  824. ";
  825. $sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $exercices['id'] . '" AND exe_user_id="' . Security :: remove_XSS($_GET['student']) . '" AND exe_cours_id="' . $info_course['code'] . '" AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1';
  826. $result_last_attempt = Database::query($sql_last_attempt, __FILE__, __LINE__);
  827. if (Database :: num_rows($result_last_attempt) > 0) {
  828. $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
  829. if ($essais['essais'] > 0)
  830. echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq=' . $info_course['code'] . '&student=' . Security :: remove_XSS($_GET['student']) . '&origin=' . (empty ($_GET['origin']) ? 'tracking' : Security :: remove_XSS($_GET['origin'])) . '"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
  831. }
  832. echo " </td>
  833. </tr>
  834. ";
  835. $data_exercices[$i][] = $exercices['title'];
  836. $data_exercices[$i][] = $score_percentage . '%';
  837. $data_exercices[$i][] = $essais['essais'];
  838. //$data_exercices[$i][] = corrections;
  839. $i++;
  840. }
  841. } else {
  842. echo " <tr>
  843. <td colspan='6'>
  844. " . get_lang('NoExercise') . "
  845. </td>
  846. </tr>
  847. ";
  848. }
  849. } else {
  850. echo " <tr>
  851. <td colspan='6'>
  852. " . get_lang('NoExercise') . "
  853. </td>
  854. </tr>
  855. ";
  856. }
  857. ?>
  858. </table>
  859. <!-- line about other tools -->
  860. <table class="data_table">
  861. <tr>
  862. <td>
  863. <?php
  864. $csv_content[] = array ();
  865. $nb_assignments = Tracking :: count_student_assignments($info_user['user_id'], $info_course['code']);
  866. $messages = Tracking :: count_student_messages($info_user['user_id'], $info_course['code']);
  867. $links = Tracking :: count_student_visited_links($info_user['user_id'], $info_course['code']);
  868. $documents = Tracking :: count_student_downloaded_documents($info_user['user_id'], $info_course['code']);
  869. $chat_last_connection = Tracking :: chat_last_connection($info_user['user_id'], $info_course['code']);
  870. $csv_content[] = array (
  871. get_lang('Student_publication'),
  872. $nb_assignments
  873. );
  874. $csv_content[] = array (
  875. get_lang('Messages'),
  876. $messages
  877. );
  878. $csv_content[] = array (
  879. get_lang('LinksDetails'),
  880. $links
  881. );
  882. $csv_content[] = array (
  883. get_lang('DocumentsDetails'),
  884. $documents
  885. );
  886. $csv_content[] = array (
  887. get_lang('ChatLastConnection'),
  888. $chat_last_connection
  889. );
  890. ?>
  891. <tr>
  892. <th colspan="2">
  893. <?php echo get_lang('OtherTools'); ?>
  894. </th>
  895. </tr>
  896. <tr><!-- assignments -->
  897. <td width="40%">
  898. <?php echo get_lang('Student_publication') ?>
  899. </td>
  900. <td>
  901. <?php echo $nb_assignments ?>
  902. </td>
  903. </tr>
  904. <tr><!-- messages -->
  905. <td>
  906. <?php echo get_lang('Messages') ?>
  907. </td>
  908. <td>
  909. <?php echo $messages ?>
  910. </td>
  911. </tr>
  912. <tr><!-- links -->
  913. <td>
  914. <?php echo get_lang('LinksDetails') ?>
  915. </td>
  916. <td>
  917. <?php echo $links ?>
  918. </td>
  919. </tr>
  920. <tr><!-- documents -->
  921. <td>
  922. <?php echo get_lang('DocumentsDetails') ?>
  923. </td>
  924. <td>
  925. <?php echo $documents ?>
  926. </td>
  927. </tr>
  928. <tr><!-- Chats -->
  929. <td>
  930. <?php echo get_lang('ChatLastConnection') ?>
  931. </td>
  932. <td>
  933. <?php echo $chat_last_connection; ?>
  934. </td>
  935. </tr>
  936. </table>
  937. </td>
  938. </tr>
  939. </table>
  940. <?php
  941. } else {
  942. ?>
  943. <tr>
  944. <th>
  945. <?php echo get_lang('Course'); ?>
  946. </th>
  947. <th>
  948. <?php echo get_lang('Time'); ?>
  949. </th>
  950. <th>
  951. <?php echo get_lang('Progress'); ?>
  952. </th>
  953. <th>
  954. <?php echo get_lang('Score'); ?>
  955. </th>
  956. <th>
  957. <?php echo get_lang('Details'); ?>
  958. </th>
  959. </tr>
  960. <?php
  961. if (!api_is_platform_admin(true) && $_user['status'] != DRH) {
  962. // courses followed by user where we are coach
  963. if (!isset ($_GET['id_coach'])) {
  964. $courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
  965. } else {
  966. $courses = Tracking :: get_courses_followed_by_coach(Security :: remove_XSS($_GET['id_coach']));
  967. }
  968. }
  969. if (count($courses) > 0) {
  970. $csv_content[] = array ();
  971. $csv_content[] = array (
  972. get_lang('Course', ''),
  973. get_lang('Time', ''),
  974. get_lang('Progress', ''),
  975. get_lang('Score', '')
  976. );
  977. foreach ($courses as $course_code) {
  978. if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
  979. $course_info = CourseManager :: get_course_information($course_code);
  980. $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code));
  981. $progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_code);
  982. $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code);
  983. $progress = empty($progress) ? '0%' : $progress.'%';
  984. $score = empty($score) ? '0%' : $score.'%';
  985. $csv_content[] = array (
  986. $course_info['title'],
  987. $time_spent_on_course,
  988. $progress,
  989. $score
  990. );
  991. echo '
  992. <tr>
  993. <td align="right">
  994. ' . $course_info['title'] . '
  995. </td>
  996. <td align="right">
  997. ' . $time_spent_on_course . '
  998. </td>
  999. <td align="right">
  1000. ' . $progress . '
  1001. </td>
  1002. <td align="right">
  1003. ' . $score . '
  1004. </td>';
  1005. if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
  1006. echo '<td align="center" width="10">
  1007. <a href="' . api_get_self() . '?student=' . $info_user['user_id'] . '&details=true&course=' . $course_info['code'] . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']) . '&origin=' . Security :: remove_XSS($_GET['origin']) . '&id_session=' . Security :: remove_XSS($_GET['id_session']) . '#infosStudent"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>
  1008. </td>';
  1009. } else {
  1010. echo '<td align="center" width="10">
  1011. <a href="' . api_get_self() . '?student=' . $info_user['user_id'] . '&details=true&course=' . $course_info['code'] . '&origin=' . Security :: remove_XSS($_GET['origin']) . '&id_session=' . Security :: remove_XSS($_GET['id_session']) . '#infosStudent"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>
  1012. </td>';
  1013. }
  1014. echo '</tr>';
  1015. }
  1016. }
  1017. } else {
  1018. echo "<tr>
  1019. <td colspan='5'>
  1020. " . get_lang('NoCourse') . "
  1021. </td>
  1022. </tr>
  1023. ";
  1024. }
  1025. } //end of else !empty($details)
  1026. ?>
  1027. </table>
  1028. <br />
  1029. <?php
  1030. if (!empty ($_GET['details']) && $_GET['origin'] != 'tracking_course' && $_GET['origin'] != 'user_course') {
  1031. ?>
  1032. <br /><br />
  1033. <?php
  1034. }
  1035. if (!empty ($_GET['exe_id'])) {
  1036. $t_q = Database :: get_course_table(TABLE_QUIZ_TEST, $info_course['db_name']);
  1037. $t_qq = Database :: get_course_table(TABLE_QUIZ_QUESTION, $info_course['db_name']);
  1038. $t_qa = Database :: get_course_table(TABLE_QUIZ_ANSWER, $info_course['db_name']);
  1039. $t_qtq = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION, $info_course['db_name']);
  1040. $sql_exercice_details = "SELECT qq.question, qq.ponderation, qq.id
  1041. FROM " . $t_qq . " as qq
  1042. INNER JOIN " . $t_qtq . " as qrq
  1043. ON qrq.question_id = qq.id
  1044. AND qrq.exercice_id = " . intval($_GET['exe_id']);
  1045. $result_exercice_details = Database::query($sql_exercice_details, __FILE__, __LINE__);
  1046. $sql_ex_name = "SELECT quiz.title
  1047. FROM " . $t_q . " AS quiz
  1048. WHERE quiz.id = " . intval($_GET['exe_id']);
  1049. ;
  1050. $resultExName = Database::query($sql_ex_name, __FILE__, __LINE__);
  1051. $exName = Database :: fetch_array($resultExName);
  1052. echo "<table class='data_table'>
  1053. <tr>
  1054. <th colspan='2'>
  1055. " . $exName['title'] . "
  1056. </th>
  1057. </tr>
  1058. ";
  1059. while ($exerciceDetails = Database :: fetch_array($result_exercice_details)) {
  1060. $sqlAnswer = " SELECT qa.comment, qa.answer
  1061. FROM " . $t_qa . " as qa
  1062. WHERE qa.question_id = " . $exerciceDetails['id'];
  1063. $resultAnswer = Database::query($sqlAnswer, __FILE__, __LINE__);
  1064. echo "<a name='infosExe'></a>";
  1065. echo "
  1066. <tr>
  1067. <td colspan='2'>
  1068. <strong>" . $exerciceDetails['question'] . ' /' . $exerciceDetails['ponderation'] . "</strong>
  1069. </td>
  1070. </tr>
  1071. ";
  1072. while ($answer = Database :: fetch_array($resultAnswer)) {
  1073. echo "
  1074. <tr>
  1075. <td>
  1076. " . $answer['answer'] . "
  1077. </td>
  1078. <td>
  1079. ";
  1080. if (!empty ($answer['comment']))
  1081. echo $answer['comment'];
  1082. else
  1083. echo get_lang('NoComment');
  1084. echo "
  1085. </td>
  1086. </tr>
  1087. ";
  1088. }
  1089. }
  1090. echo "</table>";
  1091. }
  1092. //YW - commented out because it doesn't seem to be used
  1093. //$header = array_merge($headerLearnpath,$headerExercices,$headerProductions);
  1094. }
  1095. if ($export_csv) {
  1096. ob_end_clean();
  1097. Export :: export_table_csv($csv_content, 'reporting_student');
  1098. exit;
  1099. }
  1100. /*
  1101. ==============================================================================
  1102. FOOTER
  1103. ==============================================================================
  1104. */
  1105. Display :: display_footer();