Permalink
Browse files

SCORM MDL-24734 - fix display of grade information on view.php page -…

… also fixes some XHTML in the same function.
  • Loading branch information...
1 parent 91787c3 commit 4f4a8acf3bcd49190945c4fbc87f4d3411c1e181 @danmarsden danmarsden committed Apr 16, 2011
Showing with 14 additions and 6 deletions.
  1. +14 −6 mod/scorm/locallib.php
View
@@ -1009,11 +1009,11 @@ function scorm_get_attempt_status($user, $scorm) {
$result = '<p>'.get_string('noattemptsallowed', 'scorm').': ';
if ($scorm->maxattempt > 0) {
- $result .= $scorm->maxattempt . '<BR>';
+ $result .= $scorm->maxattempt . '<br />';
} else {
- $result .= get_string('unlimited').'<BR>';
+ $result .= get_string('unlimited').'<br />';
}
- $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<BR>';
+ $result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<br />';
if ($scorm->maxattempt == 1) {
switch ($scorm->grademethod) {
@@ -1051,16 +1051,24 @@ function scorm_get_attempt_status($user, $scorm) {
$i = 1;
foreach($attempts as $attempt) {
$gradereported = scorm_grade_user_attempt($scorm, $user->id, $attempt->attemptnumber);
- $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'%<BR>';
+ if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
+ $gradereported = $gradereported/$scorm->maxgrade;
+ $gradereported = number_format($gradereported*100, 0) .'%';
+ }
+ $result .= get_string('gradeforattempt', 'scorm').' ' . $i . ': ' . $gradereported .'<br />';
$i++;
}
}
$calculatedgrade = scorm_grade_user($scorm, $user->id);
+ if ($scorm->grademethod !== GRADESCOES && !empty($scorm->maxgrade)) {
+ $calculatedgrade = $calculatedgrade/$scorm->maxgrade;
+ $calculatedgrade = number_format($calculatedgrade*100, 0) .'%';
+ }
$result .= get_string('grademethod', 'scorm'). ': ' . $grademethod;
if(empty($attempts)) {
- $result .= '<BR>' . get_string('gradereported','scorm') . ': ' . get_string('none') . '<BR>';
+ $result .= '<br />' . get_string('gradereported','scorm') . ': ' . get_string('none') . '<br />';
} else {
- $result .= '<BR>' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . ($scorm->grademethod == GRADESCOES ? '' : '%') .'<BR>';
+ $result .= '<br />' . get_string('gradereported','scorm') . ': ' . $calculatedgrade . '<br />';
}
$result .= '</p>';
if ($attemptcount >= $scorm->maxattempt and $scorm->maxattempt > 0) {

0 comments on commit 4f4a8ac

Please sign in to comment.