fixed some typos and fixed some datamodel element

This commit is contained in:
bobopinna 2005-05-06 13:29:59 +00:00
parent 5724019cc4
commit d5a62d972f
5 changed files with 35 additions and 23 deletions

View File

@ -5,7 +5,7 @@
optional_variable($id); // Course Module ID, or
optional_variable($a); // scorm ID
//require_variable($scoid); // sco ID
require_variable($scoid); // sco ID
optional_variable($mode); // navigation mode
if ($id) {
@ -34,7 +34,6 @@
}
require_login($course->id, false, $cm);
$scoid = $SESSION->scorm_scoid;
if ($usertrack=scorm_get_tracks($scoid,$USER->id)) {
$userdata = $usertrack;

View File

@ -26,7 +26,7 @@ function SCORMapi1_2() {
CMIDecimal = '^([0-9]{0,3})(\.[0-9]{1,2})?$';
CMIIdentifier = '^\\w{0,255}$';
CMIFeedback = CMIString255; // This must be redefined
CMIIndex = '.\\d+.';
CMIIndex = '.(\\d+).';
// Vocabulary Data Type Definition
CMIStatus = '^passed|completed|failed|incomplete|browsed|not attempted$';
CMIExit = '^time-out|suspend|logout|$';
@ -123,16 +123,6 @@ function SCORMapi1_2() {
}
}
<?php
foreach($userdata as $element => $value) {
if (substr($element,0,14) == 'cmi.objectives') {
?>
<?php
}
}
?>
if (cmi.core.lesson_status == '') {
cmi.core.lesson_status = 'not attempted';
}
@ -174,15 +164,26 @@ function SCORMapi1_2() {
if (Initialized) {
if (element !="") {
expression = new RegExp(CMIIndex,'g');
dataelement = element.replace(expression,'.n.');
if ((typeof eval('datamodel["'+dataelement+'"]')) != "undefined") {
if (eval('datamodel["'+dataelement+'"].mod') != 'w') {
elementmodel = element.replace(expression,'.n.');
if ((typeof eval('datamodel["'+elementmodel+'"]')) != "undefined") {
if (eval('datamodel["'+elementmodel+'"].mod') != 'w') {
element = element.replace(expression, "_$1.");
//alert ('Element: '+element);
errorCode = "0";
return eval(element);
elementIndexes = element.split('.');
subelement = 'cmi';
i = 1;
while ((i < elementIndexes.length) && (typeof eval(subelement) != "undefined")) {
subelement += '.'+elementIndexes[i++];
}
//alert ('Element: '+subelement);
if (subelement == element) {
errorCode = "0";
return eval(element);
} else {
errorCode = "401"; // Need to check if it is the right error code
}
} else {
errorCode = eval('datamodel["'+element+'"].readerror');
errorCode = eval('datamodel["'+elementmodel+'"].readerror');
}
} else {
errorCode = "401"
@ -224,7 +225,7 @@ function SCORMapi1_2() {
//alert('Object: '+subelement+'.'+elementIndex);
}
//alert ('Count:'+eval(subelement+'.'+elementIndex+'._count'));
if (elementIndexes[i+1] == eval(subelement+'.'+elementIndex+'._count')*1.0+1) {
if (elementIndexes[i+1] == eval(subelement+'.'+elementIndex+'._count')) {
//alert('Index:'+elementIndexes[i+1]);
eval(subelement+'.'+elementIndex+'._count++;');
}
@ -236,9 +237,16 @@ function SCORMapi1_2() {
} else {
subelement = subelement.concat('.'+elementIndex);
}
alert('Subelement: '+subelement);
//alert('Subelement: '+subelement);
if ((typeof eval(subelement)) == "undefined") {
eval(subelement+' = new Object();');
if (element.substr(0,14) == 'cmi.objectives') {
eval(subelement+'.score = new Object();');
eval(subelement+'.score._children = "raw,min,max";');
eval(subelement+'.score.raw = "";');
eval(subelement+'.score.min = "";');
eval(subelement+'.score.max = "";');
}
}
}
element = subelement.concat('.'+elementIndexes[elementIndexes.length-1]);

View File

@ -876,6 +876,9 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
$startbold = '';
$endbold = '';
$score = '';
if (empty($scoid) && ($mode != 'normal')) {
$scoid = $sco->id;
}
if ($usertrack=scorm_get_tracks($sco->id,$USER->id)) {
if ( $usertrack->status == '') {
$usertrack->status = 'notattempted';

View File

@ -5,6 +5,7 @@
optional_variable($id); // Course Module ID, or
optional_variable($a); // scorm ID
optional_variable($scoid); // sco ID
optional_variable($mode); // lesson mode
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
@ -32,6 +33,7 @@
}
require_login($course->id, false, $cm);
if (!empty($scoid)) {
//

View File

@ -139,7 +139,7 @@
</div>
</th>
</tr>
<tr><td nowrap>
<tr><td>
<?php
$sco = scorm_display_structure($scorm,'scormlist',$currentorg,$scoid,$mode,true);
if ($mode == 'normal') {
@ -169,7 +169,7 @@
</table>
</td>
<td class="fullscreen" height="90%">
<iframe name="main" class="fullscreen" height="<?php echo $CFG->scorm_frameheight ?>" src="loadSCO.php?id=<?php echo $cm->id.$scoidstring ?>"></iframe>
<iframe name="main" class="fullscreen" height="<?php echo $CFG->scorm_frameheight ?>" src="loadSCO.php?id=<?php echo $cm->id.$scoidstring.$modestring ?>"></iframe>
</td></tr>
</table>
<script language="JavaScript" type="text/javascript" src="request.js"></script>