|
|
|
@ -202,7 +202,7 @@ addEvent(window, 'load', addListeners, false); |
|
|
|
|
|
|
|
|
|
|
|
// Initialize stuff when the page is loaded |
|
|
|
// Initialize stuff when the page is loaded |
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function() { |
|
|
|
logit_lms('document.ready'); |
|
|
|
logit_lms('document.ready start'); |
|
|
|
|
|
|
|
|
|
|
|
olms.info_lms_item[0] = '<?php echo $oItem->get_id();?>';
|
|
|
|
olms.info_lms_item[0] = '<?php echo $oItem->get_id();?>';
|
|
|
|
olms.info_lms_item[1] = '<?php echo $oItem->get_id();?>';
|
|
|
|
olms.info_lms_item[1] = '<?php echo $oItem->get_id();?>';
|
|
|
|
@ -223,11 +223,11 @@ $(document).ready(function() { |
|
|
|
//oXAJAX = new XAJAXobject(); |
|
|
|
//oXAJAX = new XAJAXobject(); |
|
|
|
//oxajax = new XAJAXobject(); |
|
|
|
//oxajax = new XAJAXobject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This code was moved inside LMSInitialize() |
|
|
|
if (olms.lms_lp_type == 1 || olms.lms_item_type == 'asset') { |
|
|
|
if (olms.lms_lp_type == 1 || olms.lms_item_type == 'asset') { |
|
|
|
xajax_start_timer(); |
|
|
|
//xajax_start_timer(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The following section represents a set of mandatory functions for SCORM |
|
|
|
* The following section represents a set of mandatory functions for SCORM |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -267,6 +267,7 @@ function LMSInitialize() { |
|
|
|
'vid': olms.lms_view_id, |
|
|
|
'vid': olms.lms_view_id, |
|
|
|
'iid': olms.lms_item_id |
|
|
|
'iid': olms.lms_item_id |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
type: "POST", |
|
|
|
url: "lp_ajax_initialize.php", |
|
|
|
url: "lp_ajax_initialize.php", |
|
|
|
@ -274,6 +275,7 @@ function LMSInitialize() { |
|
|
|
dataType: 'script', |
|
|
|
dataType: 'script', |
|
|
|
async: false |
|
|
|
async: false |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// log a more complete object dump when initializing, so we know what data hasn't been cleaned |
|
|
|
// log a more complete object dump when initializing, so we know what data hasn't been cleaned |
|
|
|
var log = '\nitem : '+ olms.lms_item_id |
|
|
|
var log = '\nitem : '+ olms.lms_item_id |
|
|
|
+ '\nitem_type : '+ olms.lms_item_type |
|
|
|
+ '\nitem_type : '+ olms.lms_item_type |
|
|
|
@ -295,10 +297,9 @@ function LMSInitialize() { |
|
|
|
|
|
|
|
|
|
|
|
logit_scorm('LMSInitialize() with params: '+log); |
|
|
|
logit_scorm('LMSInitialize() with params: '+log); |
|
|
|
|
|
|
|
|
|
|
|
//To keep the table updated |
|
|
|
if (olms.lms_lp_type == 1 || olms.lms_item_type == 'asset') { |
|
|
|
update_toc(olms.lesson_status, olms.lms_item_id); |
|
|
|
xajax_start_timer(); |
|
|
|
|
|
|
|
} |
|
|
|
olms.lms_initialized = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php if (api_get_setting('show_glossary_in_documents') == 'ismanual') { ?> |
|
|
|
<?php if (api_get_setting('show_glossary_in_documents') == 'ismanual') { ?> |
|
|
|
if (olms.lms_item_type == 'sco') { |
|
|
|
if (olms.lms_item_type == 'sco') { |
|
|
|
@ -463,8 +464,7 @@ function LMSGetValue(param) { |
|
|
|
} else if(req_type == '_children'){ |
|
|
|
} else if(req_type == '_children'){ |
|
|
|
result = 'id,score,status'; |
|
|
|
result = 'id,score,status'; |
|
|
|
} else if(req_type == 'score'){ |
|
|
|
} else if(req_type == 'score'){ |
|
|
|
if(myres[3]==null) |
|
|
|
if(myres[3]==null) { |
|
|
|
{ |
|
|
|
|
|
|
|
result = ''; |
|
|
|
result = ''; |
|
|
|
olms.G_LastError = G_NotImplementedError; |
|
|
|
olms.G_LastError = G_NotImplementedError; |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
@ -486,14 +486,12 @@ function LMSGetValue(param) { |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//the object is not null |
|
|
|
//the object is not null |
|
|
|
if(req_type == 'id') |
|
|
|
if(req_type == 'id') { |
|
|
|
{ |
|
|
|
|
|
|
|
result = olms.item_objectives[obj_id][0]; |
|
|
|
result = olms.item_objectives[obj_id][0]; |
|
|
|
} else if(req_type == '_children'){ |
|
|
|
} else if(req_type == '_children'){ |
|
|
|
result = 'id,score,status'; |
|
|
|
result = 'id,score,status'; |
|
|
|
} else if(req_type == 'score'){ |
|
|
|
} else if(req_type == 'score'){ |
|
|
|
if(myres[3]==null) |
|
|
|
if(myres[3]==null) { |
|
|
|
{ |
|
|
|
|
|
|
|
result = ''; |
|
|
|
result = ''; |
|
|
|
olms.G_LastError = G_NotImplementedError; |
|
|
|
olms.G_LastError = G_NotImplementedError; |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
@ -507,15 +505,13 @@ function LMSGetValue(param) { |
|
|
|
result = ''; |
|
|
|
result = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (myres[3] == '.max'){ |
|
|
|
} else if (myres[3] == '.max'){ |
|
|
|
if(olms.item_objectives[obj_id][3] != null) |
|
|
|
if(olms.item_objectives[obj_id][3] != null) { |
|
|
|
{ |
|
|
|
|
|
|
|
result = olms.item_objectives[obj_id][3]; |
|
|
|
result = olms.item_objectives[obj_id][3]; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
result = ''; |
|
|
|
result = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (myres[3] == '.min') { |
|
|
|
} else if (myres[3] == '.min') { |
|
|
|
if(olms.item_objectives[obj_id][4] != null) |
|
|
|
if(olms.item_objectives[obj_id][4] != null) { |
|
|
|
{ |
|
|
|
|
|
|
|
result = olms.item_objectives[obj_id][4]; |
|
|
|
result = olms.item_objectives[obj_id][4]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
result = ''; |
|
|
|
result = ''; |
|
|
|
@ -526,8 +522,7 @@ function LMSGetValue(param) { |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
olms.G_LastErrorString = 'Not implemented yet'; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if(req_type == 'status'){ |
|
|
|
} else if(req_type == 'status'){ |
|
|
|
if(olms.item_objectives[obj_id][1] != null) |
|
|
|
if(olms.item_objectives[obj_id][1] != null) { |
|
|
|
{ |
|
|
|
|
|
|
|
result = olms.item_objectives[obj_id][1]; |
|
|
|
result = olms.item_objectives[obj_id][1]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
result = 'not attempted'; |
|
|
|
result = 'not attempted'; |
|
|
|
@ -662,8 +657,8 @@ function LMSSetValue(param, val) { |
|
|
|
if(myres = param.match(/cmi.interactions.(\d+).(id|time|type|correct_responses|weighting|student_response|result|latency)(.*)/)) { |
|
|
|
if(myres = param.match(/cmi.interactions.(\d+).(id|time|type|correct_responses|weighting|student_response|result|latency)(.*)/)) { |
|
|
|
olms.updatable_vars_list['interactions']=true; |
|
|
|
olms.updatable_vars_list['interactions']=true; |
|
|
|
elem_id = myres[1]; |
|
|
|
elem_id = myres[1]; |
|
|
|
if(elem_id > olms.interactions.length) //interactions setting should start at 0 |
|
|
|
//interactions setting should start at 0 |
|
|
|
{ |
|
|
|
if(elem_id > olms.interactions.length) { |
|
|
|
/* |
|
|
|
/* |
|
|
|
olms.G_LastError = G_InvalidArgumentError; |
|
|
|
olms.G_LastError = G_InvalidArgumentError; |
|
|
|
olms.G_LastErrorString = 'Invalid argument (interactions)'; |
|
|
|
olms.G_LastErrorString = 'Invalid argument (interactions)'; |
|
|
|
@ -1082,7 +1077,10 @@ function lms_save_asset() { |
|
|
|
function chamilo_void_save_asset(myscore, mymax) { |
|
|
|
function chamilo_void_save_asset(myscore, mymax) { |
|
|
|
logit_lms('chamilo_void_save_asset',2); |
|
|
|
logit_lms('chamilo_void_save_asset',2); |
|
|
|
olms.score = myscore; |
|
|
|
olms.score = myscore; |
|
|
|
if((mymax == null) || (mymax == '')){mymax = 100;} //assume a default of 100, otherwise the score will not get saved (see lpi->set_score()) |
|
|
|
if ((mymax == null) || (mymax == '')){ |
|
|
|
|
|
|
|
mymax = 100; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//assume a default of 100, otherwise the score will not get saved (see lpi->set_score()) |
|
|
|
xajax_save_item(olms.lms_lp_id, olms.lms_user_id, olms.lms_view_id, olms.lms_item_id, myscore, mymax); |
|
|
|
xajax_save_item(olms.lms_lp_id, olms.lms_user_id, olms.lms_view_id, olms.lms_item_id, myscore, mymax); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1318,7 +1316,7 @@ function switch_item(current_item, next_item){ |
|
|
|
var orig_item_type = olms.lms_item_types['i'+current_item]; |
|
|
|
var orig_item_type = olms.lms_item_types['i'+current_item]; |
|
|
|
var next_item_type = olms.lms_item_types['i'+next_item]; |
|
|
|
var next_item_type = olms.lms_item_types['i'+next_item]; |
|
|
|
|
|
|
|
|
|
|
|
logit_lms('Called switch_item with params '+olms.lms_item_id+' and '+next_item+'',0); |
|
|
|
logit_lms('switch_item() called with params '+olms.lms_item_id+' and '+next_item+'',0); |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
There are four "cases" for switching items: |
|
|
|
There are four "cases" for switching items: |
|
|
|
@ -1342,6 +1340,8 @@ function switch_item(current_item, next_item){ |
|
|
|
if (next_item_type != 'sco' ) { |
|
|
|
if (next_item_type != 'sco' ) { |
|
|
|
//case 1 |
|
|
|
//case 1 |
|
|
|
logit_lms('Case 1'); |
|
|
|
logit_lms('Case 1'); |
|
|
|
|
|
|
|
logit_lms('timer' + olms.asset_timer); |
|
|
|
|
|
|
|
|
|
|
|
xajax_save_item(olms.lms_lp_id, olms.lms_user_id, olms.lms_view_id, olms.lms_item_id, olms.score, olms.max, olms.min, olms.lesson_status, olms.asset_timer, olms.suspend_data, olms.lesson_location,olms.interactions, olms.lms_item_core_exit); |
|
|
|
xajax_save_item(olms.lms_lp_id, olms.lms_user_id, olms.lms_view_id, olms.lms_item_id, olms.score, olms.max, olms.min, olms.lesson_status, olms.asset_timer, olms.suspend_data, olms.lesson_location,olms.interactions, olms.lms_item_core_exit); |
|
|
|
xajax_switch_item_details(olms.lms_lp_id,olms.lms_user_id,olms.lms_view_id,olms.lms_item_id,next_item); |
|
|
|
xajax_switch_item_details(olms.lms_lp_id,olms.lms_user_id,olms.lms_view_id,olms.lms_item_id,next_item); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -1438,6 +1438,7 @@ function switch_item(current_item, next_item){ |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var mysrc = 'lp_controller.php?action=content&lp_id='+olms.lms_lp_id+'&item_id='+next_item; |
|
|
|
var mysrc = 'lp_controller.php?action=content&lp_id='+olms.lms_lp_id+'&item_id='+next_item; |
|
|
|
var cont_f = $("#content_id"); |
|
|
|
var cont_f = $("#content_id"); |
|
|
|
|
|
|
|
|
|
|
|
@ -1608,14 +1609,16 @@ function xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id) |
|
|
|
* @uses lp_ajax_start_timer.php |
|
|
|
* @uses lp_ajax_start_timer.php |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function xajax_start_timer() { |
|
|
|
function xajax_start_timer() { |
|
|
|
logit_lms('xajax_start_timer'); |
|
|
|
logit_lms('xajax_start_timer() called'); |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
type: "GET", |
|
|
|
type: "GET", |
|
|
|
url: "lp_ajax_start_timer.php", |
|
|
|
url: "lp_ajax_start_timer.php", |
|
|
|
dataType: "script", |
|
|
|
dataType: "script", |
|
|
|
async: false, |
|
|
|
async: false, |
|
|
|
success: function(data) { |
|
|
|
success: function(time) { |
|
|
|
//logit_lms('xajax_start_timer result: ' + data); |
|
|
|
olms.asset_timer = time; |
|
|
|
|
|
|
|
olms.asset_timer_total = 0; |
|
|
|
|
|
|
|
logit_lms('xajax_start_timer result:' + time); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1673,6 +1676,7 @@ function xajax_switch_item_details(lms_lp_id,lms_user_id,lms_view_id,lms_item_id |
|
|
|
'iid': lms_item_id, |
|
|
|
'iid': lms_item_id, |
|
|
|
'next': next_item |
|
|
|
'next': next_item |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
logit_lms('xajax_switch_item_details with params:' + params); |
|
|
|
logit_lms('xajax_switch_item_details with params:' + params); |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
@ -1702,7 +1706,7 @@ function xajax_switch_item_toc(lms_lp_id,lms_user_id,lms_view_id,lms_item_id,nex |
|
|
|
'iid': lms_item_id, |
|
|
|
'iid': lms_item_id, |
|
|
|
'next': next_item |
|
|
|
'next': next_item |
|
|
|
}; |
|
|
|
}; |
|
|
|
logit_lms('xajax_switch_item_toc with params:' + params); |
|
|
|
logit_lms('xajax_switch_item_toc'); |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
type: "POST", |
|
|
|
|