Browse files

Added debug messages

  • Loading branch information...
1 parent b744c0c commit a91433f9ec7e2779d9975bbff4133221398f1ffc bobopinna committed Apr 12, 2006
Showing with 43 additions and 3 deletions.
  1. +13 −3 mod/scorm/datamodels/scorm1_2.js.php
  2. +30 −0 mod/scorm/datamodels/scorm1_3.js.php
View
16 mod/scorm/datamodels/scorm1_2.js.php
@@ -54,7 +54,7 @@ function SCORMapi1_2() {
'cmi._version':{'defaultvalue':'3.4', 'mod':'r', 'writeerror':'402'},
'cmi.core._children':{'defaultvalue':core_children, 'mod':'r', 'writeerror':'402'},
'cmi.core.student_id':{'defaultvalue':'<?php echo $userdata->student_id ?>', 'mod':'r', 'writeerror':'403'},
- 'cmi.core.student_name':{'defaultvalue':'<?php echo $userdata->student_name ?>', 'mod':'r', 'writeerror':'403'},
+ 'cmi.core.student_name':{'defaultvalue':'<?php echo addslashes($userdata->student_name) ?>', 'mod':'r', 'writeerror':'403'},
'cmi.core.lesson_location':{'defaultvalue':'<?php echo isset($userdata->{'cmi.core.lesson_location'})?$userdata->{'cmi.core.lesson_location'}:'' ?>', 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
'cmi.core.credit':{'defaultvalue':'<?php echo $userdata->credit ?>', 'mod':'r', 'writeerror':'403'},
'cmi.core.lesson_status':{'defaultvalue':'<?php echo isset($userdata->{'cmi.core.lesson_status'})?$userdata->{'cmi.core.lesson_status'}:'' ?>', 'format':CMIStatus, 'mod':'rw', 'writeerror':'405'},
@@ -168,7 +168,7 @@ function LMSInitialize (param) {
if (!Initialized) {
<?php
if (($CFG->debug > 7) && (isadmin())) {
- echo 'alert("Initialized");';
+ echo 'alert("Initialized SCORM 1.2");';
}
?>
Initialized = true;
@@ -189,7 +189,7 @@ function LMSFinish (param) {
if (Initialized) {
<?php
if (($CFG->debug > 7) && (isadmin())) {
- echo 'alert("Finished");';
+ echo 'alert("Finished SCORM 1.2");';
}
?>
Initialized = false;
@@ -336,6 +336,11 @@ function LMSSetValue (element,value) {
if ((value >= ranges[0]) && (value <= ranges[1])) {
eval(element+'="'+value+'";');
errorCode = "0";
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert(element+":= "+value);';
+ }
+ ?>
return "true";
} else {
errorCode = eval('datamodel["'+elementmodel+'"].writeerror');
@@ -378,6 +383,11 @@ function LMSCommit (param) {
if (param == "") {
if (Initialized) {
result = StoreData(cmi,false);
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert("Data Commited");';
+ }
+ ?>
return "true";
} else {
errorCode = "301";
View
30 mod/scorm/datamodels/scorm1_3.js.php
@@ -185,6 +185,11 @@ function Initialize (param) {
errorCode = "0";
if (param == "") {
if ((!Initialized) && (!Terminated)) {
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert("Initialized SCORM 1.3");';
+ }
+ ?>
Initialized = true;
errorCode = "0";
return "true";
@@ -205,6 +210,11 @@ function Terminate (param) {
errorCode = "0";
if (param == "") {
if ((Initialized) && (!Terminated)) {
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert("Terminated SCORM 1.3");';
+ }
+ ?>
Initialized = false;
Terminated = true;
result = StoreData(cmi,true);
@@ -251,6 +261,11 @@ function GetValue (element) {
}
if (subelement == element) {
errorCode = "0";
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert(element+": "+eval(element));';
+ }
+ ?>
return eval(element);
} else {
errorCode = "0"; // Need to check if it is the right errorCode
@@ -361,6 +376,11 @@ function SetValue (element,value) {
if ((ranges[1] == '*') || (value <= ranges[1])) {
eval(element+'="'+value+'";');
errorCode = "0";
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert(element+":= "+value);';
+ }
+ ?>
return "true";
} else {
errorCode = '407';
@@ -371,6 +391,11 @@ function SetValue (element,value) {
} else {
eval(element+'="'+value+'";');
errorCode = "0";
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert(element+":= "+value);';
+ }
+ ?>
return "true";
}
}
@@ -403,6 +428,11 @@ function Commit (param) {
if (param == "") {
if ((Initialized) && (!Terminated)) {
result = StoreData(cmi,false);
+ <?php
+ if (($CFG->debug > 7) && (isadmin())) {
+ echo 'alert("Data Commited");';
+ }
+ ?>
return "true";
} else {
if (Terminated) {

0 comments on commit a91433f

Please sign in to comment.