myStudents.php 41 KB

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