myStudents.php 40 KB

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