Permalink
Browse files

SCORM backup MDL-22301 use consistant naming for vars.

  • Loading branch information...
1 parent afd0814 commit a88499aa40e5d53ec851c6f94dc890f80b708175 @danmarsden danmarsden committed May 4, 2010
Showing with 9 additions and 6 deletions.
  1. +4 −4 mod/scorm/backuplib.php
  2. +5 −2 mod/scorm/restorelib.php
View
@@ -367,11 +367,11 @@ function backup_scorm_seq_mapinfo ($bf,$preferences,$objectives) {
//If there is rulecondition
if ($scorm_seq_objectives) {
//Write start tag
- $status =fwrite ($bf,start_tag('SEQ_MAPINFO',4,true));
+ $status =fwrite ($bf,start_tag('SEQ_MAPINFOS',4,true));
//Iterate over each sco
foreach ($scorm_seq_objectives as $seq_objective) {
//Start sco
- $status =fwrite ($bf,start_tag('SEQ_MAPINF',5,true));
+ $status =fwrite ($bf,start_tag('SEQ_MAPINFO',5,true));
//Print track contents
fwrite ($bf,full_tag('ID',6,false,$seq_objective->id));
fwrite ($bf,full_tag('SCOID',6,false,$seq_objective->scoid));
@@ -382,10 +382,10 @@ function backup_scorm_seq_mapinfo ($bf,$preferences,$objectives) {
fwrite ($bf,full_tag('WRITESATISFIEDSTATUS',6,false,$seq_objective->writesatisfiedstatus));
fwrite ($bf,full_tag('WRITENORMALIZEDMEASURE',6,false,$seq_objective->writenormalizedmeasure));
//End sco track
- $status =fwrite ($bf,end_tag('SEQ_MAPINF',5,true));
+ $status =fwrite ($bf,end_tag('SEQ_MAPINFO',5,true));
}
//Write end tag
- $status =fwrite ($bf,end_tag('SEQ_MAPINFO',4,true));
+ $status =fwrite ($bf,end_tag('SEQ_MAPINFOS',4,true));
}
return $status;
}
View
@@ -504,11 +504,14 @@ function scorm_scoes_seq_mapinfo_restore_mods($sco_id,$objectiveid,$info,$restor
//Get the discussions array
$mapinfos = array();
-
+ //backward compatibility with old backups.
if (!empty($info['MOD']['#']['SEQ_MAPINFO']['0']['#']['SEQ_MAPINF'])) {
$mapinfos = $info['MOD']['#']['SEQ_MAPINFO']['0']['#']['SEQ_MAPINF'];
}
-
+ //correct way of getting data.
+ if (!empty($info['MOD']['#']['SEQ_MAPINFOS']['0']['#']['SEQ_MAPINFO'])) {
+ $mapinfos = $info['MOD']['#']['SEQ_MAPINFOS']['0']['#']['SEQ_MAPINFO'];
+ }
for($i = 0; $i < sizeof($mapinfos); $i++) {
$map_info = $mapinfos[$i];

0 comments on commit a88499a

Please sign in to comment.