Skip to content
Browse files

MDL-33702 scorm: Adding suppport for '2004 SCORM standard' score elem…

…ents
  • Loading branch information...
1 parent 2cbdaa7 commit 1c2b2132e5f6e8d3d4a972da628e5ee08cd88dd2 @ankitagarwal ankitagarwal committed Jun 28, 2012
Showing with 22 additions and 33 deletions.
  1. +11 −3 mod/scorm/locallib.php
  2. +5 −15 mod/scorm/report/graphs/graph.php
  3. +6 −15 mod/scorm/userreport.php
View
14 mod/scorm/locallib.php
@@ -467,15 +467,23 @@ function scorm_get_tracks($scoid, $userid, $attempt='') {
case 'cmi.core.score.raw':
case 'cmi.score.raw':
$usertrack->score_raw = (float) sprintf('%2.2f', $track->value);
- break;
+ break;
+ case 'cmi.core.score.max':
+ case 'cmi.score.max':
+ $usertrack->score_max = (float) sprintf('%2.2f', $track->value);
+ break;
+ case 'cmi.core.score.min':
+ case 'cmi.score.min':
+ $usertrack->score_min = (float) sprintf('%2.2f', $track->value);
+ break;
case 'cmi.core.session_time':
case 'cmi.session_time':
$usertrack->session_time = $track->value;
- break;
+ break;
case 'cmi.core.total_time':
case 'cmi.total_time':
$usertrack->total_time = $track->value;
- break;
+ break;
}
if (isset($track->timemodified) && ($track->timemodified > $usertrack->timemodified)) {
$usertrack->timemodified = $track->timemodified;
View
20 mod/scorm/report/graphs/graph.php
@@ -66,16 +66,6 @@
list($usql, $params) = $DB->get_in_or_equal($allowedlist);
$params[] = $scoid;
-// Determine Sco keys to be used
-if (scorm_version_check($scorm->version, SCORM_13)) {
- $maxkey = 'cmi.score.max';
- $minkey = 'cmi.score.min';
- $scorekey = 'cmi.score.raw';
-} else {
- $maxkey = 'cmi.core.score.max';
- $minkey = 'cmi.core.score.min';
- $scorekey = 'cmi.core.score.raw';
-}
$bands = 11;
$bandwidth = 10;
@@ -99,16 +89,16 @@
foreach ($attempts as $attempt) {
if ($trackdata = scorm_get_tracks($scoid, $attempt->userid, $attempt->attempt)) {
if (isset($trackdata->$scorekey)) {
- $score = $trackdata->$scorekey;
- if (!isset($trackdata->$minkey) || empty($trackdata->$minkey)) {
+ $score = $trackdata->score_raw;
+ if (empty($trackdata->score_min)) {
$minmark = 0;
} else {
- $minmark = $trackdata->$minkey;
+ $minmark = $trackdata->score_min;
}
- if (!isset($trackdata->$maxkey) || empty($trackdata->$maxkey)) {
+ if (empty($trackdata->score_max)) {
$maxmark = 100;
} else {
- $maxmark = $trackdata->$maxkey;
+ $maxmark = $trackdata->score_max;
}
$range = ($maxmark - $minmark);
if (empty($range)) {
View
21 mod/scorm/userreport.php
@@ -180,21 +180,12 @@
$table->width = '100%';
$table->size = array('*', '*');
$existelements = false;
- if (scorm_version_check($scorm->version, SCORM_13)) {
- $elements = array(
- 'raw' => 'cmi.score.raw',
- 'min' => 'cmi.score.min',
- 'max' => 'cmi.score.max',
- 'status' => 'cmi.completion_status',
- 'time' => 'cmi.total_time');
- } else {
- $elements = array(
- 'raw' => 'cmi.core.score.raw',
- 'min' => 'cmi.core.score.min',
- 'max' => 'cmi.core.score.max',
- 'status' => 'cmi.core.lesson_status',
- 'time' => 'cmi.core.total_time');
- }
+ $elements = array(
+ 'min' => 'score_min',
+ 'raw' => 'score_raw',
+ 'max' => 'score_max',
+ 'status' => 'status',
+ 'time' => 'total_time');
$printedelements = array();
foreach ($elements as $key => $element) {
if (isset($trackdata->$element)) {

0 comments on commit 1c2b213

Please sign in to comment.
Something went wrong with that request. Please try again.