Minor - Cleaning code

skala
Julio Montoya 13 years ago
parent 67f9963f7d
commit d66bf70b13
  1. 295
      main/newscorm/lp_stats.php

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script displays statistics on the current learning path (scorm) * This script displays statistics on the current learning path (scorm)
@ -7,7 +8,6 @@
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
* @todo clean this file like the exercise files J.M * @todo clean this file like the exercise files J.M
*/ */
/** /**
* Code * Code
*/ */
@ -22,7 +22,6 @@ if (empty($user_id)) {
} }
// Declare variables to be used in lp_stats.php // Declare variables to be used in lp_stats.php
//When checking the reporting myspace/lp_tracking.php //When checking the reporting myspace/lp_tracking.php
if (isset($_GET['lp_id']) && isset($lp_id) && !empty($lp_id)) { if (isset($_GET['lp_id']) && isset($lp_id) && !empty($lp_id)) {
$lp_id = intval($lp_id); $lp_id = intval($lp_id);
@ -56,42 +55,36 @@ if (!isset($origin)) {
//Origin = tracking means that teachers see that info in the Reporting tool //Origin = tracking means that teachers see that info in the Reporting tool
if ($origin != 'tracking') { if ($origin != 'tracking') {
Display::display_reduced_header(); Display::display_reduced_header();
echo '<body dir="'.api_get_text_direction().'">';
} }
$output = ''; $output = '';
// if display in fullscreen required.
if (!empty($_GET['fs']) && strcmp($_GET['fs'], 'true') == 0) {
$output .= '<table width="100%" align="center">';
} else {
$output .= '<table width="100%">';
}
// Check if the user asked for the "extend all" option. // Check if the user asked for the "extend all" option.
$extend_all_link = ''; $extend_all_link = '';
$extend_all = 0; $extend_all = 0;
if ($origin == 'tracking') { if ($origin == 'tracking') {
$url_suffix = '&session_id='.$session_id.'&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; $url_suffix = '&session_id=' . $session_id . '&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;
} else { } else {
$url_suffix = '&lp_id=' . $lp_id; $url_suffix = '&lp_id=' . $lp_id;
} }
if (!empty($_GET['extend_all'])) { if (!empty($_GET['extend_all'])) {
$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="'.get_lang('HideAllAttempts').'"></a>'; $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="' . get_lang('HideAllAttempts') . '"></a>';
$extend_all = 1; $extend_all = 1;
} else { } else {
$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="'.get_lang('ShowAllAttempts').'"></a>'; $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="' . get_lang('ShowAllAttempts') . '"></a>';
} }
if ($origin != 'tracking') { if ($origin != 'tracking') {
$output .= "<tr><td><h2>" . get_lang('ScormMystatus') . "</h2></td></tr>"; $output .= Display::page_header(get_lang('ScormMystatus'));
} }
$output .= '<tr><td><table border="0" class="data_table"><tr>'.
$output .= '<table class="data_table"><tr>' .
'<th width="16">' . $extend_all_link . '</td>' . '<th width="16">' . $extend_all_link . '</td>' .
'<th colspan="4" class="title"><div class="mystatusfirstrow">' . get_lang('ScormLessonTitle') . "</div></td>" . '<th colspan="4" class="title"><div class="mystatusfirstrow">' . get_lang('ScormLessonTitle') . "</div></td>" .
'<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormStatus') . "</div></td>" . '<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormStatus') . "</div></td>" .
'<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormScore') . "</div></td>" . '<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormScore') . "</div></td>" .
'<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormTime') . "</div></td>". '<th colspan="2" class="title"><div class="mystatusfirstrow">' . get_lang('ScormTime') . "</div></td>" .
'<th class="title"><div class="mystatusfirstrow">'.get_lang('Actions') . '</div></td></tr>'; '<th class="title"><div class="mystatusfirstrow">' . get_lang('Actions') . '</div></td></tr>';
// Going through the items using the $items[] array instead of the database order ensures // Going through the items using the $items[] array instead of the database order ensures
// we get them in the same order as in the imsmanifest file, which is rather random when using // we get them in the same order as in the imsmanifest file, which is rather random when using
@ -120,7 +113,7 @@ $total_time = 0;
$h = get_lang('h'); $h = get_lang('h');
if (!empty($export_csv)) { if (!empty($export_csv)) {
$csv_content[] = array ( $csv_content[] = array(
get_lang('ScormLessonTitle'), get_lang('ScormLessonTitle'),
get_lang('ScormStatus'), get_lang('ScormStatus'),
get_lang('ScormScore'), get_lang('ScormScore'),
@ -140,10 +133,24 @@ if (isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) {
if (Database::num_rows($res_path) > 0) { if (Database::num_rows($res_path) > 0) {
if ($origin != 'tracking') { if ($origin != 'tracking') {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' $sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . '
WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND status <> "incomplete" AND exe_user_id="' . 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 session_id = '.$session_id.' ORDER BY exe_date'; WHERE exe_exo_id="' . (int) $row_path['path'] . '" AND
status <> "incomplete" AND
exe_user_id="' . 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
session_id = ' . $session_id . '
ORDER BY exe_date';
} else { } else {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' $sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . '
WHERE exe_exo_id="' . (int)$row_path['path'] . '" AND status <> "incomplete" 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 session_id = '.$session_id.' ORDER BY exe_date'; WHERE exe_exo_id="' . (int) $row_path['path'] . '" AND
status <> "incomplete" 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
session_id = ' . $session_id . '
ORDER BY exe_date';
} }
} }
//var_dump($sql_attempts); //var_dump($sql_attempts);
@ -154,15 +161,14 @@ if (is_array($list) && count($list) > 0) {
foreach ($list as $my_item_id) { foreach ($list as $my_item_id) {
$extend_this = 0; $extend_this = 0;
$qry_order = 'DESC'; $qry_order = 'DESC';
if ((!empty ($_GET['extend_id']) && $_GET['extend_id'] == $my_item_id) || $extend_all) { if ((!empty($_GET['extend_id']) && $_GET['extend_id'] == $my_item_id) || $extend_all) {
$extend_this = 1; $extend_this = 1;
$qry_order = 'ASC'; $qry_order = 'ASC';
} }
// Prepare statement to go through each attempt. // Prepare statement to go through each attempt.
if (!empty($view)) { if (!empty($view)) {
$sql = "SELECT $sql = "SELECT iv.status as mystatus,
iv.status as mystatus,
v.view_count as mycount, v.view_count as mycount,
iv.score as myscore, iv.score as myscore,
iv.total_time as mytime, iv.total_time as mytime,
@ -183,12 +189,12 @@ if (is_array($list) && count($list) > 0) {
i.id = $my_item_id AND i.id = $my_item_id AND
i.lp_id = $lp_id AND i.lp_id = $lp_id AND
v.user_id = $user_id AND v.user_id = $user_id AND
v.view_count = $view AND v.session_id = $session_id v.view_count = $view AND
v.session_id = $session_id
ORDER BY iv.view_count $qry_order "; ORDER BY iv.view_count $qry_order ";
//var_dump($sql); //var_dump($sql);
} else { } else {
$sql = "SELECT $sql = "SELECT iv.status as mystatus,
iv.status as mystatus,
v.view_count as mycount, v.view_count as mycount,
iv.score as myscore, iv.score as myscore,
iv.total_time as mytime, iv.total_time as mytime,
@ -224,16 +230,15 @@ if (is_array($list) && count($list) > 0) {
// Check results_disabled in quiz table. // Check results_disabled in quiz table.
$my_path = Database::escape_string($row['path']); $my_path = Database::escape_string($row['path']);
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='".$my_path."'"; $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='" . $my_path . "'";
$res_result_disabled = Database::query($sql); $res_result_disabled = Database::query($sql);
$row_result_disabled = Database::fetch_row($res_result_disabled); $row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) { if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) {
$result_disabled_ext_all = true; $result_disabled_ext_all = true;
} }
} }
//echo '<br /><pre>'; print_r($row); echo '</pre><br />';
// If there are several attempts, and the link to extend has been clicked, show each attempt... // If there are several attempts, and the link to extend has been clicked, show each attempt...
if (($counter % 2) == 0) { if (($counter % 2) == 0) {
$oddclass = 'row_odd'; $oddclass = 'row_odd';
@ -242,7 +247,7 @@ if (is_array($list) && count($list) > 0) {
} }
$extend_link = ''; $extend_link = '';
if (!empty($inter_num)) { if (!empty($inter_num)) {
$extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n"; $extend_link = '<a href="' . api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix . '"><img src="../img/visible.gif" alt="' . get_lang('HideAttemptView') . '" title="' . get_lang('HideAttemptView') . '" border="0"></a>' . "\n";
} }
$title = $row['mytitle']; $title = $row['mytitle'];
@ -253,7 +258,15 @@ if (is_array($list) && count($list) > 0) {
if ($row['item_type'] != 'dokeos_chapter') { if ($row['item_type'] != 'dokeos_chapter') {
$correct_test_link = '-'; $correct_test_link = '-';
$title = Security::remove_XSS($title); $title = Security::remove_XSS($title);
$output .= "<tr class='$oddclass'>" . "<td>$extend_link</td>" . '<td colspan="4" class="content"><div class="mystatus">' . $title . "</div></td>" . '<td colspan="2" class="content"></td>'.'<td colspan="2" class="content"></td>'.'<td colspan="2" class="content"></td><td class="content"></td>' . "</tr>"; $output .= '<tr class="'.$oddclass.'">
<td>'.$extend_link.'</td>
<td colspan="4" class="content">
<div class="mystatus">'.$title.'</div>
</td>
<td colspan="2" class="content"></td>
<td colspan="2" class="content"></td>
<td colspan="2" class="content"></td>
<td class="content"></td></tr>';
} }
$counter++; $counter++;
@ -263,13 +276,13 @@ if (is_array($list) && count($list) > 0) {
$extend_attempt_link = ''; $extend_attempt_link = '';
$extend_this_attempt = 0; $extend_this_attempt = 0;
if ((learnpath :: get_interactions_count_from_db($row['iv_id'], $course_id) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id'], $course_id) > 0) && !$extend_all) { if ((learnpath :: get_interactions_count_from_db($row['iv_id'], $course_id) > 0 || learnpath :: get_objectives_count_from_db($row['iv_id'], $course_id) > 0) && !$extend_all) {
if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) { if (!empty($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
// The extend button for this attempt has been clicked. // The extend button for this attempt has been clicked.
$extend_this_attempt = 1; $extend_this_attempt = 1;
$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="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n"; $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="' . get_lang('HideAttemptView') . '" title="' . get_lang('HideAttemptView') . '" border="0"></a>';
} else { // Same case if fold_attempt_id is set, so not implemented explicitly. } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
// The extend button for this attempt has not been clicked. // The extend button for this attempt has not been clicked.
$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="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>' . "\n"; $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="' . get_lang('ExtendAttemptView') . '" title="' . get_lang('ExtendAttemptView') . '" border="0"></a>';
} }
} }
@ -290,7 +303,7 @@ if (is_array($list) && count($list) > 0) {
$maxscore = $row['mymaxscore']; $maxscore = $row['mymaxscore'];
} else { } else {
if ($row['item_type'] == 'sco') { if ($row['item_type'] == 'sco') {
if (!empty ($row['myviewmaxscore']) && $row['myviewmaxscore'] > 0) { if (!empty($row['myviewmaxscore']) && $row['myviewmaxscore'] > 0) {
$maxscore = $row['myviewmaxscore']; $maxscore = $row['myviewmaxscore'];
} elseif ($row['myviewmaxscore'] === '') { } elseif ($row['myviewmaxscore'] === '') {
$maxscore = 0; $maxscore = 0;
@ -309,7 +322,7 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$class_status = 'default'; $class_status = 'default';
} }
$mylanglist = array ( $mylanglist = array(
'completed' => 'ScormCompstatus', 'completed' => 'ScormCompstatus',
'incomplete' => 'ScormIncomplete', 'incomplete' => 'ScormIncomplete',
'failed' => 'ScormFailed', 'failed' => 'ScormFailed',
@ -326,7 +339,7 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
switch ($row['item_type']) { switch ($row['item_type']) {
case 'sco': case 'sco':
if ($maxscore == 0 ) { if ($maxscore == 0) {
$view_score = $score; $view_score = $score;
} else { } else {
$view_score = show_score($score, $maxscore, false); $view_score = show_score($score, $maxscore, false);
@ -340,18 +353,18 @@ if (is_array($list) && count($list) > 0) {
break; break;
} }
} }
$output .= '<tr class="'.$oddclass.'"> $output .= '<tr class="' . $oddclass . '">
<td></td> <td></td>
<td>'.$extend_attempt_link.'</td> <td>' . $extend_attempt_link . '</td>
<td colspan="3">'.get_lang('Attempt').' '.$row['iv_view_count'].'</td> <td colspan="3">' . get_lang('Attempt') . ' ' . $row['iv_view_count'] . '</td>
<td colspan="2">'.Display::label($my_lesson_status, $class_status).'</td> <td colspan="2">' . Display::label($my_lesson_status, $class_status) . '</td>
<td colspan="2"><div class="mystatus" align="center">'.$view_score.'</div></td> <td colspan="2"><div class="mystatus" align="center">' . $view_score . '</div></td>
<td colspan="2"><div class="mystatus">'.$time.'</div></td> <td colspan="2"><div class="mystatus">' . $time . '</div></td>
<td></td> <td></td>
</tr>'; </tr>';
if (!empty($export_csv)) { if (!empty($export_csv)) {
$temp = array (); $temp = array();
$temp[] = $title = Security::remove_XSS($title); $temp[] = $title = Security::remove_XSS($title);
$temp[] = Security::remove_XSS($my_lesson_status); $temp[] = Security::remove_XSS($my_lesson_status);
@ -359,9 +372,8 @@ if (is_array($list) && count($list) > 0) {
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$temp[] = '/'; $temp[] = '/';
} else { } else {
$temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
} else { } else {
$temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
@ -382,15 +394,15 @@ if (is_array($list) && count($list) > 0) {
} }
$student_response = urldecode($interaction['student_response']); // Code added by Isaac Flores. $student_response = urldecode($interaction['student_response']); // Code added by Isaac Flores.
$content_student_response = array(); $content_student_response = array();
$content_student_response = explode('__|',$student_response); $content_student_response = explode('__|', $student_response);
if (count($content_student_response)>0) { if (count($content_student_response) > 0) {
if (count($content_student_response) >= 3) { if (count($content_student_response) >= 3) {
$new_content_student_response = array_pop($content_student_response); // Pop the element off the end of array. $new_content_student_response = array_pop($content_student_response); // Pop the element off the end of array.
} }
$student_response = implode(',',$content_student_response); $student_response = implode(',', $content_student_response);
} }
$output .= "<tr class='$oddclass'>" . '<td></td>' . '<td></td>' .'<td>&nbsp;</td>' . '<td>' . $interaction['order_id'] . '</td>' .'<td>' . $interaction['id'] . '</td>' $output .= "<tr class='$oddclass'>" . '<td></td>' . '<td></td>' . '<td>&nbsp;</td>' . '<td>' . $interaction['order_id'] . '</td>' . '<td>' . $interaction['id'] . '</td>'
. '<td colspan="2">' . $interaction['type'] . "</td>" . '<td colspan="2">' . $interaction['type'] . "</td>"
. '<td>' . $student_response . "</td>" . '<td>' . $interaction['result'] . "</td>" . '<td>' . $interaction['latency'] . "</td>" . '<td>' . $interaction['time'] . "</td><td></td></tr>"; . '<td>' . $student_response . "</td>" . '<td>' . $interaction['result'] . "</td>" . '<td>' . $interaction['latency'] . "</td>" . '<td>' . $interaction['time'] . "</td><td></td></tr>";
$counter++; $counter++;
@ -402,18 +414,17 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$oddclass = 'row_even'; $oddclass = 'row_even';
} }
$output .= "<tr class='$oddclass'>" . '<td></td>' . '<td></td>'.'<td>&nbsp;</td>' .'<td>' . $interaction['order_id'] . '</td>'. '<td colspan="2">' . $interaction['objective_id'] . '</td>'. $output .= "<tr class='$oddclass'>" . '<td></td>' . '<td></td>' . '<td>&nbsp;</td>' . '<td>' . $interaction['order_id'] . '</td>' . '<td colspan="2">' . $interaction['objective_id'] . '</td>' .
'<td colspan="2">' . $interaction['status'] . "</td>\n" . '<td colspan="2">' . $interaction['status'] . "</td>\n" .
'<td>' . $interaction['score_raw'] . "</td>" . '<td>' . $interaction['score_max'] . "</td>" . '<td>' . $interaction['score_min'] . "</td><td></td></tr>"; '<td>' . $interaction['score_raw'] . "</td>" . '<td>' . $interaction['score_max'] . "</td>" . '<td>' . $interaction['score_min'] . "</td><td></td></tr>";
$counter++; $counter++;
} }
} }
} while ($row = Database :: fetch_array($result)); } while ($row = Database :: fetch_array($result));
} elseif ($num > 0) { } elseif ($num > 0) {
//Not extended //Not extended
$row = Database :: fetch_array($result,'ASSOC'); $row = Database :: fetch_array($result, 'ASSOC');
$my_id = $row['myid']; $my_id = $row['myid'];
$my_lp_id = $row['mylpid']; $my_lp_id = $row['mylpid'];
$my_lp_view_id = $row['mylpviewid']; $my_lp_view_id = $row['mylpviewid'];
@ -425,11 +436,11 @@ if (is_array($list) && count($list) > 0) {
// Check results_disabled in quiz table. // Check results_disabled in quiz table.
$my_path = Database::escape_string($my_path); $my_path = Database::escape_string($my_path);
$sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='".(int)$my_path."'"; $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE c_id = $course_id AND id ='" . (int) $my_path . "'";
$res_result_disabled = Database::query($sql); $res_result_disabled = Database::query($sql);
$row_result_disabled = Database::fetch_row($res_result_disabled); $row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0] === 1) { if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) {
$result_disabled_ext_all = true; $result_disabled_ext_all = true;
} }
} }
@ -442,13 +453,13 @@ if (is_array($list) && count($list) > 0) {
$extend_attempt_link = ''; $extend_attempt_link = '';
if (($inter_num > 0 || $objec_num > 0)) { if (($inter_num > 0 || $objec_num > 0)) {
if (!empty ($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) { if (!empty($_GET['extend_attempt_id']) && $_GET['extend_attempt_id'] == $row['iv_id']) {
// The extend button for this attempt has been clicked. // The extend button for this attempt has been clicked.
$extend_this_attempt = 1; $extend_this_attempt = 1;
$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="'.get_lang('HideAttemptView').'" title="'.get_lang('HideAttemptView').'" border="0"></a>' . "\n"; $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="' . get_lang('HideAttemptView') . '" title="' . get_lang('HideAttemptView') . '" border="0"></a>' . "\n";
} else { // Same case if fold_attempt_id is set, so not implemented explicitly. } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
// The extend button for this attempt has not been clicked. // The extend button for this attempt has not been clicked.
$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="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>' . "\n"; $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="' . get_lang('ExtendAttemptView') . '" title="' . get_lang('ExtendAttemptView') . '" border="0"></a>' . "\n";
} }
} }
@ -460,7 +471,7 @@ if (is_array($list) && count($list) > 0) {
$extend_link = ''; $extend_link = '';
if ($inter_num > 1) { if ($inter_num > 1) {
$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="'.get_lang('ExtendAttemptView').'" title="'.get_lang('ExtendAttemptView').'" border="0"></a>'; $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="' . get_lang('ExtendAttemptView') . '" title="' . get_lang('ExtendAttemptView') . '" border="0"></a>';
} }
$lesson_status = $row['mystatus']; $lesson_status = $row['mystatus'];
@ -479,9 +490,25 @@ if (is_array($list) && count($list) > 0) {
// Selecting the exe_id from stats attempts tables in order to look the max score value. // Selecting the exe_id from stats attempts tables in order to look the max score value.
if ($origin != 'tracking') { if ($origin != 'tracking') {
$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" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1'; $sql_last_attempt = 'SELECT * FROM ' . $tbl_stats_exercices . '
} else { WHERE exe_exo_id="' . $row['path'] . '" AND
$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" AND session_id = '.$session_id.' ORDER BY exe_date DESC limit 1'; 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" AND
session_id = ' . $session_id . '
ORDER BY exe_date DESC limit 1';
} else {
$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" AND
session_id = ' . $session_id . '
ORDER BY exe_date DESC limit 1';
} }
$resultLastAttempt = Database::query($sql_last_attempt); $resultLastAttempt = Database::query($sql_last_attempt);
@ -497,10 +524,9 @@ if (is_array($list) && count($list) > 0) {
$maxscore = $row['mymaxscore']; $maxscore = $row['mymaxscore'];
} else { } else {
if ($row['item_type'] == 'sco') { if ($row['item_type'] == 'sco') {
if (!empty ($row['myviewmaxscore']) and $row['myviewmaxscore'] > 0) { if (!empty($row['myviewmaxscore']) and $row['myviewmaxscore'] > 0) {
$maxscore = $row['myviewmaxscore']; $maxscore = $row['myviewmaxscore'];
} } elseif ($row['myviewmaxscore'] === '') {
elseif ($row['myviewmaxscore'] === '') {
$maxscore = 0; $maxscore = 0;
} else { } else {
$maxscore = $row['mymaxscore']; $maxscore = $row['mymaxscore'];
@ -509,19 +535,19 @@ if (is_array($list) && count($list) > 0) {
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
// Get score and total time from last attempt of a exercise en lp. // Get score and total time from last attempt of a exercise en lp.
$sql = "SELECT score FROM $TBL_LP_ITEM_VIEW $sql = "SELECT score FROM $TBL_LP_ITEM_VIEW
WHERE c_id = $course_id AND lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."' WHERE c_id = $course_id AND lp_item_id = '" . (int) $my_id . "' AND lp_view_id = '" . (int) $my_lp_view_id . "'
ORDER BY view_count DESC limit 1"; ORDER BY view_count DESC limit 1";
$res_score = Database::query($sql); $res_score = Database::query($sql);
$row_score = Database::fetch_array($res_score); $row_score = Database::fetch_array($res_score);
$sql = "SELECT SUM(total_time) as total_time FROM $TBL_LP_ITEM_VIEW $sql = "SELECT SUM(total_time) as total_time FROM $TBL_LP_ITEM_VIEW
WHERE c_id = $course_id AND lp_item_id = '".(int)$my_id."' and lp_view_id = '".(int)$my_lp_view_id."'"; WHERE c_id = $course_id AND lp_item_id = '" . (int) $my_id . "' AND lp_view_id = '" . (int) $my_lp_view_id . "'";
$res_time = Database::query($sql); $res_time = Database::query($sql);
$row_time = Database::fetch_array($res_time); $row_time = Database::fetch_array($res_time);
if (Database::num_rows($res_score) > 0 && Database::num_rows($res_time) > 0) { if (Database::num_rows($res_score) > 0 && Database::num_rows($res_time) > 0) {
$score = (float)$row_score['score']; $score = (float) $row_score['score'];
$subtotal_time = (int)$row_time['total_time']; $subtotal_time = (int) $row_time['total_time'];
} else { } else {
$score = 0; $score = 0;
$subtotal_time = 0; $subtotal_time = 0;
@ -529,9 +555,12 @@ if (is_array($list) && count($list) > 0) {
//echo $subtotal_time ; //echo $subtotal_time ;
//$time = learnpathItem :: get_scorm_time('js', $subtotal_time); //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
// Selecting the max score from an attempt. // Selecting the max score from an attempt.
$sql = "SELECT SUM(t.ponderation) as maxscore FROM ( $sql = "SELECT SUM(t.ponderation) as maxscore
SELECT distinct question_id, marks, ponderation FROM $tbl_stats_attempts as at INNER JOIN $tbl_quiz_questions as q FROM (
ON (q.id = at.question_id AND q.c_id = $course_id ) SELECT distinct question_id, marks, ponderation
FROM $tbl_stats_attempts as at INNER JOIN $tbl_quiz_questions as q
ON (q.id = at.question_id AND q.c_id = $course_id
)
WHERE exe_id ='$id_last_attempt' ) as t"; WHERE exe_id ='$id_last_attempt' ) as t";
$result = Database::query($sql); $result = Database::query($sql);
@ -545,7 +574,7 @@ if (is_array($list) && count($list) > 0) {
$time_for_total = $subtotal_time; $time_for_total = $subtotal_time;
$time = learnpathItem :: get_scorm_time('js', $subtotal_time); $time = learnpathItem :: get_scorm_time('js', $subtotal_time);
if (empty ($title)) { if (empty($title)) {
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']); $title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
} }
// Remove "NaN" if any (@todo: locate the source of these NaN) // Remove "NaN" if any (@todo: locate the source of these NaN)
@ -557,7 +586,7 @@ if (is_array($list) && count($list) > 0) {
$class_status = 'default'; $class_status = 'default';
} }
$mylanglist = array ( $mylanglist = array(
'completed' => 'ScormCompstatus', 'completed' => 'ScormCompstatus',
'incomplete' => 'ScormIncomplete', 'incomplete' => 'ScormIncomplete',
'failed' => 'ScormFailed', 'failed' => 'ScormFailed',
@ -571,24 +600,24 @@ if (is_array($list) && count($list) > 0) {
if ($row['item_type'] != 'dokeos_chapter') { if ($row['item_type'] != 'dokeos_chapter') {
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
$correct_test_link = ''; $correct_test_link = '';
$my_url_suffix =''; $my_url_suffix = '';
if ($origin != 'tracking' && $origin != 'tracking_course') { if ($origin != 'tracking' && $origin != 'tracking_course') {
$my_url_suffix = '&course=' . api_get_course_id() . '&student_id=' . api_get_user_id() . '&lp_id=' . Security::remove_XSS($row['mylpid']); $my_url_suffix = '&course=' . api_get_course_id() . '&student_id=' . api_get_user_id() . '&lp_id=' . Security::remove_XSS($row['mylpid']);
$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" AND session_id = '.$session_id.' ORDER BY exe_date DESC '; $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" AND session_id = ' . $session_id . ' ORDER BY exe_date DESC ';
} else { } else {
$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); $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);
$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" AND session_id = '.$session_id.' ORDER BY exe_date DESC '; $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" AND session_id = ' . $session_id . ' ORDER BY exe_date DESC ';
} }
$resultLastAttempt = Database::query($sql_last_attempt); $resultLastAttempt = Database::query($sql_last_attempt);
$num = Database :: num_rows($resultLastAttempt); $num = Database :: num_rows($resultLastAttempt);
if ($num > 0) { if ($num > 0) {
if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id) ) { if (isset($_GET['extend_attempt']) && $_GET['extend_attempt'] == 1 && (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id)) {
$correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&session_id='.api_get_session_id().'&lp_item_id='.$my_id.'"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="'.get_lang('HideAllAttempts').'"></a>'; $correct_test_link = '<a href="' . api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . api_get_session_id() . '&lp_item_id=' . $my_id . '"><img src="../img/view_less_stats.gif" alt="fold_view" border="0" title="' . get_lang('HideAllAttempts') . '"></a>';
$extend_attempt = 1; $extend_attempt = 1;
} else { } else {
$correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.api_get_session_id().'&lp_item_id='.$my_id.'"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="'.get_lang('ShowAllAttemptsByExercise').'"></a>'; $correct_test_link = '<a href="' . api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . api_get_session_id() . '&lp_item_id=' . $my_id . '"><img src="../img/view_more_stats.gif" alt="extend_view" border="0" title="' . get_lang('ShowAllAttemptsByExercise') . '"></a>';
} }
} else { } else {
$correct_test_link = '-'; $correct_test_link = '-';
@ -599,18 +628,18 @@ if (is_array($list) && count($list) > 0) {
$title = Security::remove_XSS($title); $title = Security::remove_XSS($title);
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id && false) ) { if ((isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id && false)) {
$output .= '<tr class='.$oddclass.'><td>'.$extend_link.'</td><td colspan="4"><div class="mystatus">'.$title.'</div></td>'; $output .= '<tr class=' . $oddclass . '><td>' . $extend_link . '</td><td colspan="4"><div class="mystatus">' . $title . '</div></td>';
$output .= '<td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td>'.$correct_test_link.'</td></tr>'; $output .= '<td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td colspan="2">&nbsp;</td><td>' . $correct_test_link . '</td></tr>';
$output .= "</tr>"; $output .= "</tr>";
} else { } else {
if ( (isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id)) { if ((isset($_GET['lp_id']) && $_GET['lp_id'] == $my_lp_id ) && (isset($_GET['lp_item_id']) && $_GET['lp_item_id'] == $my_id)) {
$output .= "<tr class='$oddclass'>"; $output .= "<tr class='$oddclass'>";
} else { } else {
$output .= "<tr class='$oddclass'>"; $output .= "<tr class='$oddclass'>";
} }
$output .= '<td>'.$extend_link.'</td><td colspan="4"><div class="mystatus">'.$title.'</div></td>'; $output .= '<td>' . $extend_link . '</td><td colspan="4"><div class="mystatus">' . $title . '</div></td>';
$output .= '<td colspan="2">' . Display::label($my_lesson_status, $class_status). "</td>" . '<td colspan="2"><div class="mystatus" align="center">'; $output .= '<td colspan="2">' . Display::label($my_lesson_status, $class_status) . "</td>" . '<td colspan="2"><div class="mystatus" align="center">';
if ($row['item_type'] == 'quiz') { if ($row['item_type'] == 'quiz') {
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); $output .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
@ -621,12 +650,12 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
} }
$output .= "</div></td>" . '<td colspan="2"><div class="mystatus">' . $time . "</div></td><td>$correct_test_link</td>"; $output .= '</div></td><td colspan="2"><div class="mystatus">' . $time .'</div></td><td>'.$correct_test_link.'</td>';
$output .= "</tr>"; $output .= "</tr>";
} }
if (!empty($export_csv)) { if (!empty($export_csv)) {
$temp = array (); $temp = array();
$temp[] = api_html_entity_decode($title, ENT_QUOTES); $temp[] = api_html_entity_decode($title, ENT_QUOTES);
$temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES); $temp[] = api_html_entity_decode($my_lesson_status, ENT_QUOTES);
@ -634,7 +663,7 @@ if (is_array($list) && count($list) > 0) {
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$temp[] = '/'; $temp[] = '/';
} else { } else {
$temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
} }
} else { } else {
$temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
@ -655,9 +684,19 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$oddclass = 'row_even'; $oddclass = 'row_even';
} }
$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" $output .= '<tr class="'.$oddclass.'">
. '<td colspan="2">' . $interaction['type'] . "</td>\n" <td></td>
. '<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"; <td></td>
<td></td>
<td>'.$interaction['order_id'].'</td>
<td>'.$interaction['id'].'</td>
<td colspan="2">' . $interaction['type'].'</td>
<td>'.urldecode($interaction['student_response']).'</td>
<td>'.$interaction['result'].'</td>
<td>'.$interaction['latency'].'</td>
<td>'.$interaction['time'].'</td>
<td></td>
</tr>';
$counter++; $counter++;
} }
$list2 = learnpath :: get_iv_objectives_array($row['iv_id']); $list2 = learnpath :: get_iv_objectives_array($row['iv_id']);
@ -667,9 +706,18 @@ if (is_array($list) && count($list) > 0) {
} else { } else {
$oddclass = 'row_even'; $oddclass = 'row_even';
} }
$output .= "<tr class='$oddclass'>" . '<td></td>' . '<td></td>' . '<td>&nbsp;</td>' . '<td>' . $interaction['order_id'] . '</td>'.'<td colspan="2">' . $interaction['objective_id'] . '</td>'. $output .= '<tr class="'.$oddclass.'">
'<td colspan="2">' . $interaction['status'] . "</td>" . <td></td>
'<td>' . $interaction['score_raw'] . "</td>" . '<td>' . $interaction['score_max'] . "</td>" . '<td>' . $interaction['score_min'] . "</td>\n<td></td>\n</tr>"; <td></td>
<td></td>
<td>' . $interaction['order_id'] . '</td>
<td colspan="2">'.$interaction['objective_id'] . '</td>
<td colspan="2">' . $interaction['status'] . '</td>
<td>' . $interaction['score_raw'].'</td>
<td>' . $interaction['score_max'] .'</td>
<td>' . $interaction['score_min'].'</td>
<td></td>
</tr>';
$counter++; $counter++;
} }
} }
@ -689,10 +737,10 @@ if (is_array($list) && count($list) > 0) {
$my_orig_lp = $row_attempts['orig_lp_id']; $my_orig_lp = $row_attempts['orig_lp_id'];
$my_orig_lp_item = $row_attempts['orig_lp_item_id']; $my_orig_lp_item = $row_attempts['orig_lp_item_id'];
$my_exo_exe_id = $row_attempts['exe_exo_id']; $my_exo_exe_id = $row_attempts['exe_exo_id'];
$mktime_start_date = api_strtotime($row_attempts['start_date'],'UTC'); $mktime_start_date = api_strtotime($row_attempts['start_date'], 'UTC');
$mktime_exe_date = api_strtotime($row_attempts['exe_date'],'UTC'); $mktime_exe_date = api_strtotime($row_attempts['exe_date'], 'UTC');
if ($mktime_start_date && $mktime_exe_date) { if ($mktime_start_date && $mktime_exe_date) {
$mytime = ((int)$mktime_exe_date-(int)$mktime_start_date); $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date);
$time_attemp = learnpathItem :: get_scorm_time('js', $mytime); $time_attemp = learnpathItem :: get_scorm_time('js', $mytime);
$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
} else { } else {
@ -704,7 +752,7 @@ if (is_array($list) && count($list) > 0) {
// Show only float when need it. // Show only float when need it.
//$my_score = float_format( $my_score, 1); //$my_score = float_format( $my_score, 1);
//$my_maxscore =float_format($my_maxscore, 1); //$my_maxscore =float_format($my_maxscore, 1);
if ($my_score == 0 ) { if ($my_score == 0) {
//$view_score = '0/'.$my_maxscore; //$view_score = '0/'.$my_maxscore;
$view_score = show_score(0, $my_maxscore, false); $view_score = show_score(0, $my_maxscore, false);
} else { } else {
@ -725,22 +773,30 @@ if (is_array($list) && count($list) > 0) {
$my_lesson_status = get_lang($mylanglist['incomplete']); $my_lesson_status = get_lang($mylanglist['incomplete']);
} }
$output .= '<tr class="'.$oddclass.'" ><td>&nbsp;</td><td>'.$extend_attempt_link.'</td><td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>' $output .= '<tr class="' . $oddclass . '" >
. '<td colspan="2">' . Display::label($my_lesson_status, $class_status).'</td><td colspan="2"> <td></td>
<div class="mystatus" align="center">' . $view_score . '</div></td><td colspan="2"><div class="mystatus">' . $time_attemp . '</div></td>'; <td>' . $extend_attempt_link . '</td>
<td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>
<td colspan="2">' . Display::label($my_lesson_status, $class_status) . '</td>
<td colspan="2">
<div class="mystatus" align="center">' . $view_score . '</div>
</td>
<td colspan="2">
<div class="mystatus">' . $time_attemp . '</div>
</td>';
if ($origin != 'tracking') { if ($origin != 'tracking') {
if (!$is_allowed_to_edit && $result_disabled_ext_all) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"></td>'; $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"></td>';
} else { } else {
$output .= '<td><a href="../exercice/exercise_show.php?origin='.$origin.'&id='.$my_exe_id.'&cidReq=' . $course_code . $from_link. '" target="_parent"> $output .= '<td><a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $course_code . $from_link . '" target="_parent">
<img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"></a></td>'; <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"></a></td>';
} }
} else { } else {
if (!$is_allowed_to_edit && $result_disabled_ext_all ) { if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
} else { } else {
$output .= '<td><a href="../exercice/exercise_show.php?cidReq=' . $course_code.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> $output .= '<td><a href="../exercice/exercise_show.php?cidReq=' . $course_code . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
<img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
} }
} }
$output .= '</tr>'; $output .= '</tr>';
@ -804,7 +860,7 @@ if (!$is_allowed_to_edit && $result_disabled_ext_all) {
$final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
} else { } else {
if (is_numeric($total_score)) if (is_numeric($total_score))
$final_score = $total_score.'%'; $final_score = $total_score . '%';
else else
$final_score = $total_score; $final_score = $total_score;
} }
@ -816,21 +872,30 @@ if (($counter % 2) == 0) {
} }
//if (empty($extend_all)) { //if (empty($extend_all)) {
$output .= "<tr class='$oddclass'>\n" . "<td></td>\n" . '<td colspan="4"><div class="mystatus"><i>' . get_lang('AccomplishedStepsTotal') . "</i></div></td>\n" $output .= '<tr class="'.$oddclass.'">
. '<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"; <td></td>
<td colspan="4">
<div class="mystatus"><i>' . get_lang('AccomplishedStepsTotal') .'</i></div>
</td>
<td colspan="2"></td>
<td colspan="2">
<div class="mystatus" align="center">' . $final_score.'</div>
</td>
<td colspan="2"><div class="mystatus">' . $total_time . '</div></td><td></td>
</tr>';
//} //}
$output .= "</table></td></tr></table>"; $output .= "</table>";
if (!empty($export_csv)) { if (!empty($export_csv)) {
$temp = array ( $temp = array(
'', '',
'', '',
'', '',
'' ''
); );
$csv_content[] = $temp; $csv_content[] = $temp;
$temp = array ( $temp = array(
get_lang('AccomplishedStepsTotal'), get_lang('AccomplishedStepsTotal'),
'', '',
$final_score, $final_score,

Loading…
Cancel
Save