Fixing scorm.api with iteractions

skala
Julio Montoya 17 years ago
parent 59dea00253
commit c5b80f610c
  1. 31
      main/newscorm/scorm_api.php

@ -7,7 +7,7 @@
Copyright (c) Denes Nagy (darkden@freemail.hu) Copyright (c) Denes Nagy (darkden@freemail.hu)
For a full list of contributors, see "credits.txt". For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt". The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -616,7 +616,7 @@ function LMSSetValue(param, val) {
return_value='true'; return_value='true';
break; break;
case "student_response": case "student_response":
interactions[elem_id][5] = val; interactions[elem_id][5] = ''+val;
logit_scorm("Interaction "+elem_id+"'s student_response updated",2); logit_scorm("Interaction "+elem_id+"'s student_response updated",2);
return_value='true'; return_value='true';
break; break;
@ -1454,21 +1454,32 @@ function xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id,
is_interactions='false'; is_interactions='false';
} }
} }
if (is_interactions=='true') { if (is_interactions=='true') {
interact_string = ''; interact_string = '';
temp = '';
for (i in interactions){ for (i in interactions){
interact_string += '&interact['+i+']='; interact_string += '&interact['+i+']=';
interact_temp = '['; interact_temp = '[';
for (j in interactions[i]) { for (j in interactions[i]) {
interact_temp += interactions[i][j]+','; temp = interactions[i][j];
temp = ''+temp; // if temp == 1 there are problems with indexOf and an integer number
//this fix when an interaction have ',' i.e:
while(temp.indexOf(',') >= 0){
temp = temp.replace(',','@@');
};
interact_temp +=temp+',';
} }
interact_temp = interact_temp.substr(0,(interact_temp.length-2)) + ']'; interact_temp = interact_temp.substr(0,(interact_temp.length-2)) + ']';
interact_string += encodeURIComponent(interact_temp); // interact_string += encodeURIComponent(interact_temp);
interact_string += interact_temp;
} }
//interact_string = encodeURIComponent(interact_string.substr(0,(interact_string.length-1))); //interact_string = encodeURIComponent(interact_string.substr(0,(interact_string.length-1)));
params += interact_string;
params += interact_string;
is_interactions='false'; is_interactions='false';
} }

Loading…
Cancel
Save