From a9d71982b0f2b504d4a1669f71d7f669d4997d1e Mon Sep 17 00:00:00 2001 From: poltawski Date: Tue, 8 May 2007 23:30:58 +0000 Subject: [PATCH] MDL-9742 Converting tabs to spaces --- mod/scorm/backuplib.php | 70 +++++++++++++------------- mod/scorm/datamodels/scormlib.php | 46 ++++++++--------- mod/scorm/restorelib.php | 84 +++++++++++++++---------------- 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/mod/scorm/backuplib.php b/mod/scorm/backuplib.php index 2d1a544292..ea058d748c 100755 --- a/mod/scorm/backuplib.php +++ b/mod/scorm/backuplib.php @@ -72,9 +72,9 @@ fwrite ($bf,full_tag('OPTIONS',4,false,$scorm->options)); fwrite ($bf,full_tag('WIDTH',4,false,$scorm->width)); fwrite ($bf,full_tag('HEIGHT',4,false,$scorm->height)); - fwrite ($bf,full_tag('MD5HASH',4,false,$scorm->md5hash)); - fwrite ($bf,full_tag("MAXATTEMPT",4,false,$scorm->maxattempt)); - fwrite ($bf,full_tag("UPDATEFREQ",4,false,$scorm->updatefreq)); + fwrite ($bf,full_tag('MD5HASH',4,false,$scorm->md5hash)); + fwrite ($bf,full_tag("MAXATTEMPT",4,false,$scorm->maxattempt)); + fwrite ($bf,full_tag("UPDATEFREQ",4,false,$scorm->updatefreq)); fwrite ($bf,full_tag('TIMEMODIFIED',4,false,$scorm->timemodified)); $status = backup_scorm_scoes($bf,$preferences,$scorm->id); @@ -117,9 +117,9 @@ fwrite ($bf,full_tag('SCORMTYPE',6,false,$sco->scormtype)); fwrite ($bf,full_tag('TITLE',6,false,$sco->title)); $status = backup_scorm_scoes_data($bf,$preferences,$sco->id); - $status = backup_scorm_seq_ruleconds($bf,$preferences,$sco->id); - $status = backup_scorm_seq_rolluprule($bf,$preferences,$sco->id); - $status = backup_scorm_seq_objective($bf,$preferences,$sco->id); + $status = backup_scorm_seq_ruleconds($bf,$preferences,$sco->id); + $status = backup_scorm_seq_rolluprule($bf,$preferences,$sco->id); + $status = backup_scorm_seq_objective($bf,$preferences,$sco->id); //End sco $status =fwrite ($bf,end_tag('SCO',5,true)); } @@ -147,7 +147,7 @@ $status =fwrite ($bf,start_tag('SCO_DATA',5,true)); //Print track contents fwrite ($bf,full_tag('ID',6,false,$sco_data->id)); - fwrite ($bf,full_tag('SCOID',6,false,$sco_data->scoid)); + fwrite ($bf,full_tag('SCOID',6,false,$sco_data->scoid)); fwrite ($bf,full_tag('NAME',6,false,$sco_data->name)); fwrite ($bf,full_tag('VALUE',6,false,$sco_data->value)); //End sco track @@ -181,8 +181,8 @@ fwrite ($bf,full_tag('SCOID',6,false,$sco_track->scoid)); fwrite ($bf,full_tag('ELEMENT',6,false,$sco_track->element)); fwrite ($bf,full_tag('VALUE',6,false,$sco_track->value)); - fwrite ($bf,full_tag('ATTEMPT',6,false,$sco_track->attempt)); - fwrite ($bf,full_tag('TIMEMODIFIED',6,false,$sco_track->timemodified)); + fwrite ($bf,full_tag('ATTEMPT',6,false,$sco_track->attempt)); + fwrite ($bf,full_tag('TIMEMODIFIED',6,false,$sco_track->timemodified)); //End sco track $status =fwrite ($bf,end_tag('SCO_TRACK',5,true)); } @@ -213,9 +213,9 @@ fwrite ($bf,full_tag('SCOID',6,false,$seq_rulecondition->scoid)); fwrite ($bf,full_tag('CONDITIONCOMBINATION',6,false,$seq_rulecondition->conditioncombination)); fwrite ($bf,full_tag('RULETYPE',6,false,$seq_rulecondition->ruletype)); - fwrite ($bf,full_tag('ACTION',6,false,$seq_rulecondition->action)); - - $status = backup_scorm_seq_rulecond($bf,$preferences,$seq_rulecondition->id); + fwrite ($bf,full_tag('ACTION',6,false,$seq_rulecondition->action)); + + $status = backup_scorm_seq_rulecond($bf,$preferences,$seq_rulecondition->id); //End sco track $status =fwrite ($bf,end_tag('SEQ_RULECOND',5,true)); } @@ -226,7 +226,7 @@ } - function backup_scorm_seq_rulecond ($bf,$preferences,$ruleconditions) { + function backup_scorm_seq_rulecond ($bf,$preferences,$ruleconditions) { global $CFG; @@ -246,9 +246,9 @@ fwrite ($bf,full_tag('SCOID',6,false,$seq_rulecondition->scoid)); fwrite ($bf,full_tag('RULECONDITIONSID',6,false,$seq_rulecondition->ruleconditionsid)); fwrite ($bf,full_tag('REFRENCEDOBJECTIVE',6,false,$seq_rulecondition->refrencedobjective)); - fwrite ($bf,full_tag('MEASURETHRESHOLD',6,false,$seq_rulecondition->measurethreshold)); - fwrite ($bf,full_tag('OPERATOR',6,false,$seq_rulecondition->operator)); - fwrite ($bf,full_tag('COND',6,false,$seq_rulecondition->cond)); + fwrite ($bf,full_tag('MEASURETHRESHOLD',6,false,$seq_rulecondition->measurethreshold)); + fwrite ($bf,full_tag('OPERATOR',6,false,$seq_rulecondition->operator)); + fwrite ($bf,full_tag('COND',6,false,$seq_rulecondition->cond)); //End sco track $status =fwrite ($bf,end_tag('SEQ_RULECOND_DATA',5,true)); } @@ -258,7 +258,7 @@ return $status; } - function backup_scorm_seq_rolluprule ($bf,$preferences,$sco) { + function backup_scorm_seq_rolluprule ($bf,$preferences,$sco) { global $CFG; @@ -277,11 +277,11 @@ fwrite ($bf,full_tag('ID',6,false,$seq_rolluprule->id)); fwrite ($bf,full_tag('SCOID',6,false,$seq_rolluprule->scoid)); fwrite ($bf,full_tag('CHILDACTIVITYSET',6,false,$seq_rolluprule->childactivityset)); - fwrite ($bf,full_tag('MINIMUMCOUNT',6,false,$seq_rolluprule->minimumcount)); - fwrite ($bf,full_tag('MINIMUMPERCENT',6,false,$seq_rolluprule->minimumpercent)); - fwrite ($bf,full_tag('CONDITIONCOMBINATION',6,false,$seq_rolluprule->conditioncomnination)); - fwrite ($bf,full_tag('ACTION',6,false,$seq_rolluprule->action)); - $status = backup_scorm_seq_rolluprulecond($bf,$preferences,$seq_rolluprule->id); + fwrite ($bf,full_tag('MINIMUMCOUNT',6,false,$seq_rolluprule->minimumcount)); + fwrite ($bf,full_tag('MINIMUMPERCENT',6,false,$seq_rolluprule->minimumpercent)); + fwrite ($bf,full_tag('CONDITIONCOMBINATION',6,false,$seq_rolluprule->conditioncomnination)); + fwrite ($bf,full_tag('ACTION',6,false,$seq_rolluprule->action)); + $status = backup_scorm_seq_rolluprulecond($bf,$preferences,$seq_rolluprule->id); //End sco track $status =fwrite ($bf,end_tag('SEQ_ROLLUPRULE',5,true)); } @@ -292,7 +292,7 @@ } - function backup_scorm_seq_rolluprulecond ($bf,$preferences,$rolluprule) { + function backup_scorm_seq_rolluprulecond ($bf,$preferences,$rolluprule) { global $CFG; @@ -311,9 +311,9 @@ fwrite ($bf,full_tag('ID',6,false,$seq_rolluprulecondition->id)); fwrite ($bf,full_tag('SCOID',6,false,$seq_rolluprulecondition->scoid)); fwrite ($bf,full_tag('ROLLUPRULEID',6,false,$seq_rolluprulecondition->rollupruleid)); - fwrite ($bf,full_tag('COND',6,false,$seq_rolluprulecondition->condition)); - fwrite ($bf,full_tag('OPERATOR',6,false,$seq_rolluprulecondition->operator)); - + fwrite ($bf,full_tag('COND',6,false,$seq_rolluprulecondition->condition)); + fwrite ($bf,full_tag('OPERATOR',6,false,$seq_rolluprulecondition->operator)); + //End sco track $status =fwrite ($bf,end_tag('SEQ_ROLLUPRULECOND',5,true)); } @@ -344,10 +344,10 @@ function backup_scorm_seq_objective ($bf,$preferences,$sco) { fwrite ($bf,full_tag('SCOID',6,false,$seq_objective->scoid)); fwrite ($bf,full_tag('PRIMARYOBJ',6,false,$seq_objective->primaryobj)); fwrite ($bf,full_tag('OBJECTIVEID',6,false,$seq_objective->objectiveid)); - fwrite ($bf,full_tag('MINNORMALIZEDMEASURE',6,false,$seq_objective->minnormalizedmeasure)); - fwrite ($bf,full_tag('SATISFIEDBYMEASURE',6,false,$seq_objective->objectivemeasureweight)); - - $status = backup_scorm_seq_mapinfo($bf,$preferences,$seq_objective->id); + fwrite ($bf,full_tag('MINNORMALIZEDMEASURE',6,false,$seq_objective->minnormalizedmeasure)); + fwrite ($bf,full_tag('SATISFIEDBYMEASURE',6,false,$seq_objective->objectivemeasureweight)); + + $status = backup_scorm_seq_mapinfo($bf,$preferences,$seq_objective->id); //End sco track $status =fwrite ($bf,end_tag('SEQ_OBJECTIVE',5,true)); } @@ -357,7 +357,7 @@ function backup_scorm_seq_objective ($bf,$preferences,$sco) { return $status; } - function backup_scorm_seq_mapinfo ($bf,$preferences,$objectives) { + function backup_scorm_seq_mapinfo ($bf,$preferences,$objectives) { global $CFG; @@ -377,10 +377,10 @@ function backup_scorm_seq_objective ($bf,$preferences,$sco) { fwrite ($bf,full_tag('SCOID',6,false,$seq_objective->scoid)); fwrite ($bf,full_tag('OBJECTIVEID',6,false,$seq_objective->objectiveid)); fwrite ($bf,full_tag('TARGETOBJECTIVEID',6,false,$seq_objective->targetobjectiveid)); - fwrite ($bf,full_tag('READSATISFIEDSTATUS',6,false,$seq_objective->readsatisfiedstatus)); - fwrite ($bf,full_tag('READNORMALIZEDMEASURE',6,false,$seq_objective->readnormalizedmeasure)); - fwrite ($bf,full_tag('WRITESATISFIEDSTATUS',6,false,$seq_objective->writesatisfiedstatus)); - fwrite ($bf,full_tag('WRITENORMALIZEDMEASURE',6,false,$seq_objective->writenormalizedmeasure)); + fwrite ($bf,full_tag('READSATISFIEDSTATUS',6,false,$seq_objective->readsatisfiedstatus)); + fwrite ($bf,full_tag('READNORMALIZEDMEASURE',6,false,$seq_objective->readnormalizedmeasure)); + 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)); } diff --git a/mod/scorm/datamodels/scormlib.php b/mod/scorm/datamodels/scormlib.php index 417f45d148..3459956a1f 100644 --- a/mod/scorm/datamodels/scormlib.php +++ b/mod/scorm/datamodels/scormlib.php @@ -645,28 +645,28 @@ function scorm_get_children($sco) { } function scorm_get_available_children($sco){ - $res = get_record('scorm_scoes_track','scoid',$scoid,'userid',$userid,'element','availablechildren'); - if(!$res || $res == null){ - return false; - } - else{ - return unserialize($res->value); - } + $res = get_record('scorm_scoes_track','scoid',$scoid,'userid',$userid,'element','availablechildren'); + if(!$res || $res == null){ + return false; + } + else{ + return unserialize($res->value); + } } function scorm_get_available_descendent($descend = array(),$sco){ - if($sco == null){ - return $descend; - } - else{ - $avchildren = scorm_get_available_children($sco); - foreach($avchildren as $avchild){ - array_push($descend,$avchild); - } - foreach($avchildren as $avchild){ - scorm_get_available_descendent($descend,$avchild); - } - } + if($sco == null){ + return $descend; + } + else{ + $avchildren = scorm_get_available_children($sco); + foreach($avchildren as $avchild){ + array_push($descend,$avchild); + } + foreach($avchildren as $avchild){ + scorm_get_available_descendent($descend,$avchild); + } + } } function scorm_get_siblings($sco) { @@ -692,10 +692,10 @@ function scorm_get_preorder($preorder=array(),$sco) { if ($sco != null) { array_push($preorder,$sco); - $children = scorm_get_children($sco); - foreach ($children as $child){ - scorm_get_preorder($sco); - } + $children = scorm_get_children($sco); + foreach ($children as $child){ + scorm_get_preorder($sco); + } } else { return $preorder; } diff --git a/mod/scorm/restorelib.php b/mod/scorm/restorelib.php index 49a68d38d2..0c6c486370 100755 --- a/mod/scorm/restorelib.php +++ b/mod/scorm/restorelib.php @@ -48,16 +48,16 @@ $scorm->name = backup_todb($info['MOD']['#']['NAME']['0']['#']); $scorm->reference = backup_todb($info['MOD']['#']['REFERENCE']['0']['#']); $scorm->version = backup_todb($info['MOD']['#']['VERSION']['0']['#']); - $scorm->md5hash = backup_todb($info['MOD']['#']['MD5HASH']['0']['#']); + $scorm->md5hash = backup_todb($info['MOD']['#']['MD5HASH']['0']['#']); $scorm->maxgrade = backup_todb($info['MOD']['#']['MAXGRADE']['0']['#']); if (!is_int($scorm->maxgrade)) { $scorm->maxgrade = 0; } - $scorm->updatefreq = backup_todb($info['MOD']['#']['UPDATEFREQ']['0']['#']); + $scorm->updatefreq = backup_todb($info['MOD']['#']['UPDATEFREQ']['0']['#']); if (!is_int($scorm->updatefreq)) { $scorm->updatefreq = 0; } - $scorm->maxattempt = backup_todb($info['MOD']['#']['MAXATTEMPT']['0']['#']); + $scorm->maxattempt = backup_todb($info['MOD']['#']['MAXATTEMPT']['0']['#']); if (!is_int($scorm->maxattempt)) { $scorm->maxattempt = 0; } @@ -203,8 +203,8 @@ //Now check if want to restore user data and do it. scorm_scoes_seq_objective_restore_mods ($newid,$info,$restore); - scorm_scoes_seq_rolluprule_restore_mods ($newid,$info,$restore); - scorm_scoes_seq_ruleconds_restore_mods ($newid,$info,$restore); + scorm_scoes_seq_rolluprule_restore_mods ($newid,$info,$restore); + scorm_scoes_seq_ruleconds_restore_mods ($newid,$info,$restore); if (restore_userdata_selected($restore,'scorm',$oldmodid)) { //Restore scorm_scoes if ($status) { @@ -250,7 +250,7 @@ //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_objective",$objective); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_objective", $oldid, $newid); } else { @@ -268,11 +268,11 @@ backup_flush(300); } - //Now restore the scorm_seq_mapinfo for each objective + //Now restore the scorm_seq_mapinfo for each objective $status = scorm_seq_mapinfo_restore_mods ($sco_id,$newid,$obj_info,$restore); - } + } return $status; } @@ -305,12 +305,12 @@ $rolluprule->minimumrule = backup_todb($rol_info['#']['MINIMUMCOUNT']['0']['#']); $rolluprule->minimumpercent = backup_todb($rol_info['#']['MINIMUMPERCENT']['0']['#']); $rolluprule->conditioncombination = backup_todb($rol_info['#']['CONDITIONCOMBINATION']['0']['#']); - $rolluprule->action = backup_todb($rol_info['#']['ACTION']['0']['#']); + $rolluprule->action = backup_todb($rol_info['#']['ACTION']['0']['#']); //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_rolluprule",$rolluprule); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_rolluprule", $oldid, $newid); } else { @@ -328,11 +328,11 @@ backup_flush(300); } - //Now restore the scorm_seq_mapinfo for each objective + //Now restore the scorm_seq_mapinfo for each objective $status = scorm_seq_rolluprulecond_restore_mods ($sco_id, $newid,$obj_info,$restore); - } + } return $status; } @@ -360,13 +360,13 @@ $rulecond->scoid = $sco_id; $rulecond->conditioncombination = backup_todb($rul_info['#']['CONDITIONCOMBINATION']['0']['#']); - $rulecond->minimumpercent = backup_todb($rul_info['#']['RULETYPE']['0']['#']); - $rulecond->action = backup_todb($rul_info['#']['ACTION']['0']['#']); + $rulecond->minimumpercent = backup_todb($rul_info['#']['RULETYPE']['0']['#']); + $rulecond->action = backup_todb($rul_info['#']['ACTION']['0']['#']); //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_ruleconds",$rulecond); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_ruleconds", $oldid, $newid); } else { @@ -384,11 +384,11 @@ backup_flush(300); } - //Now restore the scorm_seq_mapinfo for each objective + //Now restore the scorm_seq_mapinfo for each objective $status = scorm_seq_rulecond_restore_mods ($sco_id, $newid,$obj_info,$restore); - } + } return $status; } @@ -416,15 +416,15 @@ $rulecondd->scoid = $sco_id; $rulecondd->ruleconditions = $rulecondid; - $rulecondd->refrencedobjective = backup_todb($ruld_info['#']['REFRENCEDOBJECTIVE']['0']['#']); - $rulecondd->measurethreshold = backup_todb($ruld_info['#']['MEASURETHRESHOLD']['0']['#']); - $rulecondd->operator = backup_todb($ruld_info['#']['OPERATOR']['0']['#']); - $rulecondd->cond = backup_todb($ruld_info['#']['COND']['0']['#']); + $rulecondd->refrencedobjective = backup_todb($ruld_info['#']['REFRENCEDOBJECTIVE']['0']['#']); + $rulecondd->measurethreshold = backup_todb($ruld_info['#']['MEASURETHRESHOLD']['0']['#']); + $rulecondd->operator = backup_todb($ruld_info['#']['OPERATOR']['0']['#']); + $rulecondd->cond = backup_todb($ruld_info['#']['COND']['0']['#']); //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_rulecond",$rulecondd); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_rulecond", $oldid, $newid); } else { @@ -442,9 +442,9 @@ backup_flush(300); } - //Now restore the scorm_seq_mapinfo for each objective - - } + //Now restore the scorm_seq_mapinfo for each objective + + } return $status; } @@ -472,14 +472,14 @@ $rolluprulecond->scoid = $sco_id; $rolluprulecond->ruleconditions = $rolluprule; - $rolluprulecond->cond = backup_todb($rulc_info['#']['COND']['0']['#']); - $rolluprulecond->operator = backup_todb($rulc_info['#']['OPERATOR']['0']['#']); - - + $rolluprulecond->cond = backup_todb($rulc_info['#']['COND']['0']['#']); + $rolluprulecond->operator = backup_todb($rulc_info['#']['OPERATOR']['0']['#']); + + //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_rolluprulecond",$rolluprulecond); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_rolluprulecond", $oldid, $newid); } else { @@ -497,9 +497,9 @@ backup_flush(300); } - //Now restore the scorm_seq_mapinfo for each objective - - } + //Now restore the scorm_seq_mapinfo for each objective + + } return $status; } @@ -527,17 +527,17 @@ $mapinfo->scoid = $sco_id; $mapinfo->objectiveid = $ojectiveid; - $mapinfo->targetobjectiveid = backup_todb($map_info['#']['TARGETOBJECTIVEID']['0']['#']); - $mapinfo->readsatisfiedstatus = backup_todb($map_info['#']['READSATISFIEDSTATUS']['0']['#']); - $mapinfo->readnormalizedmeasure = backup_todb($map_info['#']['READNORMALIZEDMEASURE']['0']['#']); - $mapinfo->writesatisfiedstatus = backup_todb($map_info['#']['WRITESATISFIEDSTATUS']['0']['#']); - $mapinfo->writenormalizedmeasure = backup_todb($map_info['#']['WRITENORMALIZEDMEASURE']['0']['#']); - + $mapinfo->targetobjectiveid = backup_todb($map_info['#']['TARGETOBJECTIVEID']['0']['#']); + $mapinfo->readsatisfiedstatus = backup_todb($map_info['#']['READSATISFIEDSTATUS']['0']['#']); + $mapinfo->readnormalizedmeasure = backup_todb($map_info['#']['READNORMALIZEDMEASURE']['0']['#']); + $mapinfo->writesatisfiedstatus = backup_todb($map_info['#']['WRITESATISFIEDSTATUS']['0']['#']); + $mapinfo->writenormalizedmeasure = backup_todb($map_info['#']['WRITENORMALIZEDMEASURE']['0']['#']); + //The structure is equal to the db, so insert the forum_discussions $newid = insert_record ("scorm_seq_mapinfo",$mapinfo); - if ($newid) { + if ($newid) { //We have the newid, update backup_ids backup_putid($restore->backup_unique_code,"scorm_seq_mapinfo", $oldid, $newid); } else { @@ -580,7 +580,7 @@ $scotrack->userid = backup_todb($sub_info['#']['USERID']['0']['#']); $scotrack->scoid = backup_todb($sub_info['#']['SCOID']['0']['#']); $scotrack->element = backup_todb($sub_info['#']['ELEMENT']['0']['#']); - $scotrack->attempt = backup_todb($sub_info['#']['ATTEMPT']['0']['#']); + $scotrack->attempt = backup_todb($sub_info['#']['ATTEMPT']['0']['#']); $scotrack->value = backup_todb($sub_info['#']['VALUE']['0']['#']); //We have to recode the userid field @@ -595,7 +595,7 @@ $scotrack->scoid = $sco->new_id; } - $scotrack->timemodified = time(); + $scotrack->timemodified = time(); //The structure is equal to the db, so insert the scorm_scoes_track $newid = insert_record ("scorm_scoes_track",$scotrack); -- 2.39.5