MDL-13431 - SCORM results not transferring to Gradebook. SCORM API debugging tool.
This commit is contained in:
@@ -161,4 +161,6 @@ $string['updatefreq'] = 'Auto-update frequency';
|
||||
$string['options'] = 'Options';
|
||||
$string['activityloading'] = "You will be automatically redirected to the activity in"; // used in conjunction with numseconds
|
||||
$string['activitypleasewait'] = "Activity loading, please wait ....";
|
||||
$string['scormloggingon'] = "API Logging is On";
|
||||
$string['scormloggingoff'] = "API Logging is Off";
|
||||
?>
|
||||
@@ -74,6 +74,7 @@ function AICCapi() {
|
||||
'cmi.suspend_data':{'defaultvalue':'<?php echo isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||
'cmi.launch_data':{'defaultvalue':'<?php echo isset($userdata->datafromlms)?$userdata->datafromlms:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||
'cmi.comments':{'defaultvalue':'<?php echo isset($userdata->{'cmi.comments'})?$userdata->{'cmi.comments'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||
// deprecated evaluation attributes
|
||||
'cmi.evaluation.comments._count':{'defaultvalue':'0', 'mod':'r', 'writeerror':'402'},
|
||||
'cmi.evaluation.comments._children':{'defaultvalue':comments_children, 'mod':'r', 'writeerror':'402'},
|
||||
'cmi.evaluation.comments.n.content':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
|
||||
@@ -130,6 +131,7 @@ function AICCapi() {
|
||||
cmi.student_data = new Object();
|
||||
cmi.student_preference = new Object();
|
||||
cmi.interactions = new Object();
|
||||
// deprecated evaluation attributes
|
||||
cmi.evaluation = new Object();
|
||||
cmi.evaluation.comments = new Object();
|
||||
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
// hopefully fool ie IE proof way of getting DOM element
|
||||
function safeGetElement(doc, el) {
|
||||
return doc.ids ? doc.ids[el] : doc.getElementById ? doc.getElementById(el) : doc.all[el];
|
||||
}
|
||||
|
||||
// Add in a JS controlled link for toggling the Debug logging
|
||||
var logButton = document.createElement('a');
|
||||
logButton.id = 'mod-scorm-log-toggle';
|
||||
logButton.name = 'logToggle';
|
||||
logButton.href = 'javascript:toggleLog();';
|
||||
if (getLoggingActive() == "A") {
|
||||
logButton.innerHTML = '<?php print_string('scormloggingon','scorm') ?>';
|
||||
} else {
|
||||
logButton.innerHTML = '<?php print_string('scormloggingoff','scorm') ?>';
|
||||
}
|
||||
var content = safeGetElement(document, 'content');
|
||||
content.appendChild(logButton);
|
||||
|
||||
// retrieve cookie data
|
||||
function getCookie (cookie_name){
|
||||
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
|
||||
if ( results ) {
|
||||
return (unescape(results[2]));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve the logging flag from a Cookie
|
||||
function getLoggingActive () {
|
||||
var loggingActive = getCookie('SCORMLoggingActive');
|
||||
if (!loggingActive) {
|
||||
loggingActive = 'A';
|
||||
}
|
||||
return loggingActive;
|
||||
}
|
||||
|
||||
// set the logging flag in a cookie
|
||||
function setLoggingActive (flag) {
|
||||
new cookie("SCORMLoggingActive", flag, 365, "/").set();
|
||||
}
|
||||
|
||||
// toggle the logging
|
||||
function toggleLog () {
|
||||
if (getLoggingActive() == "A") {
|
||||
AppendToLog("Moodle Logging Deactivated", 0);
|
||||
setLoggingActive('N');
|
||||
logButton.innerHTML = '<?php print_string('scormloggingoff','scorm') ?>';
|
||||
} else {
|
||||
setLoggingActive('A');
|
||||
AppendToLog("Moodle Logging Activated", 0);
|
||||
logButton.innerHTML = '<?php print_string('scormloggingon','scorm') ?>';
|
||||
logPopUpWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// globals for the log accumulation
|
||||
var logString = "";
|
||||
var logRow = 0;
|
||||
var logPopUpWindow = "N";
|
||||
|
||||
// add each entry to the log, or setup the log pane first time round
|
||||
function UpdateLog(s) {
|
||||
var s1 = '<html><head><style>\n'
|
||||
+ 'body {font-family: Arial, Helvetica, Sans-Serif;font-size: xx-small;'
|
||||
+ 'margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; '
|
||||
+ 'background-color: ffffff;}\n'
|
||||
+ '.even {background-color: ffffff; width: 100%;}\n'
|
||||
+ '.odd {background-color: e8f2fe; width: 100%;}\n'
|
||||
+ '.error {background-color: ffffff; color: red; width: 100%;}\n'
|
||||
+ '<\/style><\/head><body STYLE="background-color: ffffff; color: black"'
|
||||
+ 'marginwidth="0" leftmargin="0" hspace="0">'
|
||||
+ '<input type="hidden" id="mod-scorm-logstate" name="mod-scorm-logstate" value="A" \/>'
|
||||
+ '<h3 id="mod-scorm-marker">SCORM API Activity Log<\/h3>';
|
||||
|
||||
// Is logging active?
|
||||
if (getLoggingActive() != "A") {
|
||||
return;
|
||||
}
|
||||
|
||||
var popupdoc = '';
|
||||
logString += s;
|
||||
if (logPopUpWindow != 'N' && !logPopUpWindow.closed) {
|
||||
popupdoc = logPopUpWindow.document;
|
||||
popupdoc.body.innerHTML += s;
|
||||
} else {
|
||||
logPopUpWindow = open( '', 'logpopupwindow', '' );
|
||||
popupdoc = logPopUpWindow.document;
|
||||
// Is logging active?
|
||||
var marker = safeGetElement(popupdoc, 'mod-scorm-marker');
|
||||
if (marker) {
|
||||
popupdoc.body.innerHTML += s;
|
||||
} else {
|
||||
popupdoc.open();
|
||||
popupdoc.write(s1);
|
||||
popupdoc.write(logString);
|
||||
popupdoc.write('<\/body><\/html>')
|
||||
popupdoc.close();
|
||||
popupdoc.title = 'SCORM API Activity Log';
|
||||
logPopUpWindow.focus();
|
||||
}
|
||||
}
|
||||
if (popupdoc.body.childNodes.length > 0) {
|
||||
popupdoc.body.lastChild.scrollIntoView();
|
||||
};
|
||||
}
|
||||
|
||||
//add an individual log entry
|
||||
function AppendToLog(s, rc) {
|
||||
var sStyle;
|
||||
if (rc != 0) {
|
||||
sStyle = 'class="error';
|
||||
} else if (logRow % 2 != 0) {
|
||||
sStyle = 'class="even';
|
||||
} else {
|
||||
sStyle = 'class="odd';
|
||||
}
|
||||
sStyle += '"';
|
||||
var now = new Date();
|
||||
now.setTime( now.getTime() );
|
||||
s = '<div ' + sStyle + '>' + now.toGMTString() + ': ' + s + '<\/div>';
|
||||
UpdateLog(s);
|
||||
// switch colours for a new section of work
|
||||
if (s.match(/Commit|Loaded|Initialize|Terminate|Finish|Moodle SCORM|Moodle Logging/)) {
|
||||
logRow++;
|
||||
}
|
||||
}
|
||||
|
||||
// format a log entry
|
||||
function LogAPICall(func, nam, val, rc) {
|
||||
// drop call to GetLastError for the time being - it produces too much chatter
|
||||
if (func.match(/GetLastError/)) {
|
||||
return;
|
||||
}
|
||||
var s = func + '("' + nam + '"';
|
||||
if (val != null && ! (func.match(/GetValue|GetLastError/))) {
|
||||
s += ', "' + val + '"';
|
||||
}
|
||||
s += ')';
|
||||
if (func.match(/GetValue/)) {
|
||||
s += ' - ' + val;
|
||||
}
|
||||
s += ' => ' + String(rc);
|
||||
AppendToLog(s, rc);
|
||||
}
|
||||
@@ -37,6 +37,7 @@ function SCORMapi1_2() {
|
||||
cmi_children = 'core, suspend_data, launch_data, comments, objectives, student_data, student_preference, interactions';
|
||||
core_children = 'student_id, student_name, lesson_location, credit, lesson_status, entry, score, total_time, lesson_mode, exit, session_time';
|
||||
score_children = 'raw, min, max';
|
||||
comments_children = 'content, location, time';
|
||||
objectives_children = 'id, score, status';
|
||||
student_data_children = 'mastery_score, max_time_allowed, time_limit_action';
|
||||
student_preference_children = 'audio, language, speed, text';
|
||||
@@ -69,6 +70,12 @@ function SCORMapi1_2() {
|
||||
'cmi.suspend_data':{'defaultvalue':'<?php echo isset($userdata->{'cmi.suspend_data'})?$userdata->{'cmi.suspend_data'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||
'cmi.launch_data':{'defaultvalue':'<?php echo isset($userdata->datafromlms)?$userdata->datafromlms:'' ?>', 'mod':'r', 'writeerror':'403'},
|
||||
'cmi.comments':{'defaultvalue':'<?php echo isset($userdata->{'cmi.comments'})?$userdata->{'cmi.comments'}:'' ?>', 'format':CMIString4096, 'mod':'rw', 'writeerror':'405'},
|
||||
// deprecated evaluation attributes
|
||||
'cmi.evaluation.comments._count':{'defaultvalue':'0', 'mod':'r', 'writeerror':'402'},
|
||||
'cmi.evaluation.comments._children':{'defaultvalue':comments_children, 'mod':'r', 'writeerror':'402'},
|
||||
'cmi.evaluation.comments.n.content':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
|
||||
'cmi.evaluation.comments.n.location':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMIString256, 'mod':'rw', 'writeerror':'405'},
|
||||
'cmi.evaluation.comments.n.time':{'defaultvalue':'', 'pattern':CMIIndex, 'format':CMITime, 'mod':'rw', 'writeerror':'405'},
|
||||
'cmi.comments_from_lms':{'mod':'r', 'writeerror':'403'},
|
||||
'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r', 'writeerror':'402'},
|
||||
'cmi.objectives._count':{'mod':'r', 'defaultvalue':'0', 'writeerror':'402'},
|
||||
@@ -112,6 +119,9 @@ function SCORMapi1_2() {
|
||||
cmi.student_data = new Object();
|
||||
cmi.student_preference = new Object();
|
||||
cmi.interactions = new Object();
|
||||
// deprecated evaluation attributes
|
||||
cmi.evaluation = new Object();
|
||||
cmi.evaluation.comments = new Object();
|
||||
|
||||
// Navigation Object
|
||||
var nav = new Object();
|
||||
@@ -167,13 +177,14 @@ function SCORMapi1_2() {
|
||||
errorCode = "0";
|
||||
if (param == "") {
|
||||
if (!Initialized) {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Initialized SCORM 1.2");';
|
||||
}
|
||||
?>
|
||||
Initialized = true;
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
//echo 'alert("Initialized SCORM 1.2");';
|
||||
echo 'LogAPICall("LMSInitialize", param, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
} else {
|
||||
errorCode = "101";
|
||||
@@ -181,6 +192,11 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
errorCode = "201";
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSInitialize", param, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
}
|
||||
|
||||
@@ -188,11 +204,6 @@ function SCORMapi1_2() {
|
||||
errorCode = "0";
|
||||
if (param == "") {
|
||||
if (Initialized) {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Finished SCORM 1.2");';
|
||||
}
|
||||
?>
|
||||
Initialized = false;
|
||||
result = StoreData(cmi,true);
|
||||
if (nav.event != '') {
|
||||
@@ -206,6 +217,12 @@ function SCORMapi1_2() {
|
||||
setTimeout('top.document.location=top.next;',500);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
//echo 'alert("Finished SCORM 1.2");';
|
||||
echo 'LogAPICall("LMSFinish", param, "", 0);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
} else {
|
||||
errorCode = "301";
|
||||
@@ -213,6 +230,11 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
errorCode = "201";
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSFinish", param, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
}
|
||||
|
||||
@@ -235,7 +257,8 @@ function SCORMapi1_2() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+": "+eval(element));';
|
||||
//echo 'alert(element+": "+eval(element));';
|
||||
echo 'LogAPICall("LMSGetValue", element, eval(element), 0);';
|
||||
}
|
||||
?>
|
||||
return eval(element);
|
||||
@@ -272,6 +295,11 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
errorCode = "301";
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSGetValue", element, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -339,7 +367,8 @@ function SCORMapi1_2() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+":= "+value);';
|
||||
echo 'LogAPICall("LMSSetValue", element, value, errorCode);';
|
||||
//echo 'alert(element+":= "+value);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -355,7 +384,8 @@ function SCORMapi1_2() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert(element+":= "+value);';
|
||||
echo 'LogAPICall("LMSSetValue", element, value, errorCode);';
|
||||
//echo 'alert(element+":= "+value);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -376,6 +406,11 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
errorCode = "301";
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSSetValue", element, value, errorCode);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
}
|
||||
|
||||
@@ -386,7 +421,8 @@ function SCORMapi1_2() {
|
||||
result = StoreData(cmi,false);
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Data Commited");';
|
||||
echo 'LogAPICall("Commit", param, "", 0);';
|
||||
//echo 'alert("Data Commited");';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -396,10 +432,20 @@ function SCORMapi1_2() {
|
||||
} else {
|
||||
errorCode = "201";
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSCommit", param, "", 0);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
}
|
||||
|
||||
function LMSGetLastError () {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSGetLastError", "", "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
@@ -417,8 +463,18 @@ function SCORMapi1_2() {
|
||||
errorString["403"] = "Element is read only";
|
||||
errorString["404"] = "Element is write only";
|
||||
errorString["405"] = "Incorrect data type";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSGetErrorString", param, errorString[param], 0);';
|
||||
}
|
||||
?>
|
||||
return errorString[param];
|
||||
} else {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSGetErrorString", param, "No error string found!", 0);';
|
||||
}
|
||||
?>
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -427,6 +483,11 @@ function SCORMapi1_2() {
|
||||
if (param == "") {
|
||||
param = errorCode;
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("LMSGetDiagnostic", param, param, 0);';
|
||||
}
|
||||
?>
|
||||
return param;
|
||||
}
|
||||
|
||||
@@ -560,3 +621,12 @@ function SCORMapi1_2() {
|
||||
}
|
||||
|
||||
var API = new SCORMapi1_2();
|
||||
|
||||
<?php
|
||||
// pull in the debugging utilities
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
|
||||
echo 'AppendToLog("Moodle SCORM 1.2 API Loaded", 0);';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -243,13 +243,14 @@ function SCORMapi1_3() {
|
||||
errorCode = "0";
|
||||
if (param == "") {
|
||||
if ((!Initialized) && (!Terminated)) {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Initialized SCORM 1.3");';
|
||||
}
|
||||
?>
|
||||
Initialized = true;
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
// echo 'alert("Initialized SCORM 1.3");';
|
||||
echo 'LogAPICall("Initialize", param, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
} else {
|
||||
if (Initialized) {
|
||||
@@ -263,7 +264,8 @@ function SCORMapi1_3() {
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Initialize: "+GetErrorString(errorCode));';
|
||||
// echo 'alert("Initialize: "+GetErrorString(errorCode));';
|
||||
echo 'LogAPICall("Initialize", param, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
@@ -275,7 +277,8 @@ function SCORMapi1_3() {
|
||||
if ((Initialized) && (!Terminated)) {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Terminated SCORM 1.3");';
|
||||
// echo 'alert("Terminated SCORM 1.3");';
|
||||
echo 'LogAPICall("Terminate", param, "", 0);';
|
||||
}
|
||||
?>
|
||||
Initialized = false;
|
||||
@@ -352,7 +355,8 @@ function SCORMapi1_3() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("GetValue("+element+") -> "+eval(element));';
|
||||
// echo 'alert("GetValue("+element+") -> "+eval(element));';
|
||||
echo 'LogAPICall("GetValue", element, eval(element), 0);';
|
||||
}
|
||||
?>
|
||||
return eval(element);
|
||||
@@ -417,7 +421,8 @@ function SCORMapi1_3() {
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("GetValue("+element+") -> "+GetErrorString(errorCode));';
|
||||
// echo 'alert("GetValue("+element+") -> "+GetErrorString(errorCode));';
|
||||
echo 'LogAPICall("GetValue", element, "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return "";
|
||||
@@ -712,12 +717,6 @@ function SCORMapi1_3() {
|
||||
nodes[0] = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ((nodes.length > 0) && (nodes.length <= correct_responses[interactiontype].max)) {
|
||||
expression = new RegExp(correct_responses[interactiontype].format);
|
||||
for (var i=0; (i < nodes.length) && (errorCode=="0"); i++) {
|
||||
@@ -788,7 +787,8 @@ function SCORMapi1_3() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("SetValue("+element+","+value+") -> OK");';
|
||||
// echo 'alert("SetValue("+element+","+value+") -> OK");';
|
||||
echo 'LogAPICall("SetValue", element, value, errorCode);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -803,7 +803,8 @@ function SCORMapi1_3() {
|
||||
errorCode = "0";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("SetValue("+element+","+value+") -> OK");';
|
||||
// echo 'alert("SetValue("+element+","+value+") -> OK");';
|
||||
echo 'LogAPICall("SetValue", element, value, errorCode);';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -830,7 +831,7 @@ function SCORMapi1_3() {
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("SetValue("+element+","+value+") -> "+GetErrorString(errorCode));';
|
||||
echo 'LogAPICall("SetValue", element, value, errorCode);';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
@@ -843,7 +844,8 @@ function SCORMapi1_3() {
|
||||
result = StoreData(cmi,false);
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Data Commited");';
|
||||
echo 'LogAPICall("Commit", param, "", 0);';
|
||||
//echo 'alert("Data Commited");';
|
||||
}
|
||||
?>
|
||||
return "true";
|
||||
@@ -859,13 +861,19 @@ function SCORMapi1_3() {
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("Commit: "+GetErrorString(errorCode));';
|
||||
echo 'LogAPICall("Commit", param, "", 0);';
|
||||
// echo 'alert("Commit: "+GetErrorString(errorCode));';
|
||||
}
|
||||
?>
|
||||
return "false";
|
||||
}
|
||||
|
||||
function GetLastError () {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("GetLastError", "", "", errorCode);';
|
||||
}
|
||||
?>
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
@@ -952,16 +960,36 @@ function SCORMapi1_3() {
|
||||
errorString = "Data Model Dependency Not Established";
|
||||
break;
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("GetErrorString", param, errorString, 0);';
|
||||
}
|
||||
?>
|
||||
return errorString;
|
||||
} else {
|
||||
return "";
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("GetErrorString", param, "No error string found!", 0);';
|
||||
}
|
||||
?>
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function GetDiagnostic (param) {
|
||||
if (diagnostic != "") {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("GetDiagnostic", param, diagnostic, 0);';
|
||||
}
|
||||
?>
|
||||
return diagnostic;
|
||||
}
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'LogAPICall("GetDiagnostic", param, param, 0);';
|
||||
}
|
||||
?>
|
||||
return param;
|
||||
}
|
||||
|
||||
@@ -1002,9 +1030,9 @@ function SCORMapi1_3() {
|
||||
|
||||
function AddTime (first, second) {
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'alert("AddTime: "+first+" + "+second);';
|
||||
}
|
||||
// if (debugging('',DEBUG_DEVELOPER)) {
|
||||
// echo 'alert("AddTime: "+first+" + "+second);';
|
||||
// }
|
||||
?>
|
||||
var timestring = 'P';
|
||||
var matchexpr = /^P((\d+)Y)?((\d+)M)?((\d+)D)?(T((\d+)H)?((\d+)M)?((\d+(\.\d{1,2})?)S)?)?$/;
|
||||
@@ -1109,16 +1137,16 @@ function SCORMapi1_3() {
|
||||
datastring += '&attempt=<?php echo $attempt ?>';
|
||||
datastring += '&scoid=<?php echo $scoid ?>';
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'popupwin(datastring);';
|
||||
}
|
||||
// if (debugging('',DEBUG_DEVELOPER)) {
|
||||
// echo 'popupwin(datastring);';
|
||||
// }
|
||||
?>
|
||||
var myRequest = NewHttpReq();
|
||||
var result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);
|
||||
<?php
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
echo 'popupwin(result);';
|
||||
}
|
||||
// if (debugging('',DEBUG_DEVELOPER)) {
|
||||
// echo 'popupwin(result);';
|
||||
// }
|
||||
?>
|
||||
var results = String(result).split('\n');
|
||||
if ((results.length > 2) && (navrequest != '')) {
|
||||
@@ -1140,3 +1168,11 @@ function SCORMapi1_3() {
|
||||
}
|
||||
|
||||
var API_1484_11 = new SCORMapi1_3();
|
||||
|
||||
<?php
|
||||
// pull in the debugging utilities
|
||||
if (debugging('',DEBUG_DEVELOPER)) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
|
||||
echo 'AppendToLog("Moodle SCORM 1.3 API Loaded", 0);';
|
||||
}
|
||||
?>
|
||||
@@ -290,3 +290,7 @@
|
||||
|
||||
}
|
||||
|
||||
a#mod-scorm-log-toggle {
|
||||
font-size: 0.7em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user