📄 scorm_13.js.php
字号:
function CRcheckValueNodes(element, interactiontype, nodes, value, errorCode) { expression = new RegExp(correct_responses[interactiontype].format); for (var i=0; (i < nodes.length) && (errorCode=="0"); i++) { if (interactiontype.match('^(fill-in|long-fill-in|matching|performance|sequencing)$')) { result = CRremovePrefixes(nodes[i]); errorCode = result.errorCode; nodes[i] = result.node; } // check for prefix on each node if (correct_responses[interactiontype].pre != '') { matches = nodes[i].match(correct_responses[interactiontype].pre); if (matches != null) { nodes[i] = nodes[i].substr(matches[1].length); } } if (correct_responses[interactiontype].delimiter2 != undefined) { values = nodes[i].split(correct_responses[interactiontype].delimiter2); if (values.length == 2) { matches = values[0].match(expression); if (matches == null) { errorCode = "406"; } else { var expression2 = new RegExp(correct_responses[interactiontype].format2); matches = values[1].match(expression2); if (matches == null) { errorCode = "406"; } } } else { errorCode = "406"; } } else { matches = nodes[i].match(expression); //if ((matches == null) || (matches.join('').length == 0)) { if ((matches == null && value != "")||(matches == null && interactiontype=="true-false")){ errorCode = "406"; } else { // numeric range - left must be <= right if (interactiontype == 'numeric' && nodes.length > 1) { if (parseFloat(nodes[0]) > parseFloat(nodes[1])) { errorCode = "406"; } } else { if ((nodes[i] != '') && (correct_responses[interactiontype].unique)) { for (var j=0; (j < i) && (errorCode=="0"); j++) { if (nodes[i] == nodes[j]) { errorCode = "406"; } } } } } } } // end of for each nodes return errorCode; } function Commit (param) { errorCode = "0"; if (param == "") { if ((Initialized) && (!Terminated)) { result = StoreData(cmi,false); <?php if (debugging('',DEBUG_DEVELOPER)) { echo 'LogAPICall("Commit", param, "", 0);'; //echo 'alert("Data Commited");'; } ?> return "true"; } else { if (Terminated) { errorCode = "143"; } else { errorCode = "142"; } } } else { errorCode = "201"; } <?php if (debugging('',DEBUG_DEVELOPER)) { 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; } function GetErrorString (param) { if (param != "") { var errorString = ""; switch(param) { case "0": errorString = "No error"; break; case "101": errorString = "General exception"; break; case "102": errorString = "General Inizialization Failure"; break; case "103": errorString = "Already Initialized"; break; case "104": errorString = "Content Instance Terminated"; break; case "111": errorString = "General Termination Failure"; break; case "112": errorString = "Termination Before Inizialization"; break; case "113": errorString = "Termination After Termination"; break; case "122": errorString = "Retrieve Data Before Initialization"; break; case "123": errorString = "Retrieve Data After Termination"; break; case "132": errorString = "Store Data Before Inizialization"; break; case "133": errorString = "Store Data After Termination"; break; case "142": errorString = "Commit Before Inizialization"; break; case "143": errorString = "Commit After Termination"; break; case "201": errorString = "General Argument Error"; break; case "301": errorString = "General Get Failure"; break; case "351": errorString = "General Set Failure"; break; case "391": errorString = "General Commit Failure"; break; case "401": errorString = "Undefinited Data Model"; break; case "402": errorString = "Unimplemented Data Model Element"; break; case "403": errorString = "Data Model Element Value Not Initialized"; break; case "404": errorString = "Data Model Element Is Read Only"; break; case "405": errorString = "Data Model Element Is Write Only"; break; case "406": errorString = "Data Model Element Type Mismatch"; break; case "407": errorString = "Data Model Element Value Out Of Range"; break; case "408": errorString = "Data Model Dependency Not Established"; break; } <?php if (debugging('',DEBUG_DEVELOPER)) { echo 'LogAPICall("GetErrorString", param, errorString, 0);'; } ?> return errorString; } else { <?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; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -