Skip to content
Browse files

MDL-17572 - remove php short tags. backport to 1.8.

  • Loading branch information...
1 parent 5e229d0 commit 80b4f1e8d2a7635acf996d80b35c40dfa106f3a1 piers committed
Showing with 35 additions and 35 deletions.
  1. +35 −35 mod/scorm/datamodels/debug.js.php
View
70 mod/scorm/datamodels/debug.js.php
@@ -40,7 +40,7 @@ function setLoggingActive (flag) {
new cookie("SCORMLoggingActive", flag, 365, "/").set();
}
-// toggle the logging
+// toggle the logging
function toggleLog () {
if (getLoggingActive() == "A") {
AppendToLog("Moodle Logging Deactivated", 0);
@@ -59,10 +59,10 @@ function toggleLog () {
var logRow = 0;
var logPopUpWindow = "N";
var debugSCORMVersion = '<?php echo $scorm->version; ?>';
-<?php
+<?php
$LMS_prefix = $scorm->version == 'scorm_12' ? 'LMS' : '';
$LMS_api = $scorm->version == 'scorm_12' ? 'API' : 'API_1484_11';
-
+
$LMS_elements = array();
if ($scorm->version == 'scorm_12') {
$LMS_elements = array( 'cmi.core._children',
@@ -253,7 +253,7 @@ function UpdateLog(s) {
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSInitialize was not successful."); \n'
+ ' return "false"; \n'
+ ' } \n'
- + ' var result = api.<?echo $LMS_prefix; ?>Initialize(""); \n'
+ + ' var result = api.<?php echo $LMS_prefix; ?>Initialize(""); \n'
+ ' if (result.toString() != "true") { \n'
+ ' var err = ErrorHandler(); \n'
+ ' } \n'
@@ -268,7 +268,7 @@ function UpdateLog(s) {
+ ' return "false"; \n'
+ ' } else { \n'
+ ' // call the LMSFinish function that should be implemented by the API \n'
- + ' var result = api.<?echo $LMS_prefix; ?>Finish(""); \n'
+ + ' var result = api.<?php echo $LMS_prefix; ?>Finish(""); \n'
+ ' if (result.toString() != "true") { \n'
+ ' var err = ErrorHandler(); \n'
+ ' } \n'
@@ -299,12 +299,12 @@ function UpdateLog(s) {
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetValue was not successful."); \n'
+ ' return ""; \n'
+ ' } else { \n'
- + ' var value = api.<?echo $LMS_prefix; ?>GetValue(name); \n'
- + ' var errCode = api.<?echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ + ' var value = api.<?php echo $LMS_prefix; ?>GetValue(name); \n'
+ + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ ' if (errCode != _NoError) { \n'
+ ' // an error was encountered so display the error description \n'
- + ' var errDescription = api.<?echo $LMS_prefix; ?>GetErrorString(errCode); \n'
- + ' alert("<?echo $LMS_prefix; ?>GetValue("+name+") failed. \\n"+ errDescription); \n'
+ + ' var errDescription = api.<?php echo $LMS_prefix; ?>GetErrorString(errCode); \n'
+ + ' alert("<?php echo $LMS_prefix; ?>GetValue("+name+") failed. \\n"+ errDescription); \n'
+ ' return ""; \n'
+ ' } else { \n'
+ ' return value.toString(); \n'
@@ -319,7 +319,7 @@ function UpdateLog(s) {
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSSetValue was not successful."); \n'
+ ' return; \n'
+ ' } else { \n'
- + ' var result = api.<?echo $LMS_prefix; ?>SetValue(name, value); \n'
+ + ' var result = api.<?php echo $LMS_prefix; ?>SetValue(name, value); \n'
+ ' if (result.toString() != "true") { \n'
+ ' var err = ErrorHandler(); \n'
+ ' } \n'
@@ -334,7 +334,7 @@ function UpdateLog(s) {
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSCommit was not successful."); \n'
+ ' return "false"; \n'
+ ' } else { \n'
- + ' var result = api.<?echo $LMS_prefix; ?>Commit(""); \n'
+ + ' var result = api.<?php echo $LMS_prefix; ?>Commit(""); \n'
+ ' if (result != "true") { \n'
+ ' var err = ErrorHandler(); \n'
+ ' } \n'
@@ -349,7 +349,7 @@ function UpdateLog(s) {
+ ' //since we can\'t get the error code from the LMS, return a general error \n'
+ ' return _GeneralError; \n'
+ ' } \n'
- + ' return api.<?echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ + ' return api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ '} \n'
+ ' \n'
+ 'function doLMSGetErrorString(errorCode) { \n'
@@ -357,7 +357,7 @@ function UpdateLog(s) {
+ ' if (api == null) { \n'
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetErrorString was not successful."); \n'
+ ' } \n'
- + ' return api.<?echo $LMS_prefix; ?>GetErrorString(errorCode).toString(); \n'
+ + ' return api.<?php echo $LMS_prefix; ?>GetErrorString(errorCode).toString(); \n'
+ '} \n'
+ ' \n'
+ 'function doLMSGetDiagnostic(errorCode) { \n'
@@ -365,7 +365,7 @@ function UpdateLog(s) {
+ ' if (api == null) { \n'
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSGetDiagnostic was not successful."); \n'
+ ' } \n'
- + ' return api.<?echo $LMS_prefix; ?>GetDiagnostic(errorCode).toString(); \n'
+ + ' return api.<?php echo $LMS_prefix; ?>GetDiagnostic(errorCode).toString(); \n'
+ '} \n'
+ ' \n'
+ 'function LMSIsInitialized() { \n'
@@ -377,8 +377,8 @@ function UpdateLog(s) {
+ ' alert("Unable to locate the LMS\'s API Implementation.\\nLMSIsInitialized() failed."); \n'
+ ' return false; \n'
+ ' } else { \n'
- + ' var value = api.<?echo $LMS_prefix; ?>GetValue("cmi.core.student_name"); \n'
- + ' var errCode = api.<?echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ + ' var value = api.<?php echo $LMS_prefix; ?>GetValue("cmi.core.student_name"); \n'
+ + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ ' if (errCode == _NotInitialized) { \n'
+ ' return false; \n'
+ ' } else { \n'
@@ -394,13 +394,13 @@ function UpdateLog(s) {
+ ' return; \n'
+ ' } \n'
+ ' // check for errors caused by or from the LMS \n'
- + ' var errCode = api.<?echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ + ' var errCode = api.<?php echo $LMS_prefix; ?>GetLastError().toString(); \n'
+ ' if (errCode != _NoError) { \n'
+ ' // an error was encountered so display the error description \n'
- + ' var errDescription = api.<?echo $LMS_prefix; ?>GetErrorString(errCode); \n'
+ + ' var errDescription = api.<?php echo $LMS_prefix; ?>GetErrorString(errCode); \n'
+ ' if (_Debug == true) { \n'
+ ' errDescription += "\\n"; \n'
- + ' errDescription += api.<?echo $LMS_prefix; ?>GetDiagnostic(null); \n'
+ + ' errDescription += api.<?php echo $LMS_prefix; ?>GetDiagnostic(null); \n'
+ ' // by passing null to LMSGetDiagnostic, we get any available diagnostics \n'
+ ' // on the previous error. \n'
+ ' } \n'
@@ -417,7 +417,7 @@ function UpdateLog(s) {
+ '} \n'
+ ' \n'
+ 'function findAPI(win) { \n'
- + ' while ((win.<?echo $LMS_api; ?> == null) && (win.parent != null) && (win.parent != win)) { \n'
+ + ' while ((win.<?php echo $LMS_api; ?> == null) && (win.parent != null) && (win.parent != win)) { \n'
+ ' findAPITries++; \n'
+ ' // Note: 7 is an arbitrary number, but should be more than sufficient \n'
+ ' if (findAPITries > 7) { \n'
@@ -426,7 +426,7 @@ function UpdateLog(s) {
+ ' } \n'
+ ' win = win.parent; \n'
+ ' } \n'
- + ' return win.<?echo $LMS_api; ?>; \n'
+ + ' return win.<?php echo $LMS_api; ?>; \n'
+ '} \n'
+ ' \n'
+ 'function getAPI() { \n'
@@ -444,11 +444,11 @@ function UpdateLog(s) {
+ ' var result = doLMSInitialize(); \n'
+ ' var msg; \n'
+ ' if(result == "true") { \n'
- + ' msg = "<?echo $LMS_prefix; ?>Initialize Successful!"; \n'
+ + ' msg = "<?php echo $LMS_prefix; ?>Initialize Successful!"; \n'
+ ' } else { \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var errString = doLMSGetErrorString(err); \n'
- + ' msg = "<?echo $LMS_prefix; ?>Initialize Failed! Error Code: "+err; \n'
+ + ' msg = "<?php echo $LMS_prefix; ?>Initialize Failed! Error Code: "+err; \n'
+ ' msg += " Error Description: " + errString; \n'
+ ' } \n'
+ ' document.initForm.msgtxt.value= msg; \n'
@@ -458,11 +458,11 @@ function UpdateLog(s) {
+ ' var result = doLMSCommit(); \n'
+ ' var msg; \n'
+ ' if(result == "true") { \n'
- + ' msg = "<?echo $LMS_prefix; ?>Commit was Successful!"; \n'
+ + ' msg = "<?php echo $LMS_prefix; ?>Commit was Successful!"; \n'
+ ' } else { \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var errString = doLMSGetErrorString(err); \n'
- + ' var msg = "<?echo $LMS_prefix; ?>Commit Failed! Error Code: "+err; \n'
+ + ' var msg = "<?php echo $LMS_prefix; ?>Commit Failed! Error Code: "+err; \n'
+ ' msg += " Error Description: " + errString; \n'
+ ' } \n'
+ ' document.otherForm.msgtxt.value = msg; \n'
@@ -509,7 +509,7 @@ function UpdateLog(s) {
+ ' var result = doLMSGetValue(value); \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var errString = doLMSGetErrorString(err); \n'
- + ' msg = "<?echo $LMS_prefix; ?>GetValue Returned: " + result; \n'
+ + ' msg = "<?php echo $LMS_prefix; ?>GetValue Returned: " + result; \n'
+ ' msg += "\\nError Code: " + err; \n'
+ ' msg += "\\nError Description: " + errString; \n'
+ ' document.elemForm.msgtxt.value = msg; \n'
@@ -524,14 +524,14 @@ function UpdateLog(s) {
+ ' var api = getAPIHandle(); \n'
+ ' if (api == null) { \n'
+ ' alert("Unable to locate the LMS\'s API Implementation.\\n"+ \n'
- + ' "<?echo $LMS_prefix; ?>SetValue was not successful."); \n'
+ + ' "<?php echo $LMS_prefix; ?>SetValue was not successful."); \n'
+ ' return false; \n'
+ ' } \n'
+ ' // Try to set the element \n'
- + ' var result = api.<?echo $LMS_prefix; ?>SetValue( item, setValue ); \n'
+ + ' var result = api.<?php echo $LMS_prefix; ?>SetValue( item, setValue ); \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var errString = doLMSGetErrorString(err); \n'
- + ' msg = "<?echo $LMS_prefix; ?>SetValue returned: " + result; \n'
+ + ' msg = "<?php echo $LMS_prefix; ?>SetValue returned: " + result; \n'
+ ' msg += "\\nError Code: " + err; \n'
+ ' msg += "\\nError Description: " + errString; \n'
+ ' document.elemForm.msgtxt.value = msg; \n'
@@ -540,19 +540,19 @@ function UpdateLog(s) {
+ ' \n'
+ ' function tryLMSGetLastError() { \n'
+ ' var err = doLMSGetLastError(); \n'
- + ' document.otherForm.msgtxt.value = "<?echo $LMS_prefix; ?>GetLastError returned Error Code: " + err; \n'
+ + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetLastError returned Error Code: " + err; \n'
+ ' } \n'
+ ' \n'
+ ' function tryLMSGetErrorString() { \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var errString = doLMSGetErrorString(err); \n'
- + ' document.otherForm.msgtxt.value = "<?echo $LMS_prefix; ?>GetErrorString returned: " + errString; \n'
+ + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetErrorString returned: " + errString; \n'
+ ' } \n'
+ ' \n'
+ ' function tryLMSGetDiagnostic() { \n'
+ ' var err = doLMSGetLastError(); \n'
+ ' var diagnostic = doLMSGetDiagnostic(err); \n'
- + ' document.otherForm.msgtxt.value = "<?echo $LMS_prefix; ?>GetDiagnostic returned: " + diagnostic; \n'
+ + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetDiagnostic returned: " + diagnostic; \n'
+ ' } \n'
+ ' \n'
+ '</script>\n'
@@ -565,7 +565,7 @@ function UpdateLog(s) {
+ ' <table width="100%" border="0">'
+ ' <tr>'
+ ' <td>'
- + ' <input type = "button" value = "Call <?echo $LMS_prefix; ?>Initialize()" onclick = "tryLMSInitialize();" id="Initialize" name="Initialize" />'
+ + ' <input type = "button" value = "Call <?php echo $LMS_prefix; ?>Initialize()" onclick = "tryLMSInitialize();" id="Initialize" name="Initialize" />'
+ ' </td>'
+ ' <td>'
+ ' <label>Result: </label><input type="text" name="msgtxt" id="msgtxt" size="80" readonly value="NotCalled" />'
@@ -588,10 +588,10 @@ function UpdateLog(s) {
+ ' </select>'
+ ' <input type="text" name="API_ELEMENT" id="API_ELEMENT" size="40"><br />'
+ ' <br />'
- + ' <label><b>Select API Function to Call</b></label> &nbsp;&nbsp;&nbsp;&nbsp; <input type = "button" value = "<?echo $LMS_prefix; ?>GetValue()"'
+ + ' <label><b>Select API Function to Call</b></label> &nbsp;&nbsp;&nbsp;&nbsp; <input type = "button" value = "<?php echo $LMS_prefix; ?>GetValue()"'
+ ' onclick = "tryLMSGetValue();" id="lmsGetButton"'
+ ' name="lmsGetButton">&nbsp;&nbsp;-- OR --&nbsp;&nbsp;'
- + ' <input type="button" value="<?echo $LMS_prefix; ?>SetValue()"'
+ + ' <input type="button" value="<?php echo $LMS_prefix; ?>SetValue()"'
+ ' onclick="tryLMSSetValue();" id="lmsSetButton"'
+ ' name="lmsSetButton">'
+ ' <label><b>&nbsp; value to Set: </b></label>&nbsp; <input type="text" name="SET_VAL" id="SET_VAL" size="25">'

0 comments on commit 80b4f1e

Please sign in to comment.
Something went wrong with that request. Please try again.