diff --git a/main/newscorm/lp_stats.php b/main/newscorm/lp_stats.php
index c0a3388ef4..6e2f0a6ab5 100644
--- a/main/newscorm/lp_stats.php
+++ b/main/newscorm/lp_stats.php
@@ -217,6 +217,20 @@ foreach ($list as $my_item_id) {
$time_for_total = 'NaN';
if (($extend_this || $extend_all) && $num > 0) {
$row = Database :: fetch_array($result);
+ $result_disabled_ext_all = false;
+ if($row['item_type'] == 'quiz') {
+ //check results_disabled in quiz table
+ $my_path = Database::escape_string($row['path']);
+
+ $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
+ $res_result_disabled = api_sql_query($sql,__FILE__,__LINE__);
+ $row_result_disabled = Database::fetch_row($res_result_disabled);
+
+ if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) {
+ $result_disabled_ext_all = true;
+ }
+ }
+
//echo '
'; print_r($row); echo '
';
//if there are several attempts, and the link to extend has been clicked, show each attempt...
if (($counter % 2) == 0) {
@@ -306,9 +320,14 @@ foreach ($list as $my_item_id) {
$my_lesson_status = htmlentities(get_lang($mylanglist[$lesson_status]), ENT_QUOTES, $dokeos_charset);
if ($row['item_type'] != 'dokeos_chapter') {
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $view_score = '-';
+ } else {
+ $view_score = ($score == 0 ? '-' : ($maxscore === 0 ? $score : $score . '/' . $maxscore));
+ }
$output .= "\n" . " | \n" . "$extend_attempt_link | \n" . '' . htmlentities(get_lang('Attempt'), ENT_QUOTES, $dokeos_charset) . ' ' . $row['iv_view_count'] . " | \n"
//."".htmlentities($array_status[$lesson_status],ENT_QUOTES,$lp_charset)." | \n"
- . '' . $my_lesson_status . " | \n" . '' . ($score == 0 ? '-' : ($maxscore === 0 ? $score : $score . '/' . $maxscore)) . " | \n" . ''.$time.' | |
';
+ . '' . $my_lesson_status . " | \n" . '' . $view_score . " | \n" . ''.$time.' | | ';
}
$counter++;
@@ -347,7 +366,23 @@ foreach ($list as $my_item_id) {
$my_id = $row['myid'];
$my_lp_id = $row['mylpid'];
$my_lp_view_id = $row['mylpviewid'];
+ $my_path = $row['path'];
+ $result_disabled_ext_all = false;
+
+ if($row['item_type'] == 'quiz') {
+ //check results_disabled in quiz table
+ $my_path = Database::escape_string($my_path);
+
+ $sql = "SELECT results_disabled FROM $TBL_QUIZ WHERE id ='".(int)$my_path."'";
+ $res_result_disabled = api_sql_query($sql,__FILE__,__LINE__);
+ $row_result_disabled = Database::fetch_row($res_result_disabled);
+
+ if (Database::num_rows($res_result_disabled) > 0 && (int)$row_result_disabled[0]===1) {
+ $result_disabled_ext_all = true;
+ }
+ }
+
//check if there are interactions below
$extend_attempt_link = '';
$extend_this_attempt = 0;
@@ -387,8 +422,8 @@ foreach ($list as $my_item_id) {
$subtotal_time += $tmp_row['mytime'];
}
//}
- $time_for_total = $subtotal_time;
- $time = learnpathItem :: get_scorm_time('js', $subtotal_time);
+ //$time_for_total = $subtotal_time;
+ //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
$scoIdentifier = $row['myid'];
$title = $row['mytitle'];
$title = stripslashes(html_entity_decode($title, ENT_QUOTES, $dokeos_charset));
@@ -441,8 +476,9 @@ foreach ($list as $my_item_id) {
} else {
$score = 0;
$subtotal_time = 0;
- }
- $time = learnpathItem :: get_scorm_time('js', $subtotal_time);
+ }
+
+ //$time = learnpathItem :: get_scorm_time('js', $subtotal_time);
// selecting the max score from an attempt
$sql = "SELECT SUM(t.ponderation) as maxscore from ( 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) where exe_id ='$id_last_attempt' ) as t";
@@ -457,6 +493,8 @@ foreach ($list as $my_item_id) {
}
}
}
+ $time_for_total = $subtotal_time;
+ $time = learnpathItem :: get_scorm_time('js', $subtotal_time);
if (empty ($title)) {
$title = rl_get_resource_name(api_get_course_id(), $lp_id, $row['myid']);
}
@@ -521,7 +559,13 @@ foreach ($list as $my_item_id) {
$output .= "$extend_link | \n" . '' . htmlentities($title, ENT_QUOTES, $lp_charset) . ' | ' . "\n";
$output .= '' . $my_lesson_status . " | \n" . '';
if ($row['item_type'] == 'quiz') {
- $output .= ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . $maxscore));//$maxscore == 0 ? $score : $score . '/' . $maxscore;
+
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $output .= '-';
+ } else {
+ $output .= ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
+ }
+
} else {
$output .= ($score == 0 ? '-' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
}
@@ -534,7 +578,13 @@ foreach ($list as $my_item_id) {
$temp[] = $title;
$temp[] = html_entity_decode($my_lesson_status);
if ($row['item_type'] == 'quiz') {
- $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
+
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $temp[] = '-';
+ } else {
+ $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
+ }
+
} else {
$temp[] = ($score == 0 ? '-' : ($maxscore == 0 ? $score : $score . '/' . $maxscore));
}
@@ -593,13 +643,28 @@ foreach ($list as $my_item_id) {
$mytime = ((int)$mktime_exe_date-(int)$mktime_start_date);
$time_attemp = learnpathItem :: get_scorm_time('js', $mytime);
$time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
+
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $view_score = '-';
+ } else {
+ $view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore));
+ }
$output .= ' | | '.$extend_attempt_link.' | ' . htmlentities(get_lang('Attempt'), ENT_QUOTES, $dokeos_charset) . ' ' . $n . ' | '
- . '' . $my_lesson_status . ' | ' . ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore)) . ' | ' . $time_attemp . ' | ';
+ . '' . $my_lesson_status . ' | ' . $view_score . ' | ' . $time_attemp . ' | ';
if ($origin != 'tracking') {
- $output .= ' . 'quiz.gif) | ';
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $output .= ' . 'quiz_na.gif) | ';
+ } else {
+ $output .= ' . 'quiz.gif) | ';
+ }
+
} else {
- $output .= ' . 'quiz.gif) | ';
+ if (!api_is_allowed_to_edit() && $result_disabled_ext_all) {
+ $output .= ' . 'quiz_na.gif) | ';
+ } else {
+ $output .= ' . 'quiz.gif) | ';
+ }
}
$output .= ' ';
$n++;
|