MDL-11137 Unable to locate API error - force a sort order on the cmi elements, and ensure correct type comparison when determining whether we have seen this objective id before. affects aicc, 1.2 and 1.3. propagate to 1.9.

This commit is contained in:
piers
2008-07-25 01:48:36 +00:00
parent 9408154669
commit bf3fc937f6
4 changed files with 16 additions and 10 deletions
+5 -4
View File
@@ -141,14 +141,15 @@ function AICCapi() {
}
<?php
$current_objective = '';
$count = 0;
$objectives = '';
foreach($userdata as $element => $value){
if (substr($element,0,14) == 'cmi.objectives') {
preg_match('/.(\d+)./',$element,$matches);
$element = preg_replace('/.(\d+)./',"_\$1.",$element);
if ($matches[1] == $count) {
$count++;
$element = preg_replace('/\.(\d+)\./', "_\$1.", $element);
preg_match('/\_(\d+)\./', $element, $matches);
if (count($matches) > 0 && $current_objective != $matches[1]) {
$current_objective = $matches[1];
$end = strpos($element,$matches[1])+strlen($matches[1]);
$subelement = substr($element,0,$end);
echo ' '.$subelement." = new Object();\n";
+4 -2
View File
@@ -129,13 +129,15 @@ function SCORMapi1_2() {
}
<?php
$current_objective = '';
$count = 0;
$objectives = '';
foreach($userdata as $element => $value){
if (substr($element,0,14) == 'cmi.objectives') {
$element = preg_replace('/\.(\d+)\./', "_\$1.", $element);
preg_match('/_(\d+)\./', $element, $matches);
if (isset($matches[1]) && $matches[1] == $count) {
preg_match('/\_(\d+)\./', $element, $matches);
if (count($matches) > 0 && $current_objective != $matches[1]) {
$current_objective = $matches[1];
$count++;
$end = strpos($element,$matches[1])+strlen($matches[1]);
$subelement = substr($element,0,$end);
+5 -3
View File
@@ -1,6 +1,6 @@
<?php
if (isset($userdata->status)) {
//if ($userdata->status == ''&& (!(($userdata->{'cmi.exit'} == 'suspend') || ($userdata->{'cmi.exit'} == 'logout'))&& !($userdata->{'adl.nav.request'} == 'suspendAll'))||($userdata->{'cmi.exit'} == 'normal')) { //antes solo llegaba esta línea hasta el &&
//if ($userdata->status == ''&& (!(($userdata->{'cmi.exit'} == 'suspend') || ($userdata->{'cmi.exit'} == 'logout'))&& !($userdata->{'adl.nav.request'} == 'suspendAll'))||($userdata->{'cmi.exit'} == 'normal')) { //antes solo llegaba esta l�nea hasta el &&
if (!isset($userdata->{'cmi.exit'}) || (($userdata->{'cmi.exit'} == 'time-out') || ($userdata->{'cmi.exit'} == 'normal'))) {
$userdata->entry = 'ab-initio';
} else {
@@ -206,13 +206,15 @@ function SCORMapi1_3() {
}
<?php
$current_objective = '';
$count = 0;
$objectives = '';
foreach($userdata as $element => $value){
if (substr($element,0,14) == 'cmi.objectives') {
$element = preg_replace('/\.(\d+)\./', "_\$1.", $element);
preg_match('/_(\d+)\./', $element, $matches);
if (isset($matches[1]) && $matches[1] == $count) {
preg_match('/\_(\d+)\./', $element, $matches);
if (count($matches) > 0 && $current_objective != $matches[1]) {
$current_objective = $matches[1];
$count++;
$end = strpos($element,$matches[1])+strlen($matches[1]);
$subelement = substr($element,0,$end);
+2 -1
View File
@@ -296,7 +296,8 @@ function scorm_get_tracks($scoid,$userid,$attempt='') {
if (isset($track->timemodified) && ($track->timemodified > $usertrack->timemodified)) {
$usertrack->timemodified = $track->timemodified;
}
}
}
ksort($usertrack);
return $usertrack;
} else {
return false;