Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / scorm / datamodels / scorm_13.js.php
blob3ef825c803326aa666570d3bad2cec741e2d5065
1 <?php
2 if (isset($userdata->status)) {
3 if (!isset($userdata->{'cmi.exit'}) || (($userdata->{'cmi.exit'} == 'time-out') || ($userdata->{'cmi.exit'} == 'normal'))) {
4 $userdata->entry = 'ab-initio';
5 } else {
6 if (isset($userdata->{'cmi.exit'}) && (($userdata->{'cmi.exit'} == 'suspend') || ($userdata->{'cmi.exit'} == 'logout'))) {
7 $userdata->entry = 'resume';
8 } else {
9 $userdata->entry = '';
15 // Used need to debug cmi content (if you uncomment this, you must comment the definition inside SCORMapi1_3)
16 //var cmi = new Object();
19 // SCORM 1.3 API Implementation
21 function SCORMapi1_3() {
22 // Standard Data Type Definition
23 var CMIString200 = '^.{0,200}$';
24 var CMIString250 = '^.{0,250}$';
25 var CMIString1000 = '^.{0,1500}$';
26 var CMIString4000 = '^.{0,4000}$';
27 var CMIString64000 = '^.{0,64000}$';
28 var CMILang = '^([a-zA-Z]{2,3}|i|x)(\-[a-zA-Z0-9\-]{2,8})?$|^$';
29 var CMILangString250 = '^(\{lang=([a-zA-Z]{2,3}|i|x)(\-[a-zA-Z0-9\-]{2,8})?\})?([^\{].{0,250}$)?';
30 var CMILangString4000 = '^(\{lang=([a-zA-Z]{2,3}|i|x)(\-[a-zA-Z0-9\-]{2,8})?\})?([^\{].{0,4000}$)?';
31 var CMITime = '^(19[7-9]{1}[0-9]{1}|20[0-2]{1}[0-9]{1}|203[0-8]{1})((-(0[1-9]{1}|1[0-2]{1}))((-(0[1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]{1}))(T([0-1]{1}[0-9]{1}|2[0-3]{1})((:[0-5]{1}[0-9]{1})((:[0-5]{1}[0-9]{1})((\\.[0-9]{1,2})((Z|([+|-]([0-1]{1}[0-9]{1}|2[0-3]{1})))(:[0-5]{1}[0-9]{1})?)?)?)?)?)?)?)?$';
32 var CMITimespan = '^P(\\d+Y)?(\\d+M)?(\\d+D)?(T(((\\d+H)(\\d+M)?(\\d+(\.\\d{1,2})?S)?)|((\\d+M)(\\d+(\.\\d{1,2})?S)?)|((\\d+(\.\\d{1,2})?S))))?$';
33 var CMIInteger = '^\\d+$';
34 var CMISInteger = '^-?([0-9]+)$';
35 var CMIDecimal = '^-?([0-9]{1,4})(\\.[0-9]{1,18})?$';
36 var CMIIdentifier = '^\\S{0,250}[a-zA-Z0-9]$';
37 var CMIShortIdentifier = '^[\\w\.]{1,250}$';
38 var CMILongIdentifier = '^\\S{0,4000}[a-zA-Z0-9]$';
39 var CMIFeedback = '^.*$'; // This must be redefined
40 var CMIIndex = '[._](\\d+).';
41 var CMIIndexStore = '.N(\\d+).';
42 // Vocabulary Data Type Definition
43 var CMICStatus = '^completed$|^incomplete$|^not attempted$|^unknown$';
44 var CMISStatus = '^passed$|^failed$|^unknown$';
45 var CMIExit = '^time-out$|^suspend$|^logout$|^normal$|^$';
46 var CMIType = '^true-false$|^choice$|^(long-)?fill-in$|^matching$|^performance$|^sequencing$|^likert$|^numeric$|^other$';
47 var CMIResult = '^correct$|^incorrect$|^unanticipated$|^neutral$|^-?([0-9]{1,4})(\\.[0-9]{1,18})?$';
48 var NAVEvent = '^previous$|^continue$|^exit$|^exitAll$|^abandon$|^abandonAll$|^suspendAll$|^{target=\\S{0,200}[a-zA-Z0-9]}choice$';
49 var NAVBoolean = '^unknown$|^true$|^false$';
50 var NAVTarget = '^previous$|^continue$|^choice.{target=\\S{0,200}[a-zA-Z0-9]}$'
51 // Children lists
52 var cmi_children = '_version, comments_from_learner, comments_from_lms, completion_status, credit, entry, exit, interactions, launch_data, learner_id, learner_name, learner_preference, location, max_time_allowed, mode, objectives, progress_measure, scaled_passing_score, score, session_time, success_status, suspend_data, time_limit_action, total_time';
53 var comments_children = 'comment, timestamp, location';
54 var score_children = 'max, raw, scaled, min';
55 var objectives_children = 'progress_measure, completion_status, success_status, description, score, id';
56 var student_data_children = 'mastery_score, max_time_allowed, time_limit_action';
57 var student_preference_children = 'audio_level, audio_captioning, delivery_speed, language';
58 var interactions_children = 'id, type, objectives, timestamp, correct_responses, weighting, learner_response, result, latency, description';
59 // Data ranges
60 var scaled_range = '-1#1';
61 var audio_range = '0#*';
62 var speed_range = '0#*';
63 var text_range = '-1#1';
64 var progress_range = '0#1';
65 var learner_response = {
66 'true-false':{'format':'^true$|^false$', 'max':1, 'delimiter':'', 'unique':false},
67 'choice':{'format':CMIIdentifier, 'max':36, 'delimiter':'[,]', 'unique':true},
68 'fill-in':{'format':CMILangString250, 'max':10, 'delimiter':'[,]', 'unique':false},
69 'long-fill-in':{'format':CMILangString4000, 'max':1, 'delimiter':'', 'unique':false},
70 'matching':{'format':CMIShortIdentifier, 'format2':CMIShortIdentifier, 'max':36, 'delimiter':'[,]', 'delimiter2':'[.]', 'unique':false},
71 'performance':{'format':'^$|'+CMIShortIdentifier, 'format2':CMIDecimal+'|^$|'+CMIShortIdentifier, 'max':250, 'delimiter':'[,]', 'delimiter2':'[.]', 'unique':false},
72 'sequencing':{'format':CMIShortIdentifier, 'max':36, 'delimiter':'[,]', 'unique':false},
73 'likert':{'format':CMIShortIdentifier, 'max':1, 'delimiter':'', 'unique':false},
74 'numeric':{'format':CMIDecimal, 'max':1, 'delimiter':'', 'unique':false},
75 'other':{'format':CMIString4000, 'max':1, 'delimiter':'', 'unique':false}
77 var correct_responses = {
78 'true-false':{'pre':'', 'max':1, 'delimiter':'', 'unique':false, 'duplicate':false,
79 'format':'^true$|^false$',
80 'limit':1},
81 'choice':{'pre':'', 'max':36, 'delimiter':'[,]', 'unique':true, 'duplicate':false,
82 'format':CMIIdentifier},
83 'fill-in':{'pre':'^(\{case_matters=(true|false)\})(\{order_matters=(true|false)\})?|^(\{order_matters=(true|false)\})(\{case_matters=(true|false)\})?',
84 'max':10, 'delimiter':'[,]', 'unique':false, 'duplicate':false,
85 'format':CMILangString250},
86 'long-fill-in':{'pre':'^(\{case_matters=(true|false)\})?', 'max':1, 'delimiter':'', 'unique':false, 'duplicate':true,
87 'format':CMILangString4000},
88 'matching':{'pre':'', 'max':36, 'delimiter':'[,]', 'delimiter2':'[.]', 'unique':false, 'duplicate':true,
89 'format':CMIShortIdentifier, 'format2':CMIShortIdentifier},
90 'performance':{'pre':'^(\{order_matters=(true|false)\})?',
91 'max':250, 'delimiter':'[,]', 'delimiter2':'[.]', 'unique':false, 'duplicate':true,
92 'format':'^$|'+CMIShortIdentifier, 'format2':CMIDecimal+'|^$|'+CMIShortIdentifier},
93 'sequencing':{'pre':'', 'max':36, 'delimiter':'[,]', 'unique':false, 'duplicate':false,
94 'format':CMIShortIdentifier},
95 'likert':{'pre':'', 'max':1, 'delimiter':'', 'unique':false, 'duplicate':false,
96 'format':CMIShortIdentifier,
97 'limit':1},
98 'numeric':{'pre':'', 'max':1, 'delimiter':'', 'unique':false, 'duplicate':false,
99 'format':CMIDecimal,
100 'limit':1},
101 'other':{'pre':'', 'max':1, 'delimiter':'', 'unique':false, 'duplicate':false,
102 'format':CMIString4000,
103 'limit':1}
106 // The SCORM 1.3 data model
107 var datamodel = {
108 'cmi._children':{'defaultvalue':cmi_children, 'mod':'r'},
109 'cmi._version':{'defaultvalue':'1.0', 'mod':'r'},
110 'cmi.comments_from_learner._children':{'defaultvalue':comments_children, 'mod':'r'},
111 'cmi.comments_from_learner._count':{'mod':'r', 'defaultvalue':'0'},
112 'cmi.comments_from_learner.n.comment':{'format':CMILangString4000, 'mod':'rw'},
113 'cmi.comments_from_learner.n.location':{'format':CMIString250, 'mod':'rw'},
114 'cmi.comments_from_learner.n.timestamp':{'format':CMITime, 'mod':'rw'},
115 'cmi.comments_from_lms._children':{'defaultvalue':comments_children, 'mod':'r'},
116 'cmi.comments_from_lms._count':{'mod':'r', 'defaultvalue':'0'},
117 'cmi.comments_from_lms.n.comment':{'format':CMILangString4000, 'mod':'r'},
118 'cmi.comments_from_lms.n.location':{'format':CMIString250, 'mod':'r'},
119 'cmi.comments_from_lms.n.timestamp':{'format':CMITime, 'mod':'r'},
120 'cmi.completion_status':{'defaultvalue':'<?php echo isset($userdata->{'cmi.completion_status'})?$userdata->{'cmi.completion_status'}:'unknown' ?>', 'format':CMICStatus, 'mod':'rw'},
121 'cmi.completion_threshold':{'defaultvalue':<?php echo isset($userdata->threshold)?'\''.$userdata->threshold.'\'':'null' ?>, 'mod':'r'},
122 'cmi.credit':{'defaultvalue':'<?php echo isset($userdata->credit)?$userdata->credit:'' ?>', 'mod':'r'},
123 'cmi.entry':{'defaultvalue':'<?php echo $userdata->entry ?>', 'mod':'r'},
124 'cmi.exit':{'defaultvalue':'<?php echo isset($userdata->{'cmi.exit'})?$userdata->{'cmi.exit'}:'' ?>', 'format':CMIExit, 'mod':'w'},
125 'cmi.interactions._children':{'defaultvalue':interactions_children, 'mod':'r'},
126 'cmi.interactions._count':{'mod':'r', 'defaultvalue':'0'},
127 'cmi.interactions.n.id':{'pattern':CMIIndex, 'format':CMILongIdentifier, 'mod':'rw'},
128 'cmi.interactions.n.type':{'pattern':CMIIndex, 'format':CMIType, 'mod':'rw'},
129 'cmi.interactions.n.objectives._count':{'pattern':CMIIndex, 'mod':'r', 'defaultvalue':'0'},
130 'cmi.interactions.n.objectives.n.id':{'pattern':CMIIndex, 'format':CMILongIdentifier, 'mod':'rw'},
131 'cmi.interactions.n.timestamp':{'pattern':CMIIndex, 'format':CMITime, 'mod':'rw'},
132 'cmi.interactions.n.correct_responses._count':{'defaultvalue':'0', 'pattern':CMIIndex, 'mod':'r'},
133 'cmi.interactions.n.correct_responses.n.pattern':{'pattern':CMIIndex, 'format':'CMIFeedback', 'mod':'rw'},
134 'cmi.interactions.n.weighting':{'pattern':CMIIndex, 'format':CMIDecimal, 'mod':'rw'},
135 'cmi.interactions.n.learner_response':{'pattern':CMIIndex, 'format':'CMIFeedback', 'mod':'rw'},
136 'cmi.interactions.n.result':{'pattern':CMIIndex, 'format':CMIResult, 'mod':'rw'},
137 'cmi.interactions.n.latency':{'pattern':CMIIndex, 'format':CMITimespan, 'mod':'rw'},
138 'cmi.interactions.n.description':{'pattern':CMIIndex, 'format':CMILangString250, 'mod':'rw'},
139 'cmi.launch_data':{'defaultvalue':<?php echo isset($userdata->datafromlms)?'\''.$userdata->datafromlms.'\'':'null' ?>, 'mod':'r'},
140 'cmi.learner_id':{'defaultvalue':'<?php echo $userdata->student_id ?>', 'mod':'r'},
141 'cmi.learner_name':{'defaultvalue':'<?php echo $userdata->student_name ?>', 'mod':'r'},
142 'cmi.learner_preference._children':{'defaultvalue':student_preference_children, 'mod':'r'},
143 'cmi.learner_preference.audio_level':{'defaultvalue':'1', 'format':CMIDecimal, 'range':audio_range, 'mod':'rw'},
144 'cmi.learner_preference.language':{'defaultvalue':'', 'format':CMILang, 'mod':'rw'},
145 'cmi.learner_preference.delivery_speed':{'defaultvalue':'1', 'format':CMIDecimal, 'range':speed_range, 'mod':'rw'},
146 'cmi.learner_preference.audio_captioning':{'defaultvalue':'0', 'format':CMISInteger, 'range':text_range, 'mod':'rw'},
147 'cmi.location':{'defaultvalue':<?php echo isset($userdata->{'cmi.location'})?'\''.$userdata->{'cmi.location'}.'\'':'null' ?>, 'format':CMIString1000, 'mod':'rw'},
148 'cmi.max_time_allowed':{'defaultvalue':<?php echo isset($userdata->maxtimeallowed)?'\''.$userdata->maxtimeallowed.'\'':'null' ?>, 'mod':'r'},
149 'cmi.mode':{'defaultvalue':'<?php echo $userdata->mode ?>', 'mod':'r'},
150 'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r'},
151 'cmi.objectives._count':{'mod':'r', 'defaultvalue':'0'},
152 'cmi.objectives.n.id':{'pattern':CMIIndex, 'format':CMILongIdentifier, 'mod':'rw'},
153 'cmi.objectives.n.score._children':{'defaultvalue':score_children, 'pattern':CMIIndex, 'mod':'r'},
154 'cmi.objectives.n.score.scaled':{'defaultvalue':null, 'pattern':CMIIndex, 'format':CMIDecimal, 'range':scaled_range, 'mod':'rw'},
155 'cmi.objectives.n.score.raw':{'defaultvalue':null, 'pattern':CMIIndex, 'format':CMIDecimal, 'mod':'rw'},
156 'cmi.objectives.n.score.min':{'defaultvalue':null, 'pattern':CMIIndex, 'format':CMIDecimal, 'mod':'rw'},
157 'cmi.objectives.n.score.max':{'defaultvalue':null, 'pattern':CMIIndex, 'format':CMIDecimal, 'mod':'rw'},
158 'cmi.objectives.n.success_status':{'defaultvalue':'unknown', 'pattern':CMIIndex, 'format':CMISStatus, 'mod':'rw'},
159 'cmi.objectives.n.completion_status':{'defaultvalue':'unknown', 'pattern':CMIIndex, 'format':CMICStatus, 'mod':'rw'},
160 'cmi.objectives.n.progress_measure':{'defaultvalue':null, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
161 'cmi.objectives.n.description':{'pattern':CMIIndex, 'format':CMILangString250, 'mod':'rw'},
162 'cmi.progress_measure':{'defaultvalue':<?php echo isset($userdata->{'cmi.progess_measure'})?'\''.$userdata->{'cmi.progress_measure'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':progress_range, 'mod':'rw'},
163 'cmi.scaled_passing_score':{'defaultvalue':<?php echo isset($userdata->{'cmi.scaled_passing_score'})?'\''.$userdata->{'cmi.scaled_passing_score'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'r'},
164 'cmi.score._children':{'defaultvalue':score_children, 'mod':'r'},
165 'cmi.score.scaled':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.scaled'})?'\''.$userdata->{'cmi.score.scaled'}.'\'':'null' ?>, 'format':CMIDecimal, 'range':scaled_range, 'mod':'rw'},
166 'cmi.score.raw':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.raw'})?'\''.$userdata->{'cmi.score.raw'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
167 'cmi.score.min':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.min'})?'\''.$userdata->{'cmi.score.min'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
168 'cmi.score.max':{'defaultvalue':<?php echo isset($userdata->{'cmi.score.max'})?'\''.$userdata->{'cmi.score.max'}.'\'':'null' ?>, 'format':CMIDecimal, 'mod':'rw'},
169 'cmi.session_time':{'format':CMITimespan, 'mod':'w', 'defaultvalue':'PT0H0M0S'},
170 'cmi.success_status':{'defaultvalue':'<?php echo isset($userdata->{'cmi.success_status'})?$userdata->{'cmi.success_status'}:'unknown' ?>', 'format':CMISStatus, 'mod':'rw'},
171 'cmi.suspend_data':{'defaultvalue':<?php echo isset($userdata->{'cmi.suspend_data'})?'\''.$userdata->{'cmi.suspend_data'}.'\'':'null' ?>, 'format':CMIString64000, 'mod':'rw'},
172 'cmi.time_limit_action':{'defaultvalue':<?php echo isset($userdata->timelimitaction)?'\''.$userdata->timelimitaction.'\'':'null' ?>, 'mod':'r'},
173 'cmi.total_time':{'defaultvalue':'<?php echo isset($userdata->{'cmi.total_time'})?$userdata->{'cmi.total_time'}:'PT0H0M0S' ?>', 'mod':'r'},
174 'adl.nav.request':{'defaultvalue':'_none_', 'format':NAVEvent, 'mod':'rw'}
177 // Datamodel inizialization
179 var cmi = new Object();
180 cmi.comments_from_learner = new Object();
181 cmi.comments_from_learner._count = 0;
182 cmi.comments_from_lms = new Object();
183 cmi.comments_from_lms._count = 0;
184 cmi.interactions = new Object();
185 cmi.interactions._count = 0;
186 cmi.learner_preference = new Object();
187 cmi.objectives = new Object();
188 cmi.objectives._count = 0;
189 cmi.score = new Object();
191 // Navigation Object
192 var adl = new Object();
193 adl.nav = new Object();
194 adl.nav.request_valid = new Array();
196 for (element in datamodel) {
197 if (element.match(/\.n\./) == null) {
198 if ((typeof eval('datamodel["'+element+'"].defaultvalue')) != 'undefined') {
199 eval(element+' = datamodel["'+element+'"].defaultvalue;');
200 } else {
201 eval(element+' = "";');
206 <?php
207 $current_objective = '';
208 $count = 0;
209 $objectives = '';
210 foreach($userdata as $element => $value){
211 if (substr($element,0,14) == 'cmi.objectives') {
212 $element = preg_replace('/\.(\d+)\./', "_\$1.", $element);
213 preg_match('/\_(\d+)\./', $element, $matches);
214 if (count($matches) > 0 && $current_objective != $matches[1]) {
215 $current_objective = $matches[1];
216 $count++;
217 $end = strpos($element,$matches[1])+strlen($matches[1]);
218 $subelement = substr($element,0,$end);
219 echo ' '.$subelement." = new Object();\n";
220 echo ' '.$subelement.".score = new Object();\n";
221 echo ' '.$subelement.".score._children = score_children;\n";
223 echo ' '.$element.' = \''.$value."';\n";
226 if ($count > 0) {
227 echo ' cmi.objectives._count = '.$count.";\n";
231 if (cmi.completion_status == '') {
232 cmi.completion_status = 'not attempted';
236 // API Methods definition
238 var Initialized = false;
239 var Terminated = false;
240 var diagnostic = "";
242 function Initialize (param) {
243 errorCode = "0";
244 if (param == "") {
245 if ((!Initialized) && (!Terminated)) {
246 Initialized = true;
247 errorCode = "0";
248 <?php
249 if (debugging('',DEBUG_DEVELOPER)) {
250 // echo 'alert("Initialized SCORM 1.3");';
251 echo 'LogAPICall("Initialize", param, "", errorCode);';
254 return "true";
255 } else {
256 if (Initialized) {
257 errorCode = "103";
258 } else {
259 errorCode = "104";
262 } else {
263 errorCode = "201";
265 <?php
266 if (debugging('',DEBUG_DEVELOPER)) {
267 // echo 'alert("Initialize: "+GetErrorString(errorCode));';
268 echo 'LogAPICall("Initialize", param, "", errorCode);';
271 return "false";
274 function Terminate (param) {
275 errorCode = "0";
276 if (param == "") {
277 if ((Initialized) && (!Terminated)) {
278 <?php
279 if (debugging('',DEBUG_DEVELOPER)) {
280 // echo 'alert("Terminated SCORM 1.3");';
281 echo 'LogAPICall("Terminate", param, "", 0);';
284 Initialized = false;
285 Terminated = true;
286 var result = StoreData(cmi,true);
287 if (adl.nav.request != '_none_') {
288 switch (adl.nav.request) {
289 case 'continue':
290 setTimeout('top.nextSCO();',500);
291 break;
292 case 'previous':
293 setTimeout('top.prevSCO();',500);
294 break;
295 case 'choice':
296 break;
297 case 'exit':
298 break;
299 case 'exitAll':
300 break;
301 case 'abandon':
302 break;
303 case 'abandonAll':
304 break;
306 } else {
307 if (<?php echo $scorm->auto ?> == 1) {
308 setTimeout('top.nextSCO();',500);
311 return "true";
312 } else {
313 if (Terminated) {
314 errorCode = "113";
315 } else {
316 errorCode = "112";
319 } else {
320 errorCode = "201";
322 <?php
323 if (debugging('',DEBUG_DEVELOPER)) {
324 echo 'alert("Terminate: "+GetErrorString(errorCode));';
327 return "false";
330 function GetValue (element) {
331 errorCode = "0";
332 diagnostic = "";
333 if ((Initialized) && (!Terminated)) {
334 if (element !="") {
335 var expression = new RegExp(CMIIndex,'g');
336 var elementmodel = String(element).replace(expression,'.n.');
338 if ((typeof eval('datamodel["'+elementmodel+'"]')) != "undefined") {
339 if (eval('datamodel["'+elementmodel+'"].mod') != 'w') {
341 element = String(element).replace(/\.(\d+)\./, ".N$1.");
342 element = element.replace(/\.(\d+)\./, ".N$1.");
344 var elementIndexes = element.split('.');
345 var subelement = element.substr(0,3);
346 var i = 1;
348 while ((i < elementIndexes.length) && (typeof eval(subelement) != "undefined")) {
349 subelement += '.'+elementIndexes[i++];
352 if (subelement == element) {
354 if ((typeof eval(subelement) != "undefined") && (eval(subelement) != null)) {
355 errorCode = "0";
356 <?php
357 if (debugging('',DEBUG_DEVELOPER)) {
358 // echo 'alert("GetValue("+element+") -> "+eval(element));';
359 echo 'LogAPICall("GetValue", element, eval(element), 0);';
362 return eval(element);
363 } else {
364 errorCode = "403";
366 } else {
367 errorCode = "301";
369 } else {
370 //errorCode = eval('datamodel["'+elementmodel+'"].readerror');
371 errorCode = "405";
373 } else {
374 var childrenstr = '._children';
375 var countstr = '._count';
376 var parentmodel = '';
377 if (elementmodel.substr(elementmodel.length-childrenstr.length,elementmodel.length) == childrenstr) {
378 parentmodel = elementmodel.substr(0,elementmodel.length-childrenstr.length);
379 if ((typeof eval('datamodel["'+parentmodel+'"]')) != "undefined") {
380 errorCode = "301";
381 diagnostic = "Data Model Element Does Not Have Children";
382 } else {
383 errorCode = "401";
385 } else if (elementmodel.substr(elementmodel.length-countstr.length,elementmodel.length) == countstr) {
386 parentmodel = elementmodel.substr(0,elementmodel.length-countstr.length);
387 if ((typeof eval('datamodel["'+parentmodel+'"]')) != "undefined") {
388 errorCode = "301";
389 diagnostic = "Data Model Element Cannot Have Count";
390 } else {
391 errorCode = "401";
393 } else {
394 parentmodel = 'adl.nav.request_valid.';
395 if (element.substr(0,parentmodel.length) == parentmodel) {
396 if (element.substr(parentmodel.length).match(NAVTarget) == null) {
397 errorCode = "301";
398 } else {
399 if (adl.nav.request == element.substr(parentmodel.length)) {
400 return "true";
401 } else if (adl.nav.request == '_none_') {
402 return "unknown";
403 } else {
404 return "false";
407 } else {
408 errorCode = "401";
412 } else {
413 errorCode = "301";
415 } else {
416 if (Terminated) {
417 errorCode = "123";
418 } else {
419 errorCode = "122";
422 <?php
423 if (debugging('',DEBUG_DEVELOPER)) {
424 // echo 'alert("GetValue("+element+") -> "+GetErrorString(errorCode));';
425 echo 'LogAPICall("GetValue", element, "", errorCode);';
428 return "";
431 function SetValue (element,value) {
432 errorCode = "0";
433 diagnostic = "";
434 if ((Initialized) && (!Terminated)) {
435 if (element != "") {
436 var expression = new RegExp(CMIIndex,'g');
437 var elementmodel = String(element).replace(expression,'.n.');
438 if ((typeof eval('datamodel["'+elementmodel+'"]')) != "undefined") {
439 if (eval('datamodel["'+elementmodel+'"].mod') != 'r') {
440 if (eval('datamodel["'+elementmodel+'"].format') != 'CMIFeedback') {
441 expression = new RegExp(eval('datamodel["'+elementmodel+'"].format'));
442 } else {
443 // cmi.interactions.n.type depending format accept everything at this stage
444 expression = new RegExp(CMIFeedback);
446 value = value+'';
447 var matches = value.match(expression);
448 if ((matches != null) && ((matches.join('').length > 0) || (value.length == 0))) {
449 // Value match dataelement format
451 if (element != elementmodel) {
452 //This is a dynamic datamodel element
454 var elementIndexes = element.split('.');
455 var subelement = 'cmi';
456 var parentelement = 'cmi';
457 for (var i=1;(i < elementIndexes.length-1) && (errorCode=="0");i++) {
458 var elementIndex = elementIndexes[i];
459 if (elementIndexes[i+1].match(/^\d+$/)) {
460 if ((parseInt(elementIndexes[i+1]) > 0) && (elementIndexes[i+1].charAt(0) == 0)) {
461 // Index has a leading 0 (zero), this is not a number
462 errorCode = "351";
464 parentelement = subelement+'.'+elementIndex;
465 if ((typeof eval(parentelement) == "undefined") || (typeof eval(parentelement+'._count') == "undefined")) {
466 errorCode="408";
467 } else {
468 if (elementIndexes[i+1] > eval(parentelement+'._count')) {
469 errorCode = "351";
470 diagnostic = "Data Model Element Collection Set Out Of Order";
472 subelement = subelement.concat('.'+elementIndex+'.N'+elementIndexes[i+1]);
473 i++;
475 if (((typeof eval(subelement)) == "undefined") && (i < elementIndexes.length-2)) {
476 errorCode="408";
479 } else {
480 subelement = subelement.concat('.'+elementIndex);
484 if (errorCode == "0") {
485 // Till now it's a real datamodel element
487 element = subelement.concat('.'+elementIndexes[elementIndexes.length-1]);
489 if ((typeof eval(subelement)) == "undefined") {
490 switch (elementmodel) {
491 case 'cmi.objectives.n.id':
492 if (!duplicatedID(element,parentelement,value)) {
493 if (elementIndexes[elementIndexes.length-2] == eval(parentelement+'._count')) {
494 eval(parentelement+'._count++;');
495 eval(subelement+' = new Object();');
496 var subobject = eval(subelement);
497 subobject.success_status = datamodel["cmi.objectives.n.success_status"].defaultvalue;
498 subobject.completion_status = datamodel["cmi.objectives.n.completion_status"].defaultvalue;
499 subobject.progress_measure = datamodel["cmi.objectives.n.progress_measure"].defaultvalue;
500 subobject.score = new Object();
501 subobject.score._children = score_children;
502 subobject.score.scaled = datamodel["cmi.objectives.n.score.scaled"].defaultvalue;
503 subobject.score.raw = datamodel["cmi.objectives.n.score.raw"].defaultvalue;
504 subobject.score.min = datamodel["cmi.objectives.n.score.min"].defaultvalue;
505 subobject.score.max = datamodel["cmi.objectives.n.score.max"].defaultvalue;
507 } else {
508 errorCode="351";
509 diagnostic = "Data Model Element ID Already Exists";
511 break;
512 case 'cmi.interactions.n.id':
513 if (elementIndexes[elementIndexes.length-2] == eval(parentelement+'._count')) {
514 eval(parentelement+'._count++;');
515 eval(subelement+' = new Object();');
516 var subobject = eval(subelement);
517 subobject.objectives = new Object();
518 subobject.objectives._count = 0;
520 break;
521 case 'cmi.interactions.n.objectives.n.id':
522 if (typeof eval(parentelement) != "undefined") {
523 if (!duplicatedID(element,parentelement,value)) {
524 if (elementIndexes[elementIndexes.length-2] == eval(parentelement+'._count')) {
525 eval(parentelement+'._count++;');
526 eval(subelement+' = new Object();');
528 } else {
529 errorCode="351";
530 diagnostic = "Data Model Element ID Already Exists";
532 } else {
533 errorCode="408";
535 break;
536 case 'cmi.interactions.n.correct_responses.n.pattern':
537 if (typeof eval(parentelement) != "undefined") {
539 // Use cmi.interactions.n.type value to check the right dataelement format
540 if (elementIndexes[elementIndexes.length-2] == eval(parentelement+'._count')) {
541 var interactiontype = eval(String(parentelement).replace('correct_responses','type'));
542 if ((typeof correct_responses[interactiontype].limit == 'undefined') ||
543 (eval(parentelement+'._count') < correct_responses[interactiontype].limit)) {
544 if (correct_responses[interactiontype].pre != '') {
545 matches = value.match(correct_responses[interactiontype].pre);
546 if (matches != null) {
547 value = value.substr(0,matches[1].length);
550 var nodes = new Array();
551 if (correct_responses[interactiontype].delimiter != '') {
552 nodes = value.split(correct_responses[interactiontype].delimiter);
553 } else {
554 nodes[0] = value;
556 if ((nodes.length > 0) && (nodes.length <= correct_responses[interactiontype].max)) {
557 expression = new RegExp(correct_responses[interactiontype].format);
558 for (var i=0; (i < nodes.length) && (errorCode=="0"); i++) {
559 if (typeof correct_responses[interactiontype].delimiter2 != 'undefined') {
560 values = nodes[i].split(correct_responses[interactiontype].delimiter2);
561 if (values.length == 2) {
562 matches = values[0].match(expression);
563 if (matches == null) {
564 errorCode = "406";
565 } else {
566 var expression2= new RegExp(correct_responses[interactiontype].format2);
567 matches = values[1].match(expression2);
568 if ((matches == null) || (matches.join('').length == 0)) {
569 errorCode = "406";
572 } else {
573 errorCode = "406";
575 } else {
576 matches = nodes[i].match(expression);
577 if (matches == null) {
578 errorCode = "406";
579 } else {
580 if ((nodes[i] != '') && (correct_responses[interactiontype].unique)) {
581 for (var j=0; (j<i) && (errorCode=="0"); j++) {
582 if (nodes[i] == nodes[j]) {
583 errorCode = "406";
590 } else if (nodes.length > correct_responses[interactiontype].max) {
591 errorCode = "351";
592 diagnostic = "Data Model Element Pattern Too Long";
594 if ((errorCode == "0") &&
595 ((correct_responses[interactiontype].duplicate == false) ||
596 (!duplicatedPA(element,parentelement,value)))) {
597 eval(parentelement+'._count++;');
598 eval(subelement+' = new Object();');
599 } else {
600 errorCode="351";
601 diagnostic = "Data Model Element Pattern Already Exists";
603 } else {
604 errorCode="351";
605 diagnostic = "Data Model Element Collection Limit Reached";
607 } else {
608 errorCode="351";
609 diagnostic = "Data Model Element Collection Set Out Of Order";
611 } else {
612 errorCode="408";
614 break;
615 default:
616 if ((parentelement != 'cmi.objectives') && (parentelement != 'cmi.interactions') && (typeof eval(parentelement) != "undefined")) {
617 if (elementIndexes[elementIndexes.length-2] == eval(parentelement+'._count')) {
618 eval(parentelement+'._count++;');
619 eval(subelement+' = new Object();');
620 } else {
621 errorCode="351";
622 diagnostic = "Data Model Element Collection Set Out Of Order";
624 } else {
625 errorCode="408";
627 break;
629 } else {
630 switch (elementmodel) {
631 case 'cmi.objectives.n.id':
632 if (eval(element) != value) {
633 errorCode = "351";
634 diagnostic = "Write Once Violation";
636 break;
637 case 'cmi.interactions.n.objectives.n.id':
638 if (duplicatedID(element,parentelement,value)) {
639 errorCode = "351";
640 diagnostic = "Data Model Element ID Already Exists";
642 break;
643 case 'cmi.interactions.n.type':
644 var subobject = eval(subelement);
645 subobject.correct_responses = new Object();
646 subobject.correct_responses._count = 0;
647 break;
648 case 'cmi.interactions.n.learner_response':
649 if (typeof eval(subelement+'.type') == "undefined") {
650 errorCode="408";
651 } else {
652 // Use cmi.interactions.n.type value to check the right dataelement format
653 interactiontype = eval(subelement+'.type');
654 var nodes = new Array();
655 if (learner_response[interactiontype].delimiter != '') {
656 nodes = value.split(learner_response[interactiontype].delimiter);
657 } else {
658 nodes[0] = value;
660 if ((nodes.length > 0) && (nodes.length <= learner_response[interactiontype].max)) {
661 expression = new RegExp(learner_response[interactiontype].format);
662 for (var i=0; (i < nodes.length) && (errorCode=="0"); i++) {
663 if (typeof learner_response[interactiontype].delimiter2 != 'undefined') {
664 values = nodes[i].split(learner_response[interactiontype].delimiter2);
665 if (values.length == 2) {
666 matches = values[0].match(expression);
667 if (matches == null) {
668 errorCode = "406";
669 } else {
670 var expression2 = new RegExp(learner_response[interactiontype].format2);
671 matches = values[1].match(expression2);
672 if (matches == null) {
673 errorCode = "406";
676 } else {
677 errorCode = "406";
679 } else {
680 matches = nodes[i].match(expression);
681 if (matches == null) {
682 errorCode = "406";
683 } else {
684 if ((nodes[i] != '') && (learner_response[interactiontype].unique)) {
685 for (var j=0; (j<i) && (errorCode=="0"); j++) {
686 if (nodes[i] == nodes[j]) {
687 errorCode = "406";
694 } else if (nodes.length > learner_response[interactiontype].max) {
695 errorCode = "351";
696 diagnostic = "Data Model Element Pattern Too Long";
699 break;
700 case 'cmi.interactions.n.correct_responses.n.pattern':
701 subel= subelement.split('.');
702 subel1= 'cmi.interactions.'+subel[2];
705 if (typeof eval(subel1+'.type') == "undefined") {
707 errorCode="408";
708 } else {
711 // Use cmi.interactions.n.type value to check the right //dataelement format
712 interactiontype = eval(subel1+'.type');
713 var nodes = new Array();
714 if (correct_responses[interactiontype].delimiter != '') {
715 nodes = value.split(correct_responses[interactiontype].delimiter);
716 } else {
717 nodes[0] = value;
720 if ((nodes.length > 0) && (nodes.length <= correct_responses[interactiontype].max)) {
721 expression = new RegExp(correct_responses[interactiontype].format);
722 for (var i=0; (i < nodes.length) && (errorCode=="0"); i++) {
723 if (typeof correct_responses[interactiontype].delimiter2 != 'undefined') {
726 values = nodes[i].split(correct_responses[interactiontype].delimiter2);
727 if (values.length == 2) {
729 matches = values[0].match(expression);
730 if (matches == null) {
732 errorCode = "406";
733 } else {
735 var expression2 = new RegExp(correct_responses[interactiontype].format2);
736 matches = values[1].match(expression2);
737 if (matches == null) {
739 errorCode = "406";
742 } else {
743 errorCode = "406";
745 } else {
747 matches = nodes[i].match(expression);
748 //if ((matches == null) || (matches.join('').length == 0)) {
749 if ((matches == null && value != "")||(matches == null && interactiontype=="true-false")){
751 errorCode = "406";
752 } else {
754 if ((nodes[i] != '') && (correct_responses[interactiontype].unique)) {
755 for (var j=0; (j<i) && (errorCode=="0"); j++) {
756 if (nodes[i] == nodes[j]) {
758 errorCode = "406";
765 } else if (nodes.length > correct_responses[interactiontype].max) {
767 errorCode = "351";
768 diagnostic = "Data Model Element Pattern Too Long";
772 break;
777 //Store data
778 if (errorCode == "0") {
780 if ((typeof eval('datamodel["'+elementmodel+'"].range')) != "undefined") {
781 range = eval('datamodel["'+elementmodel+'"].range');
782 ranges = range.split('#');
783 value = value*1.0;
784 if (value >= ranges[0]) {
785 if ((ranges[1] == '*') || (value <= ranges[1])) {
786 eval(element+'=value;');
787 errorCode = "0";
788 <?php
789 if (debugging('',DEBUG_DEVELOPER)) {
790 // echo 'alert("SetValue("+element+","+value+") -> OK");';
791 echo 'LogAPICall("SetValue", element, value, errorCode);';
794 return "true";
795 } else {
796 errorCode = '407';
798 } else {
799 errorCode = '407';
801 } else {
802 eval(element+'=value;');
803 errorCode = "0";
804 <?php
805 if (debugging('',DEBUG_DEVELOPER)) {
806 // echo 'alert("SetValue("+element+","+value+") -> OK");';
807 echo 'LogAPICall("SetValue", element, value, errorCode);';
810 return "true";
813 } else {
814 errorCode = "406";
816 } else {
817 errorCode = "404";
819 } else {
820 errorCode = "401"
822 } else {
823 errorCode = "351";
825 } else {
826 if (Terminated) {
827 errorCode = "133";
828 } else {
829 errorCode = "132";
832 <?php
833 if (debugging('',DEBUG_DEVELOPER)) {
834 echo 'LogAPICall("SetValue", element, value, errorCode);';
837 return "false";
840 function Commit (param) {
841 errorCode = "0";
842 if (param == "") {
843 if ((Initialized) && (!Terminated)) {
844 result = StoreData(cmi,false);
845 <?php
846 if (debugging('',DEBUG_DEVELOPER)) {
847 echo 'LogAPICall("Commit", param, "", 0);';
848 //echo 'alert("Data Commited");';
851 return "true";
852 } else {
853 if (Terminated) {
854 errorCode = "143";
855 } else {
856 errorCode = "142";
859 } else {
860 errorCode = "201";
862 <?php
863 if (debugging('',DEBUG_DEVELOPER)) {
864 echo 'LogAPICall("Commit", param, "", 0);';
865 // echo 'alert("Commit: "+GetErrorString(errorCode));';
868 return "false";
871 function GetLastError () {
872 <?php
873 if (debugging('',DEBUG_DEVELOPER)) {
874 echo 'LogAPICall("GetLastError", "", "", errorCode);';
877 return errorCode;
880 function GetErrorString (param) {
881 if (param != "") {
882 var errorString = "";
883 switch(param) {
884 case "0":
885 errorString = "No error";
886 break;
887 case "101":
888 errorString = "General exception";
889 break;
890 case "102":
891 errorString = "General Inizialization Failure";
892 break;
893 case "103":
894 errorString = "Already Initialized";
895 break;
896 case "104":
897 errorString = "Content Instance Terminated";
898 break;
899 case "111":
900 errorString = "General Termination Failure";
901 break;
902 case "112":
903 errorString = "Termination Before Inizialization";
904 break;
905 case "113":
906 errorString = "Termination After Termination";
907 break;
908 case "122":
909 errorString = "Retrieve Data Before Initialization";
910 break;
911 case "123":
912 errorString = "Retrieve Data After Termination";
913 break;
914 case "132":
915 errorString = "Store Data Before Inizialization";
916 break;
917 case "133":
918 errorString = "Store Data After Termination";
919 break;
920 case "142":
921 errorString = "Commit Before Inizialization";
922 break;
923 case "143":
924 errorString = "Commit After Termination";
925 break;
926 case "201":
927 errorString = "General Argument Error";
928 break;
929 case "301":
930 errorString = "General Get Failure";
931 break;
932 case "351":
933 errorString = "General Set Failure";
934 break;
935 case "391":
936 errorString = "General Commit Failure";
937 break;
938 case "401":
939 errorString = "Undefinited Data Model";
940 break;
941 case "402":
942 errorString = "Unimplemented Data Model Element";
943 break;
944 case "403":
945 errorString = "Data Model Element Value Not Initialized";
946 break;
947 case "404":
948 errorString = "Data Model Element Is Read Only";
949 break;
950 case "405":
951 errorString = "Data Model Element Is Write Only";
952 break;
953 case "406":
954 errorString = "Data Model Element Type Mismatch";
955 break;
956 case "407":
957 errorString = "Data Model Element Value Out Of Range";
958 break;
959 case "408":
960 errorString = "Data Model Dependency Not Established";
961 break;
963 <?php
964 if (debugging('',DEBUG_DEVELOPER)) {
965 echo 'LogAPICall("GetErrorString", param, errorString, 0);';
968 return errorString;
969 } else {
970 <?php
971 if (debugging('',DEBUG_DEVELOPER)) {
972 echo 'LogAPICall("GetErrorString", param, "No error string found!", 0);';
975 return "";
979 function GetDiagnostic (param) {
980 if (diagnostic != "") {
981 <?php
982 if (debugging('',DEBUG_DEVELOPER)) {
983 echo 'LogAPICall("GetDiagnostic", param, diagnostic, 0);';
986 return diagnostic;
988 <?php
989 if (debugging('',DEBUG_DEVELOPER)) {
990 echo 'LogAPICall("GetDiagnostic", param, param, 0);';
993 return param;
996 function duplicatedID (element, parent, value) {
997 var found = false;
998 var elements = eval(parent+'._count');
999 for (var n=0;(n < elements) && (!found);n++) {
1000 if ((parent+'.N'+n+'.id' != element) && (eval(parent+'.N'+n+'.id') == value)) {
1001 found = true;
1004 return found;
1007 function duplicatedPA (element, parent, value) {
1008 var found = false;
1009 var elements = eval(parent+'._count');
1010 for (var n=0;(n < elements) && (!found);n++) {
1011 if ((parent+'.N'+n+'.pattern' != element) && (eval(parent+'.N'+n+'.pattern') == value)) {
1012 found = true;
1015 return found;
1018 function getElementModel(element) {
1019 if (typeof datamodel[element] != "undefined") {
1020 return element;
1021 } else {
1022 var expression = new RegExp(CMIIndex,'g');
1023 var elementmodel = String(element).replace(expression,'.n.');
1024 if (typeof datamodel[elementmodel] != "undefined") {
1025 return elementmodel;
1028 return false;
1031 function AddTime (first, second) {
1032 <?php
1033 // if (debugging('',DEBUG_DEVELOPER)) {
1034 // echo 'alert("AddTime: "+first+" + "+second);';
1035 // }
1037 var timestring = 'P';
1038 var matchexpr = /^P((\d+)Y)?((\d+)M)?((\d+)D)?(T((\d+)H)?((\d+)M)?((\d+(\.\d{1,2})?)S)?)?$/;
1039 var firstarray = first.match(matchexpr);
1040 var secondarray = second.match(matchexpr);
1041 if ((firstarray != null) && (secondarray != null)) {
1042 var secs = parseFloat(firstarray[13],10)+parseFloat(secondarray[13],10); //Seconds
1043 var change = Math.floor(secs / 60);
1044 secs = secs - (change * 60);
1045 var mins = parseInt(firstarray[11],10)+parseInt(secondarray[11],10)+change; //Minutes
1046 change = Math.floor(mins / 60);
1047 mins = mins - (change * 60);
1048 var hours = parseInt(firstarray[9],10)+parseInt(secondarray[9],10)+change; //Hours
1049 change = Math.floor(hours / 24);
1050 hours = hours - (change * 24);
1051 var days = parseInt(firstarray[6],10)+parseInt(secondarray[6],10)+change; // Days
1052 var months = parseInt(firstarray[4],10)+parseInt(secondarray[4],10)
1053 var years = parseInt(firstarray[2],10)+parseInt(secondarray[2],10)
1055 if (years > 0) {
1056 timestring += years + 'Y';
1058 if (months > 0) {
1059 timestring += months + 'M';
1061 if (days > 0) {
1062 timestring += days + 'D';
1064 if ((hours > 0) || (mins > 0) || (secs > 0)) {
1065 timestring += 'T';
1066 if (hours > 0) {
1067 timestring += hours + 'H';
1069 if (mins > 0) {
1070 timestring += mins + 'M';
1072 if (secs > 0) {
1073 timestring += secs + 'S';
1076 return timestring;
1079 function TotalTime() {
1080 var total_time = AddTime(cmi.total_time, cmi.session_time);
1081 return '&'+underscore('cmi.total_time')+'='+encodeURIComponent(total_time);
1084 function CollectData(data,parent) {
1085 var datastring = '';
1086 for (property in data) {
1087 if (typeof data[property] == 'object') {
1088 datastring += CollectData(data[property],parent+'.'+property);
1089 } else {
1090 var element = parent+'.'+property;
1091 var expression = new RegExp(CMIIndexStore,'g');
1092 var elementmodel = String(element).replace(expression,'.n.');
1093 if ((typeof eval('datamodel["'+elementmodel+'"]')) != "undefined") {
1094 if (eval('datamodel["'+elementmodel+'"].mod') != 'r') {
1095 var elementstring = '&'+underscore(element)+'='+encodeURIComponent(data[property]);
1096 if ((typeof eval('datamodel["'+elementmodel+'"].defaultvalue')) != "undefined") {
1097 if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property]) {
1098 datastring += elementstring;
1100 } else {
1101 datastring += elementstring;
1107 return datastring;
1110 function StoreData(data,storetotaltime) {
1111 var datastring = '';
1112 if (storetotaltime) {
1113 if (cmi.mode == 'normal') {
1114 if (cmi.credit == 'credit') {
1115 if ((cmi.completion_threshold != null) && (cmi.progress_measure != null)) {
1116 if (cmi.progress_measure >= cmi.completion_threshold) {
1117 cmi.completion_status = 'completed';
1118 } else {
1119 cmi.completion_status = 'incomplete';
1122 if ((cmi.scaled_passed_score != null) && (cmi.score.scaled != '')) {
1123 if (cmi.score.scaled >= cmi.scaled_passed_score) {
1124 cmi.success_status = 'passed';
1125 } else {
1126 cmi.success_status = 'failed';
1131 datastring += TotalTime();
1133 datastring += CollectData(data,'cmi');
1134 var element = 'adl.nav.request';
1135 var navrequest = eval(element) != datamodel[element].defaultvalue ? '&'+underscore(element)+'='+encodeURIComponent(eval(element)) : '';
1136 datastring += navrequest;
1137 datastring += '&attempt=<?php echo $attempt ?>';
1138 datastring += '&scoid=<?php echo $scoid ?>';
1139 <?php
1140 // if (debugging('',DEBUG_DEVELOPER)) {
1141 // echo 'popupwin(datastring);';
1142 // }
1144 var myRequest = NewHttpReq();
1145 var result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);
1146 <?php
1147 // if (debugging('',DEBUG_DEVELOPER)) {
1148 // echo 'popupwin(result);';
1149 // }
1151 var results = String(result).split('\n');
1152 if ((results.length > 2) && (navrequest != '')) {
1153 eval(results[2]);
1155 errorCode = results[1];
1156 return results[0];
1159 this.Initialize = Initialize;
1160 this.Terminate = Terminate;
1161 this.GetValue = GetValue;
1162 this.SetValue = SetValue;
1163 this.Commit = Commit;
1164 this.GetLastError = GetLastError;
1165 this.GetErrorString = GetErrorString;
1166 this.GetDiagnostic = GetDiagnostic;
1167 this.version = '1.0';
1170 var API_1484_11 = new SCORMapi1_3();
1172 <?php
1173 // pull in the debugging utilities
1174 if (debugging('',DEBUG_DEVELOPER)) {
1175 include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
1176 echo 'AppendToLog("Moodle SCORM 1.3 API Loaded, Activity: '.$scorm->name.', SCO: '.$sco->identifier.'", 0);';