Skip to content

Commit 92209d8

Browse files
committed
Minor fixing document results. Replacing 0/100 with "/" see #5286
1 parent ecf7e9c commit 92209d8

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

main/exercice/exercise.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
11661166
* @param float score
11671167
* @param float weight
11681168
* @param bool show porcentage or not
1169-
* @param bool use or not the platform settings
1169+
* @param bool use or not the platform settings
11701170
* @return string an html with the score modified
11711171
*/
11721172
function show_score($score, $weight, $show_percentage = true, $use_platform_settings = true, $show_success_message = false, $pass_percentage = null) {

main/newscorm/lp_controller.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -831,11 +831,7 @@ function setFocus(){
831831
if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
832832
else {
833833
$_SESSION['oLP']->save_current();
834-
$_SESSION['oLP']->save_last();
835-
// Declare variables to be used in lp_stats.php.
836-
$lp_id = $_SESSION['oLP']->get_id();
837-
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
838-
$user_id = api_get_user_id();
834+
$_SESSION['oLP']->save_last();
839835
require 'lp_stats.php';
840836
}
841837
break;
@@ -926,11 +922,7 @@ function setFocus(){
926922
if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
927923
else {
928924
$_SESSION['oLP']->save_current();
929-
$_SESSION['oLP']->save_last();
930-
// Declare variables to be used in lp_stats.php.
931-
$lp_id = $_SESSION['oLP']->get_id();
932-
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
933-
$user_id = api_get_user_id();
925+
$_SESSION['oLP']->save_last();
934926
header('location: '.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/?id_session='.api_get_session_id());
935927
}
936928
break;

main/newscorm/lp_stats.php

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
require_once '../exercice/exercise.lib.php';
1717

1818
$course_code = api_get_course_id();
19+
$user_id = api_get_user_id();
20+
// Declare variables to be used in lp_stats.php.
21+
$lp_id = $_SESSION['oLP']->get_id();
22+
$list = $_SESSION['oLP']->get_flat_ordered_items_list($lp_id);
1923

2024
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
2125

@@ -292,23 +296,35 @@
292296

293297
$my_lesson_status = get_lang($mylanglist[$lesson_status]);
294298

295-
if ($row['item_type'] != 'dokeos_chapter') {
299+
if ($row['item_type'] != 'dokeos_chapter') {
296300
if (!$is_allowed_to_edit && $result_disabled_ext_all) {
297301
$view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
298-
} else {
299-
//$view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1)));
300-
if ($row['item_type'] == 'sco') {
301-
if ($maxscore == 0 ) {
302-
$view_score = $score;
303-
} else {
302+
} else {
303+
switch ($row['item_type']) {
304+
case 'sco':
305+
if ($maxscore == 0 ) {
306+
$view_score = $score;
307+
} else {
308+
$view_score = show_score($score, $maxscore, false);
309+
}
310+
break;
311+
case 'document':
312+
$view_score = ($score == 0 ? '/' : show_score($score, $maxscore, false));
313+
break;
314+
default:
304315
$view_score = show_score($score, $maxscore, false);
305-
}
306-
} else {
307-
$view_score = show_score($score, $maxscore, false);
308-
}
316+
break;
317+
}
309318
}
310-
$output .= "<tr class='$oddclass'>" . "<td></td>" . "<td>$extend_attempt_link</td>" . '<td colspan="3">' . get_lang('Attempt') . ' ' . $row['iv_view_count'] . "</td>"
311-
. '<td colspan="2">' . Display::label($my_lesson_status, $class_status) . "</td>\n" . '<td colspan="2"><div class="mystatus" align="center">' . $view_score . "</div></td>" . '<td colspan="2"><div class="mystatus">'.$time.'</div></td><td></td></tr>';
319+
$output .= '<tr class="'.$oddclass.'">
320+
<td></td>
321+
<td>'.$extend_attempt_link.'</td>
322+
<td colspan="3">'.get_lang('Attempt').' '.$row['iv_view_count'].'</td>
323+
<td colspan="2">'.Display::label($my_lesson_status, $class_status).'</td>
324+
<td colspan="2"><div class="mystatus" align="center">'.$view_score.'</div></td>
325+
<td colspan="2"><div class="mystatus">'.$time.'</div></td>
326+
<td></td>
327+
</tr>';
312328

313329
if (!empty($export_csv)) {
314330
$temp = array ();

0 commit comments

Comments
 (0)