lp_stats.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays statistics on the current learning path (scorm)
  5. *
  6. * This script must be included by lp_controller.php to get basic initialisation
  7. * @package chamilo.learnpath
  8. * @author Yannick Warnier <ywarnier@beeznest.org>
  9. */
  10. require_once 'learnpath.class.php';
  11. //require_once('scorm.class.php');
  12. require_once 'resourcelinker.inc.php';
  13. require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
  14. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  15. if(empty($_SESSION['_course']['id']) && isset($_GET['course'])) {
  16. $course_code = Security::remove_XSS($_GET['course']);
  17. } else {
  18. $course_code = $_SESSION['_course']['id'];
  19. }
  20. if (isset($_GET['student_id'])) {
  21. $student_id = intval($_GET['student_id']);
  22. }
  23. //The two following variables have to be declared by the includer script
  24. //$lp_id = $_SESSION['oLP']->get_id();
  25. //$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
  26. //$user_id = $_user['user_id'];
  27. //$stats_charset = $_SESSION['oLP']->encoding
  28. if(!isset($origin))
  29. $origin = '';
  30. if($origin != 'tracking') {
  31. if (!empty ($stats_charset)) {
  32. $lp_charset = $stats_charset;
  33. } else {
  34. $lp_charset = api_get_setting('platform_charset');
  35. }
  36. $charset = $lp_charset;
  37. //$w = $tablewidth -20;
  38. $htmlHeadXtra[] = ''.'<style type="text/css" media="screen, projection">
  39. /*<![CDATA[*/
  40. @import "../css/public_admin/scorm.css";
  41. /*]]>*/
  42. </style>';
  43. include_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
  44. echo '<body>';
  45. } else {
  46. //Get learning path's encoding
  47. $TBL_LP = Database :: get_course_table(TABLE_LP_MAIN);
  48. $sql = "SELECT default_encoding FROM $TBL_LP " .
  49. "WHERE id = '".(int)$_GET['lp_id']."'";
  50. $res = Database::query($sql);
  51. if (Database :: num_rows($res) > 0) {
  52. $row = Database::fetch_array($res);
  53. $lp_charset = $row['default_encoding'];
  54. }
  55. }
  56. // The dokeos interface's encoding
  57. $dokeos_charset = api_get_setting('platform_charset');
  58. $output = '';
  59. //if display in fullscreen required
  60. if (!empty($_GET['fs']) && strcmp($_GET['fs'], 'true') == 0) {
  61. $output .= '<table width="100%" align="center">';
  62. } else {
  63. $output .= '<table width="100%">';
  64. }
  65. //check if the user asked for the "extend all" option
  66. $extend_all_link = '';
  67. $extend_all = 0;
  68. if ($origin == 'tracking') {
  69. $url_suffix = '&course=' . Security::remove_XSS($_GET['course']) . '&student_id=' . $student_id . '&lp_id=' . Security::remove_XSS($_GET['lp_id']) . '&origin=' . Security::remove_XSS($_GET['origin']).$from_link;
  70. } else {
  71. $url_suffix = '';
  72. }
  73. if (!empty ($_GET['extend_all'])) {
  74. $extend_all_link = '<a href="' . api_get_self() . '?action=stats' . $url_suffix . '"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.api_convert_encoding(get_lang('HideAllAttempts'), $lp_charset, $dokeos_charset).'"></a>';
  75. $extend_all = 1;
  76. } else {
  77. $extend_all_link = '<a href="' . api_get_self() . '?action=stats&extend_all=1' . $url_suffix . '"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.api_convert_encoding(get_lang('ShowAllAttempts'), $lp_charset, $dokeos_charset).'"></a>';
  78. }
  79. if ($origin != 'tracking') {
  80. $output .= "<tr><td><div class='title'>" . api_convert_encoding(get_lang('ScormMystatus'), $lp_charset, $dokeos_charset) . "</div></td></tr>";
  81. }
  82. $output .= "<tr><td>&nbsp;</td></tr>" . "<tr><td>" . "<table border='0' class='data_table'><tr>\n" . '<td width="16">' . $extend_all_link . '</td>' . '<td colspan="4" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset) . "</div></td>\n" . '<td colspan="2" class="title"><div class="mystatusfirstrow">' . api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset) . "</div></td><td class='title'><div class='mystatusfirstrow'>" . api_convert_encoding(get_lang('Actions'), $lp_charset, $dokeos_charset) . "</div></td></tr>\n";
  83. //going through the items using the $items[] array instead of the database order ensures
  84. // we get them in the same order as in the imsmanifest file, which is rather random when using
  85. // the database table
  86. $TBL_LP_ITEM = Database :: get_course_table(TABLE_LP_ITEM);
  87. $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
  88. $TBL_LP_VIEW = Database :: get_course_table(TABLE_LP_VIEW);
  89. $tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  90. $tbl_stats_attempts= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
  91. $tbl_quiz_questions= Database :: get_course_table(TABLE_QUIZ_QUESTION);
  92. $sql = "SELECT max(view_count) FROM $TBL_LP_VIEW " .
  93. "WHERE lp_id = $lp_id AND user_id = '" . $user_id . "'";
  94. $res = Database::query($sql);
  95. $view = '';
  96. $num = 0;
  97. if (Database :: num_rows($res) > 0) {
  98. $myrow = Database :: fetch_array($res);
  99. $view = $myrow[0];
  100. }
  101. $counter = 0;
  102. //error_log('New LP - Querying views for latest attempt: '.$sql,0);
  103. $total_score = 0;
  104. $total_max_score = 0;
  105. $total_time = 0;
  106. $h = api_convert_encoding(get_lang('h'), $lp_charset, $dokeos_charset);
  107. if (!empty($export_csv)) {
  108. $csv_content[] = array (
  109. api_convert_encoding(get_lang('ScormLessonTitle'), $lp_charset, $dokeos_charset),
  110. api_convert_encoding(get_lang('ScormStatus'), $lp_charset, $dokeos_charset),
  111. api_convert_encoding(get_lang('ScormScore'), $lp_charset, $dokeos_charset),
  112. api_convert_encoding(get_lang('ScormTime'), $lp_charset, $dokeos_charset)
  113. );
  114. }
  115. // get attempts of a exercise
  116. if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
  117. $clean_lp_item_id = Database::escape_string($_GET['my_lp_id']);
  118. $clean_lp_id = Database::escape_string($_GET['lp_id']);
  119. $clean_course_code = Database :: escape_string($course_code);
  120. $sql_path = "SELECT path FROM $TBL_LP_ITEM WHERE id = '$clean_lp_item_id' AND lp_id = '$clean_lp_id'";
  121. $res_path = Database::query($sql_path);
  122. $row_path = Database::fetch_array($res_path);
  123. if (Database::num_rows($res_path) > 0 ){
  124. if ($origin != 'tracking') {
  125. $sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND status <> "incomplete" ORDER BY exe_date';
  126. } else {
  127. $sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.(int)$clean_lp_id.'" AND orig_lp_item_id = "'.(int)$clean_lp_item_id.'" AND exe_cours_id="' . $clean_course_code. '" AND status <> "incomplete" ORDER BY exe_date';
  128. }
  129. $sql_attempts;
  130. }
  131. }
  132. $TBL_QUIZ = Database :: get_course_table(TABLE_QUIZ_TEST);
  133. if (is_array($list) && count($list) > 0) {
  134. foreach ($list as $my_item_id) {
  135. $extend_this = 0;
  136. $qry_order = 'DESC';
  137. if ((!empty ($_GET['extend_id']) and $_GET['extend_id'] == $my_item_id) OR $extend_all) {
  138. $extend_this = 1;
  139. $qry_order = 'ASC';
  140. }
  141. //prepare statement to go through each attempt
  142. if (!empty ($view)) {
  143. $sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
  144. "iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .
  145. "i.title as mytitle, i.max_score as mymaxscore, " .
  146. "iv.max_score as myviewmaxscore, " .
  147. "i.item_type as item_type, iv.view_count as iv_view_count, " .
  148. "iv.id as iv_id, path as path" .
  149. " FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v" .
  150. " WHERE i.id = iv.lp_item_id " .
  151. " AND i.id = $my_item_id " .
  152. " AND iv.lp_view_id = v.id " .
  153. " AND i.lp_id = $lp_id " .
  154. " AND v.user_id = " . $user_id . " " .
  155. " AND v.view_count = $view " .
  156. " ORDER BY iv.view_count $qry_order ";
  157. } else {
  158. $sql = "SELECT iv.status as mystatus, v.view_count as mycount, " .
  159. "iv.score as myscore, iv.total_time as mytime, i.id as myid, i.lp_id as mylpid, iv.lp_view_id as mylpviewid, " .
  160. "i.title as mytitle, i.max_score as mymaxscore, " .
  161. "iv.max_score as myviewmaxscore, " .
  162. "i.item_type as item_type, iv.view_count as iv_view_count, " .
  163. "iv.id as iv_id, path as path " .
  164. " FROM $TBL_LP_ITEM as i, $TBL_LP_ITEM_VIEW as iv, $TBL_LP_VIEW as v " .
  165. " WHERE i.id = iv.lp_item_id " .
  166. " AND i.id = $my_item_id " .
  167. " AND iv.lp_view_id = v.id " .
  168. " AND i.lp_id = $lp_id " .
  169. " AND v.user_id = " . $user_id . " " .
  170. " ORDER BY iv.view_count $qry_order ";
  171. }
  172. //$sql.'<br/>';
  173. $result = Database::query($sql);
  174. $num = Database :: num_rows($result);
  175. $time_for_total = 'NaN';
  176. $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
  177. if (($extend_this || $extend_all) && $num > 0) {
  178. $row = Database :: fetch_array($result);
  179. $result_disabled_ext_all = false;
  180. if($row['item_type'] == 'quiz') {
  181. //check results_disabled in quiz table
  182. $my_path = Database::escape_string($row['path']);
  183. $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
  184. $res_result_disabled = Database::query($sql);
  185. $row_result_disabled = Database::fetch_row($res_result_disabled);
  186. if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) {
  187. $result_disabled_ext_all = true;
  188. }
  189. }
  190. //echo '<br><pre>'; print_r($row); echo '</pre><br>';
  191. //if there are several attempts, and the link to extend has been clicked, show each attempt...
  192. if (($counter % 2) == 0) {
  193. $oddclass = "row_odd";
  194. } else {
  195. $oddclass = "row_even";
  196. }
  197. $extend_link='';
  198. if (!empty($inter_num)) {
  199. $extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
  200. }
  201. $title = $row['mytitle'];
  202. if (empty ($title)) {
  203. $title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
  204. }
  205. if ($row['item_type'] != 'dokeos_chapter') {
  206. $correct_test_link = '-';
  207. //api_convert_encoding($title, $lp_charset, $lp_charset)
  208. $title = Security::remove_XSS($title);
  209. $output .= "<tr class='$oddclass'>\n" . "<td>$extend_link</td>\n" . '<td colspan="4" class="content"><div class="mystatus">' . $title . "</div></td>\n" . '<td colspan="2" class="content"></td>' . "\n" . '<td colspan="2" class="content"></td>' . "\n" . '<td colspan="2" class="content"></td><td class="content"></td>' . "\n" . "</tr>\n";
  210. }
  211. $counter++;
  212. do {
  213. $row['iv_view_count'];
  214. //check if there are interactions below
  215. $extend_attempt_link = '';
  216. $extend_this_attempt = 0;
  217. if ((learnpath :: get_interactions_count_from_db($row['iv_id']) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id']) > 0) && !$extend_all) {
  218. if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
  219. //the extend button for this attempt has been clicked
  220. $extend_this_attempt = 1;
  221. $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
  222. } else { //same case if fold_attempt_id is set, so not implemented explicitly
  223. //the extend button for this attempt has not been clicked
  224. $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'), $lp_charset, $dokeos_charset).'" border="0"></a>' . "\n";
  225. }
  226. }
  227. if (($counter % 2) == 0) {
  228. $oddclass = "row_odd";
  229. } else {
  230. $oddclass = "row_even";
  231. }
  232. $lesson_status = $row['mystatus'];
  233. $score = $row['myscore'];
  234. $time_for_total = $row['mytime'];
  235. $time = learnpathItem :: get_scorm_time('js', $row['mytime']);
  236. $type;
  237. $scoIdentifier = $row['myid'];
  238. if ($score == 0) {
  239. $maxscore = $row['mymaxscore'];
  240. } else {
  241. if ($row['item_type'] == 'sco') {
  242. if (!empty ($row['myviewmaxscore']) && $row['myviewmaxscore'] > 0) {
  243. $maxscore = $row['myviewmaxscore'];
  244. }
  245. elseif ($row['myviewmaxscore'] === '') {
  246. $maxscore = 0;
  247. } else {
  248. $maxscore = $row['mymaxscore'];
  249. }
  250. }
  251. else
  252. {
  253. $maxscore = $row['mymaxscore'];
  254. }
  255. }
  256. //Remove "NaN" if any (@todo: locate the source of these NaN)
  257. $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
  258. if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {
  259. $color = 'green';
  260. } else {
  261. $color = 'black';
  262. }
  263. $mylanglist = array (
  264. 'completed' => 'ScormCompstatus',
  265. 'incomplete' => 'ScormIncomplete',
  266. 'failed' => 'ScormFailed',
  267. 'passed' => 'ScormPassed',
  268. 'browsed' => 'ScormBrowsed',
  269. 'not attempted' => 'ScormNotAttempted',
  270. );
  271. $my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset);
  272. if ($row['item_type'] != 'dokeos_chapter') {
  273. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  274. $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
  275. } else {
  276. $view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1)));
  277. }
  278. $output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . "<td>$extend_attempt_link</td>\n" . '<td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $row['iv_view_count'] . "</td>\n"
  279. //."<td><font color='$color'><div class='mystatus'>".api_htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n"
  280. . '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
  281. if (!empty($export_csv)) {
  282. $temp = array ();
  283. $temp[] = $title = Security::remove_XSS($title);
  284. $temp[] = Security::remove_XSS($my_lesson_status);
  285. if ($row['item_type'] == 'quiz') {
  286. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  287. $temp[] = '/';
  288. } else {
  289. $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
  290. }
  291. } else {
  292. $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
  293. }
  294. $temp[] = $time;
  295. $csv_content[] = $temp;
  296. }
  297. }
  298. $counter++;
  299. if ($extend_this_attempt OR $extend_all) {
  300. $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
  301. foreach ($list1 as $id => $interaction) {
  302. if (($counter % 2) == 0) {
  303. $oddclass = "row_odd";
  304. } else {
  305. $oddclass = "row_even";
  306. }
  307. $student_response=urldecode($interaction['student_response']);//code added by isaac flores
  308. $content_student_response=array();
  309. $content_student_response=explode('__|',$student_response);
  310. if (count($content_student_response)>0) {
  311. if (count($content_student_response)>=3) {
  312. $new_content_student_response=array_pop($content_student_response);//Pop the element off the end of array
  313. }
  314. $student_response=implode(',',$content_student_response);
  315. }
  316. $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
  317. //."<td><font color='$color'><div class='mystatus'>".api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
  318. . '<td colspan="2">' . $interaction['type'] . "</td>\n"
  319. //.'<td>'.$interaction['correct_responses']."</td>\n"
  320. . '<td>' . $student_response . "</td>\n" . '<td>' . $interaction['result'] . "</td>\n" . '<td>' . $interaction['latency'] . "</td>\n" . '<td>' . $interaction['time'] . "</td>\n<td></td>\n</tr>\n";
  321. $counter++;
  322. }
  323. $list2 = learnpath :: get_iv_objectives_array($row['iv_id']);
  324. foreach ($list2 as $id => $interaction) {
  325. if (($counter % 2) == 0) {
  326. $oddclass = "row_odd";
  327. } else {
  328. $oddclass = "row_even";
  329. }
  330. $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" .
  331. '<td colspan="2">' . $interaction['status'] . "</td>\n" .
  332. '<td>' . $interaction['score_raw'] . "</td>\n" . '<td>' . $interaction['score_max'] . "</td>\n" . '<td>' . $interaction['score_min'] . "</td>\n<td></td>\n</tr>\n";
  333. $counter++;
  334. }
  335. }
  336. } while ($row = Database :: fetch_array($result));
  337. } elseif ($num > 0) {
  338. $row = Database :: fetch_array($result);
  339. $my_id = $row['myid'];
  340. $my_lp_id = $row['mylpid'];
  341. $my_lp_view_id = $row['mylpviewid'];
  342. $my_path = $row['path'];
  343. $result_disabled_ext_all = false;
  344. if($row['item_type'] == 'quiz') {
  345. //check results_disabled in quiz table
  346. $my_path = Database::escape_string($my_path);
  347. $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
  348. $res_result_disabled = Database::query($sql);
  349. $row_result_disabled = Database::fetch_row($res_result_disabled);
  350. if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) {
  351. $result_disabled_ext_all = true;
  352. }
  353. }
  354. //check if there are interactions below
  355. $extend_attempt_link = '';
  356. $extend_this_attempt = 0;
  357. $inter_num = learnpath :: get_interactions_count_from_db($row['iv_id']);
  358. $objec_num = learnpath :: get_objectives_count_from_db($row['iv_id']);
  359. if (($inter_num > 0 || $objec_num > 0) && !$extend_all) {
  360. if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
  361. //the extend button for this attempt has been clicked
  362. $extend_this_attempt = 1;
  363. $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/visible.gif" alt="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('HideAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
  364. } else { //same case if fold_attempt_id is set, so not implemented explicitly
  365. //the extend button for this attempt has not been clicked
  366. $extend_attempt_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>' . "\n";
  367. }
  368. }
  369. if (($counter % 2) == 0) {
  370. $oddclass = "row_odd";
  371. } else {
  372. $oddclass = "row_even";
  373. }
  374. //$extend_link = '<img src="../img/invisible.gif" alt="extend_disabled">';
  375. $extend_link = '';
  376. if ($inter_num > 1) {
  377. $extend_link = '<a href="' . api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix . '"><img src="../img/invisible.gif" alt="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" title="'.api_convert_encoding(get_lang('ExtendAttemptView'),$lp_charset,$charset).'" border="0"></a>';
  378. }
  379. if (($counter % 2) == 0) {
  380. $oddclass = "row_odd";
  381. } else {
  382. $oddclass = "row_even";
  383. }
  384. $lesson_status = $row['mystatus'];
  385. $score = $row['myscore'];
  386. $subtotal_time = $row['mytime'];
  387. //if($row['mytime']==0){
  388. while ($tmp_row = Database :: fetch_array($result)) {
  389. $subtotal_time += $tmp_row['mytime'];
  390. }
  391. //}
  392. //$time_for_total = $subtotal_time;
  393. //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
  394. $scoIdentifier = $row['myid'];
  395. $title = $row['mytitle'];
  396. // selecting the exe_id from stats attempts tables in order to look the max score value
  397. if ($origin != 'tracking') {
  398. $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" ORDER BY exe_date DESC limit 1';
  399. } else {
  400. $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" ORDER BY exe_date DESC limit 1';
  401. }
  402. $resultLastAttempt = Database::query($sql_last_attempt);
  403. $num = Database :: num_rows($resultLastAttempt);
  404. if ($num > 0) {
  405. while ($rowLA = Database :: fetch_array($resultLastAttempt)) {
  406. $id_last_attempt = $rowLA['exe_id'];
  407. }
  408. }
  409. if ($score == 0) {
  410. $maxscore = $row['mymaxscore'];
  411. } else {
  412. if ($row['item_type'] == 'sco') {
  413. if (!empty ($row['myviewmaxscore']) and $row['myviewmaxscore'] > 0) {
  414. $maxscore = $row['myviewmaxscore'];
  415. }
  416. elseif ($row['myviewmaxscore'] === '') {
  417. $maxscore = 0;
  418. } else {
  419. $maxscore = $row['mymaxscore'];
  420. }
  421. } else {
  422. if ($row['item_type'] == 'quiz') {
  423. // get score and total time from last attempt of a exercise en lp
  424. $sql = "SELECT score FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."'
  425. ORDER BY view_count DESC limit 1";
  426. $res_score = Database::query($sql);
  427. $row_score = Database::fetch_array($res_score);
  428. $sql = "SELECT SUM(total_time) as total_time FROM $TBL_LP_ITEM_VIEW WHERE lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."'";
  429. $res_time = Database::query($sql);
  430. $row_time = Database::fetch_array($res_time);
  431. if (Database::num_rows($res_score) > 0 && Database::num_rows($res_time) > 0) {
  432. $score = (float)$row_score['score'];
  433. $subtotal_time = (int)$row_time['total_time'];
  434. } else {
  435. $score = 0;
  436. $subtotal_time = 0;
  437. }
  438. //echo $subtotal_time ;
  439. //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
  440. // selecting the max score from an attempt
  441. $sql = "SELECT SUM(t.ponderation) as maxscore from ( SELECT distinct question_id, marks,ponderation FROM $tbl_stats_attempts as at " .
  442. "INNER JOIN $tbl_quiz_questions as q on(q.id = at.question_id) where exe_id ='$id_last_attempt' ) as t";
  443. $result = Database::query($sql);
  444. $row_max_score = Database :: fetch_array($result);
  445. $maxscore = $row_max_score['maxscore'];
  446. } else {
  447. $maxscore = $row['mymaxscore'];
  448. }
  449. }
  450. }
  451. $time_for_total = $subtotal_time;
  452. //$subtotal_time.' - ';
  453. $time = learnpathItem :: get_scorm_time('js', $subtotal_time);
  454. //var_dump($time );
  455. if (empty ($title)) {
  456. $title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
  457. }
  458. //Remove "NaN" if any (@todo: locate the source of these NaN)
  459. //$time = str_replace('NaN', '00'.$h.'00\'00"', $time);
  460. if (($lesson_status == 'completed') or ($lesson_status == 'passed')) {
  461. $color = 'green';
  462. } else {
  463. $color = 'black';
  464. }
  465. $mylanglist = array (
  466. 'completed' => 'ScormCompstatus',
  467. 'incomplete' => 'ScormIncomplete',
  468. 'failed' => 'ScormFailed',
  469. 'passed' => 'ScormPassed',
  470. 'browsed' => 'ScormBrowsed',
  471. 'not attempted' => 'ScormNotAttempted',
  472. );
  473. $my_lesson_status = api_convert_encoding(get_lang($mylanglist[$lesson_status]), $lp_charset, $dokeos_charset);
  474. if ($row['item_type'] != 'dokeos_chapter') {
  475. if ($row['item_type'] == 'quiz') {
  476. $correct_test_link = '';
  477. $my_url_suffix ='';
  478. if ($origin != 'tracking' && $origin != 'tracking_course') {
  479. $my_url_suffix = '&course=' . api_get_course_id() . '&student_id=' . api_get_user_id() . '&lp_id=' . Security::remove_XSS($row['mylpid']);
  480. $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" ORDER BY exe_date DESC ';
  481. } else {
  482. $my_url_suffix = '&course=' . Security::remove_XSS($_GET['course']) . '&student_id=' . $student_id . '&lp_id=' . Security::remove_XSS($row['mylpid']).'&origin=' . Security::remove_XSS($_GET['origin'].$from_link);
  483. $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $student_id . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($_GET['course']) . '" AND status <> "incomplete" ORDER BY exe_date DESC ';
  484. }
  485. $resultLastAttempt = Database::query($sql_last_attempt);
  486. $num = Database :: num_rows($resultLastAttempt);
  487. if ($num > 0) {
  488. if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id) ) {
  489. $correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&my_ext_lp_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.api_convert_encoding(get_lang('HideAllAttempts'),$lp_charset,$charset).'"></a>';
  490. $extend_attempt = 1;
  491. } else {
  492. $correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&my_lp_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.api_convert_encoding(get_lang('ShowAllAttemptsByExercise'),$lp_charset,$charset).'"></a>';
  493. }
  494. } else {
  495. $correct_test_link = '-';
  496. }
  497. } else {
  498. $correct_test_link = '-';
  499. }
  500. //."<td><font color='$color'><div class='mystatus'>".api_htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)."</div></font></td>\n"
  501. $title = Security::remove_XSS($title);
  502. if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
  503. $output .= "<tr class='$oddclass' >\n" . "<td>$extend_link</td>\n" . '<td colspan="4"><div class="mystatus">' .$title. '</div></td>' . "\n";
  504. $output .= '<td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td>'.$correct_test_link.'</td></tr>';
  505. $output .= "</tr>\n";
  506. } else {
  507. if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_ext_lp_id']) && $_GET['my_ext_lp_id'] == $my_id)) {
  508. $output .= "<tr class='$oddclass' >\n";
  509. } else {
  510. $output .= "<tr class='$oddclass'>\n";
  511. }
  512. $output .= "<td>$extend_link</td>\n" . '<td colspan="4"><div class="mystatus">' .$title. '</div></td>' . "\n";
  513. $output .= '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . "</div></font></td>\n" . '<td colspan="2"><div class="mystatus" align="center">';
  514. if ($row['item_type'] == 'quiz') {
  515. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  516. $output .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
  517. } else {
  518. $output .= ($score == 0 ? '0/'.float_format($maxscore, 1) : ($maxscore == 0 ? $score : float_format($score, 1) . '/' . float_format($maxscore, 1)));
  519. }
  520. } else {
  521. $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
  522. }
  523. $output .= "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>\n";
  524. $output .= "</tr>\n";
  525. }
  526. if (!empty($export_csv)) {
  527. $temp = array ();
  528. $temp[] = api_html_entity_decode($title, ENT_QUOTES, $lp_charset);
  529. $temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES, $lp_charset);
  530. if ($row['item_type'] == 'quiz') {
  531. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  532. $temp[] = '/';
  533. } else {
  534. $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
  535. }
  536. } else {
  537. $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
  538. }
  539. $temp[] = $time;
  540. $csv_content[] = $temp;
  541. }
  542. }
  543. $counter++;
  544. if ($extend_this_attempt OR $extend_all) {
  545. $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
  546. foreach ($list1 as $id => $interaction) {
  547. if (($counter % 2) == 0) {
  548. $oddclass = "row_odd";
  549. } else {
  550. $oddclass = "row_even";
  551. }
  552. $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td>' . $interaction['id'] . '</td>' . "\n"
  553. //."<td><font color='$color'><div class='mystatus'>"api_convert_encoding($array_status[$lesson_status],$lp_charset,$lp_charset)."</div></font></td>\n"
  554. . '<td colspan="2">' . $interaction['type'] . "</td>\n"
  555. //.'<td>'.$interaction['correct_responses']."</td>\n"
  556. . '<td>' . urldecode($interaction['student_response']) . "</td>\n" . '<td>' . $interaction['result'] . "</td>\n" . '<td>' . $interaction['latency'] . "</td>\n" . '<td>' . $interaction['time'] . "</td>\n<td></td>\n</tr>\n";
  557. $counter++;
  558. }
  559. $list2 = learnpath :: get_iv_objectives_array($row['iv_id']);
  560. foreach ($list2 as $id => $interaction) {
  561. if (($counter % 2) == 0) {
  562. $oddclass = "row_odd";
  563. } else {
  564. $oddclass = "row_even";
  565. }
  566. $output .= "<tr class='$oddclass'>\n" . '<td></td>' . "\n" . '<td></td>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . $interaction['order_id'] . '</td>' . "\n" . '<td colspan="2">' . $interaction['objective_id'] . '</td>' . "\n" .
  567. '<td colspan="2">' . $interaction['status'] . "</td>\n" .
  568. '<td>' . $interaction['score_raw'] . "</td>\n" . '<td>' . $interaction['score_max'] . "</td>\n" . '<td>' . $interaction['score_min'] . "</td>\n<td></td>\n</tr>\n";
  569. $counter++;
  570. }
  571. }
  572. // attempts list by exercise
  573. if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['my_lp_id']) && $_GET['my_lp_id'] == $my_id)) {
  574. $res_attempts = Database::query($sql_attempts);
  575. $num_attempts = Database :: num_rows($res_attempts);
  576. if ($row['item_type'] === 'quiz') {
  577. if ($num_attempts > 0) {
  578. $n=1;
  579. while ($row_attempts = Database :: fetch_array($res_attempts)) {
  580. $my_score = $row_attempts['exe_result'];
  581. $my_maxscore = $row_attempts['exe_weighting'];
  582. $my_exe_id = $row_attempts['exe_id'];
  583. $my_orig_lp = $row_attempts['orig_lp_id'];
  584. $my_orig_lp_item = $row_attempts['orig_lp_item_id'];
  585. $my_exo_exe_id=$row_attempts['exe_exo_id'];
  586. $mktime_start_date = convert_mysql_date($row_attempts['start_date']);
  587. $mktime_exe_date = convert_mysql_date($row_attempts['exe_date']);
  588. $mytime = ((int)$mktime_exe_date-(int)$mktime_start_date);
  589. $time_attemp = learnpathItem :: get_scorm_time('js', $mytime);
  590. $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
  591. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  592. $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
  593. } else {
  594. //show only float when need it
  595. $my_score = float_format( $my_score, 1);
  596. $my_maxscore =float_format($my_maxscore, 1);
  597. if ($my_score == 0 ){
  598. $view_score = '0/'.$my_maxscore;
  599. } else {
  600. if ($my_maxscore==0)
  601. $view_score = $my_score;
  602. else
  603. $view_score = $my_score . '/' . $my_maxscore;
  604. }
  605. //$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));
  606. }
  607. $time_attemp;
  608. $output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . api_convert_encoding(get_lang('Attempt'), $lp_charset, $dokeos_charset) . ' ' . $n . '</td>'
  609. . '<td colspan="2"><font color="' . $color . '"><div class="mystatus">' . $my_lesson_status . '</div></font></td><td colspan="2"><div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>';
  610. if ($origin != 'tracking') {
  611. if (!$is_allowed_to_edit && $result_disabled_ext_all) {
  612. $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></td>';
  613. } else {
  614. $output .= '<td><a href="../exercice/exercise_show.php?origin=student_progress&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id .$from_link. '" target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
  615. }
  616. } else {
  617. if (!$is_allowed_to_edit && $result_disabled_ext_all ) {
  618. $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></td>';
  619. } else {
  620. $output .= '<td><a href="../exercice/exercise_show.php?origin=tracking_course&myid='.$my_orig_lp.'&my_lp_id='.$my_orig_lp_item.'&id=' . $my_exe_id . '&cidReq=' . $course_code . '&student=' . $student_id . '&total_time='.$mytime.'&my_exe_exo_id='.$my_exo_exe_id.$from_link.' " target="_parent"><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'" title="'.api_convert_encoding(get_lang('ShowAndQualifyAttempt'), $lp_charset, $dokeos_charset).'"></a></td>';
  621. }
  622. }
  623. $output .= '</tr>';
  624. $n++;
  625. }
  626. }
  627. $output .= '<tr><td colspan="12">&nbsp;</td></tr>';
  628. }
  629. }
  630. }
  631. $total_time += $time_for_total;
  632. //QUIZZ IN LP
  633. $a_my_id = array();
  634. if (!empty($my_lp_id)) {
  635. $a_my_id[] = $my_lp_id;
  636. }
  637. }
  638. }
  639. if (!empty($a_my_id)) {
  640. $my_studen_id = 0;
  641. $my_course_id = '';
  642. if ($origin == 'tracking') {
  643. $my_studen_id = $student_id;
  644. $my_course_id = Database::escape_string($_GET['course']);
  645. } else {
  646. $my_studen_id = intval(api_get_user_id());
  647. $my_course_id = Database::escape_string(api_get_course_id());
  648. }
  649. $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, $a_my_id);
  650. } else {
  651. if ($origin == 'tracking') {
  652. $my_studen_id = $student_id;
  653. $my_course_id = Database::escape_string($_GET['course']);
  654. if (!empty($my_studen_id) && !empty($my_course_id)) {
  655. $total_score = Tracking::get_avg_student_score($my_studen_id, $my_course_id, array(intval($_GET['lp_id'])));
  656. } else {
  657. $total_score = 0;
  658. }
  659. } else {
  660. $total_score = 0;
  661. }
  662. }
  663. $total_time = learnpathItem :: get_scorm_time('js', $total_time);
  664. //$total_time = str_replace('NaN','00:00:00',$total_time);
  665. $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
  666. $lp_type = learnpath :: get_type_static($lp_id);
  667. $total_percent = 0;
  668. if(!$is_allowed_to_edit && $result_disabled_ext_all) {
  669. $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
  670. } else {
  671. if (is_numeric($total_score))
  672. $final_score = $total_score.'%';
  673. else
  674. $final_score = $total_score;
  675. }
  676. if (($counter % 2) == 0) {
  677. $oddclass = "row_odd";
  678. } else {
  679. $oddclass = "row_even";
  680. }
  681. if (empty($extend_all)) {
  682. $output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . '<td colspan="4"><div class="mystatus"><i>' . api_convert_encoding(get_lang('AccomplishedStepsTotal') , $lp_charset, $dokeos_charset) . "</i></div></td>\n"
  683. . '<td colspan="2"></td>' . "\n" . '<td colspan="2"><div class="mystatus" align="center">' . $final_score . "</div></td>\n" . '<td colspan="2"><div class="mystatus">' . $total_time . '</div></td><td></td>' . "\n" . "</tr>\n";
  684. }
  685. $output .= "</table></td></tr></table>";
  686. if (!empty($export_csv)) {
  687. $temp = array (
  688. '',
  689. '',
  690. '',
  691. ''
  692. );
  693. $csv_content[] = $temp;
  694. $temp = array (
  695. api_convert_encoding(get_lang('AccomplishedStepsTotal') , $lp_charset, $dokeos_charset),
  696. '',
  697. $final_score,
  698. $total_time
  699. );
  700. $csv_content[] = $temp;
  701. ob_end_clean();
  702. Export :: export_table_csv($csv_content, 'reporting_learning_path_details');
  703. exit;
  704. }
  705. if ($origin != 'tracking') {
  706. $output .= "</body></html>";
  707. }
  708. if (empty($export_csv)) {
  709. echo $output;
  710. }