]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9742 Converting tabs to spaces
authorpoltawski <poltawski>
Tue, 8 May 2007 23:30:58 +0000 (23:30 +0000)
committerpoltawski <poltawski>
Tue, 8 May 2007 23:30:58 +0000 (23:30 +0000)
mod/scorm/backuplib.php
mod/scorm/datamodels/scormlib.php
mod/scorm/restorelib.php

index 2d1a544292032f737f872b80a5c99476fe360fce..ea058d748c096fe600a0c720e5fd34c7361b283b 100755 (executable)
@@ -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);
         
                 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));
             }
                 $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
                 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));
             }
                 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));
             }
     }
 
 
-        function backup_scorm_seq_rulecond ($bf,$preferences,$ruleconditions) {
+    function backup_scorm_seq_rulecond ($bf,$preferences,$ruleconditions) {
 
         global $CFG;
 
                 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));
             }
         return $status;
     }
 
-        function backup_scorm_seq_rolluprule ($bf,$preferences,$sco) {
+    function backup_scorm_seq_rolluprule ($bf,$preferences,$sco) {
 
         global $CFG;
 
                 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));
             }
     }
 
 
-       function backup_scorm_seq_rolluprulecond ($bf,$preferences,$rolluprule) {
+    function backup_scorm_seq_rolluprulecond ($bf,$preferences,$rolluprule) {
 
         global $CFG;
 
                 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));
             }
index 417f45d1483560c26b0ea0bd397bd373e0574274..3459956a1f353f44ee1c4679ca0a7ba92ecca221 100644 (file)
@@ -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;
     }
index 49a68d38d290f9b7e99dd7ed1b7a290091d98182..0c6c4863703996cd2d842bb798c5cd3b325bca6f 100755 (executable)
             $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;
             }
 
         //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) {
             //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 {
                 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;
     }
             $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 {
                 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;
     }
             
             $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 {
                 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;
     }
             
             $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 {
                 backup_flush(300);
             }
 
-                       //Now restore the scorm_seq_mapinfo for each objective
-               
-               }
+            //Now restore the scorm_seq_mapinfo for each objective
+
+        }
 
         return $status;
     }
             
             $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 {
                 backup_flush(300);
             }
 
-                       //Now restore the scorm_seq_mapinfo for each objective
-               
-               }
+            //Now restore the scorm_seq_mapinfo for each objective
+
+        }
 
         return $status;
     }
             
             $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 {
             $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
                 $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);