mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-35870 mod_scorm : Prevents scorm API reload
This commit is contained in:
parent
139f32c218
commit
93ca0d54c0
@ -13,14 +13,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
//
|
||||
// SCORM 1.2 API Implementation
|
||||
//
|
||||
function AICCapi() {
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
// Standard Data Type Definition
|
||||
CMIString256 = '^.{0,255}$';
|
||||
CMIString4096 = '^.{0,4096}$';
|
||||
@ -528,5 +529,3 @@ function AICCapi() {
|
||||
this.LMSGetErrorString = LMSGetErrorString;
|
||||
this.LMSGetDiagnostic = LMSGetDiagnostic;
|
||||
}
|
||||
|
||||
var API = new AICCapi();
|
||||
|
@ -91,4 +91,6 @@ if ($count > 0) {
|
||||
$cmiobj .= ' cmi.objectives._count = '.$count.";\n";
|
||||
}
|
||||
|
||||
echo js_writer::set_variable('cmiobj', $cmiobj);
|
||||
echo js_writer::set_variable('cmiobj', $cmiobj);
|
||||
|
||||
echo 'var API = new AICCapi();';
|
@ -13,14 +13,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
//
|
||||
// SCORM 1.2 API Implementation
|
||||
//
|
||||
function SCORMapi1_2() {
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
// Standard Data Type Definition
|
||||
CMIString256 = cmistring256;
|
||||
CMIString4096 = cmistring4096;
|
||||
@ -633,6 +634,4 @@ function SCORMapi1_2() {
|
||||
this.LMSGetLastError = LMSGetLastError;
|
||||
this.LMSGetErrorString = LMSGetErrorString;
|
||||
this.LMSGetDiagnostic = LMSGetDiagnostic;
|
||||
}
|
||||
|
||||
var API = new SCORMapi1_2();
|
||||
}
|
@ -89,6 +89,8 @@ $cmiint = scorm_reconstitute_array_element($scorm->version, $userdata, 'cmi.inte
|
||||
echo js_writer::set_variable('cmiobj', $cmiobj);
|
||||
echo js_writer::set_variable('cmiint', $cmiint);
|
||||
|
||||
echo 'var API = new SCORMapi1_2();';
|
||||
|
||||
// pull in the debugging utilities
|
||||
if (scorm_debugging($scorm)) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
|
||||
|
@ -12,9 +12,6 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
// Used need to debug cmi content (if you uncomment this, you must comment the definition inside SCORMapi1_3)
|
||||
//var cmi = new Object();
|
||||
@ -23,6 +20,11 @@ var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt=
|
||||
// SCORM 1.3 API Implementation
|
||||
//
|
||||
function SCORMapi1_3() {
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a="+scormid+"&scoid="+scoid+"&attempt="+attempt+"&mode="+viewmode+"¤torg="+currentorg+"&sesskey="+sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
var datamodelurlparams = "id="+cmid+"&a="+scormid+"&sesskey="+sesskey+"&attempt="+attempt+"&scoid="+scoid;
|
||||
|
||||
// Standard Data Type Definition
|
||||
|
||||
// language key has to be checked for language dependent strings
|
||||
@ -1225,5 +1227,3 @@ function SCORMapi1_3() {
|
||||
this.GetDiagnostic = GetDiagnostic;
|
||||
this.version = '1.0';
|
||||
}
|
||||
|
||||
var API_1484_11 = new SCORMapi1_3();
|
@ -81,6 +81,8 @@ echo js_writer::set_variable('cmiint', $cmiint);
|
||||
echo js_writer::set_variable('cmicommentsuser', $cmicommentsuser);
|
||||
echo js_writer::set_variable('cmicommentslms', $cmicommentslms);
|
||||
|
||||
echo 'var API_1484_11 = new SCORMapi1_3();';
|
||||
|
||||
// pull in the debugging utilities
|
||||
if (scorm_debugging($scorm)) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
|
||||
|
@ -104,27 +104,13 @@ header('Content-Type: text/javascript; charset=UTF-8');
|
||||
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe.
|
||||
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php')) {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js.php');
|
||||
echo js_writer::set_variable('api_url_static', '/mod/scorm/datamodels/'.$scorm->version.'.js');
|
||||
} else {
|
||||
include_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12.js.php');
|
||||
echo js_writer::set_variable('api_url_static', '/mod/scorm/datamodels/scorm_12.js');
|
||||
}
|
||||
// Set the start time of this SCO.
|
||||
scorm_insert_track($USER->id, $scorm->id, $scoid, $attempt, 'x.start.time', time());
|
||||
?>
|
||||
|
||||
var pel_scorm_api = document.getElementById('scormapi-parent');
|
||||
var el_scorm_api = document.getElementById("external-scormapi-static");
|
||||
|
||||
if(el_scorm_api){
|
||||
el_scorm_api.parentNode.removeChild(el_scorm_api);
|
||||
}
|
||||
el_scorm_api = document.createElement('script');
|
||||
el_scorm_api.setAttribute('id','external-scormapi-static');
|
||||
el_scorm_api.setAttribute('type','text/javascript');
|
||||
pel_scorm_api.appendChild(el_scorm_api);
|
||||
document.getElementById('external-scormapi-static').src = M.cfg.wwwroot + api_url_static;
|
||||
|
||||
var errorCode = "0";
|
||||
function underscore(str) {
|
||||
str = String(str).replace(/.N/g,".");
|
||||
|
@ -165,6 +165,13 @@ $PAGE->requires->data_for_js('scormplayerdata', Array('launch' => false,
|
||||
'popupoptions' => $scorm->options), true);
|
||||
$PAGE->requires->js('/mod/scorm/request.js', true);
|
||||
$PAGE->requires->js('/lib/cookies.js', true);
|
||||
|
||||
if (file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'.js')) {
|
||||
$PAGE->requires->js('/mod/scorm/datamodels/'.$scorm->version.'.js', true);
|
||||
} else {
|
||||
$PAGE->requires->js('/mod/scorm/datamodels/scorm_12.js', true);
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!empty($scorm->displayactivityname)) {
|
||||
echo $OUTPUT->heading(format_string($scorm->name));
|
||||
|
Loading…
x
Reference in New Issue
Block a user