]> git.mjollnir.org Git - moodle.git/commitdiff
Apply modularity to the creation of the log file during restore to a new course.
authorthompson697 <thompson697>
Tue, 17 Oct 2006 10:05:41 +0000 (10:05 +0000)
committerthompson697 <thompson697>
Tue, 17 Oct 2006 10:05:41 +0000 (10:05 +0000)
Remove the responsibility for loging the application of the course start date offset, from activity modules to the backup module.
Merged from stable branch

17 files changed:
backup/restorelib.php
lang/en_utf8/moodle.php
mod/assignment/restorelib.php
mod/chat/restorelib.php
mod/choice/restorelib.php
mod/data/restorelib.php
mod/exercise/restorelib.php
mod/forum/restorelib.php
mod/glossary/restorelib.php
mod/hotpot/restorelib.php
mod/journal/restorelib.php
mod/lesson/restorelib.php
mod/quiz/restorelib.php
mod/quiz/restorelibpre15.php
mod/wiki/restorelib.php
mod/workshop/restorelib.php
theme/chameleon/user_styles.css

index ac1ce8dcd053d338544f1913903c33ca28f48ce5..a64809bafe98f431e645e62966dc2c90c9d1f941 100644 (file)
         //Get admin->id for later use
         $admin = get_admin();
         $adminid = $admin->id;
-        //First, we check the course_id backup data folder exists
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+
         //Now, if we have anything in events, we have to restore that
         //events
         if ($events) {
                         //print_object ($GLOBALS['traverse_array']);                                                  //Debug
                         //$GLOBALS['traverse_array']="";                                                              //Debug
 
+                        //if necessary, write to restorelog and adjust date/time fields
+                        if ($restore->course_startdateoffset) {
+                            restore_log_date_changes('Events', $restore, $info['EVENT']['#'], array('TIMESTART'));
+                        }
+
                         //Now build the EVENT record structure
                         $eve->name = backup_todb($info['EVENT']['#']['NAME']['0']['#']);
                         $eve->description = backup_todb($info['EVENT']['#']['DESCRIPTION']['0']['#']);
                         $eve->instance = 0;
                         $eve->eventtype = backup_todb($info['EVENT']['#']['EVENTTYPE']['0']['#']);  
                         $eve->timestart = backup_todb($info['EVENT']['#']['TIMESTART']['0']['#']);
-                        $date = usergetdate($eve->timestart);
-                        fwrite ($restorelog_file,"The Event - ".$eve->name. " - TIMESTART was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-                        $eve->timestart +=  $restore->course_startdateoffset;
-                        $date = usergetdate($eve->timestart);
-                        fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Event TIMESTART is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
                         $eve->timeduration = backup_todb($info['EVENT']['#']['TIMEDURATION']['0']['#']);
                         $eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']);
                         $eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']);
                 insert_record('role_capabilities', $override);
             }
         }  
-    }  
+    }
+    //write activity date changes to the html log file, and update date values in the the xml array
+    function restore_log_date_changes($recordtype, &$restore, &$xml, $TAGS, $NAMETAG='NAME') { 
+
+        global $CFG; 
+        $openlog = false; 
+     
+        // loop through time fields in $TAGS 
+        foreach ($TAGS as $TAG) { 
+
+            // check $TAG has a sensible value 
+            if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#']) && is_numeric($xml[$TAG][0]['#'])) { 
+
+                if ($openlog==false) { 
+                    $openlog = true; // only come through here once
+
+                    // open file for writing 
+                    $course_dir = "$CFG->dataroot/$restore->course_id/backupdata"; 
+                    check_dir_exists($course_dir, true); 
+                    $restorelog = fopen("$course_dir/restorelog.html", "a");
+                 
+                    // start output for this record 
+                    $msg = new stdClass(); 
+                    $msg->recordtype = $recordtype; 
+                    $msg->recordname = $xml[$NAMETAG][0]['#']; 
+                    fwrite ($restorelog, get_string("backupdaterecordtype", "moodle", $msg)); 
+                } 
+
+                // write old date to $restorelog 
+                $value = $xml[$TAG][0]['#']; 
+                $date = usergetdate($value); 
+
+                $msg = new stdClass(); 
+                $msg->TAG = $TAG; 
+                $msg->weekday = $date['weekday']; 
+                $msg->mday = $date['mday']; 
+                $msg->month = $date['month']; 
+                $msg->year = $date['year']; 
+                fwrite ($restorelog, get_string("backupdateold", "moodle", $msg)); 
+
+                // write new date to $restorelog 
+                $value += $restore->course_startdateoffset; 
+                $date = usergetdate($value); 
+
+                $msg = new stdClass(); 
+                $msg->TAG = $TAG; 
+                $msg->weekday = $date['weekday']; 
+                $msg->mday = $date['mday']; 
+                $msg->month = $date['month']; 
+                $msg->year = $date['year']; 
+                fwrite ($restorelog, get_string("backupdatenew", "moodle", $msg)); 
+
+                // update $value in $xml tree for calling module 
+                $xml[$TAG][0]['#'] = "$value"; 
+            } 
+        }
+        // close the restore log, if it was opened
+        if ($openlog) {
+           fclose($restorelog); 
+        }
+    }
 ?>
\ No newline at end of file
index 7726798ab0d7401353287b1ff80ba713af62e082..9dd4b0ea7a0fe300a0489159638de9186c0e52bf 100644 (file)
@@ -131,6 +131,9 @@ $string['backupactivehelp'] = 'Choose whether or not to do automated backups.';
 $string['backupcancelled'] = 'Backup Cancelled';
 $string['backupcoursefileshelp'] = 'If enabled then course files will be included in automated backups';
 $string['backupdate'] = 'Backup Date';
+$string['backupdatenew'] = ' &nbsp; $a->TAG is now $a->weekday, $a->mday $a->month $a->year<br>\n';
+$string['backupdateold'] = '$a->TAG was $a->weekday, $a->mday $a->month $a->year\n';
+$string['backupdaterecordtype'] = '<br>$a->recordtype - $a->recordname<br>\n';
 $string['backupdetails'] = 'Backup Details';
 $string['backupexecuteathelp'] = 'Choose what time automated backups should run at.';
 $string['backupfailed'] = 'Some of your courses weren\'t saved!!';
@@ -1471,4 +1474,4 @@ $string['yourself'] = 'yourself';
 $string['yourteacher'] = 'your $a';
 $string['zippingbackup'] = 'Zipping backup';
 
-?>
+?>
\ No newline at end of file
index afc1f2685669d29ab77c08f85eabc936933aaaa8..6c7648e5e4e1120117d8a4624a318b8bc6168bb1 100644 (file)
         $data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);
 
         if ($data) {
-            //Now get completed xmlized object   
-            $info = $data->info; 
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //Now get completed xmlized object
+            $info = $data->info;
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Assignment', $restore, $info['MOD']['#'], array('TIMEDUE', 'TIMEAVAILABLE'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $assignment->assignmenttype = backup_todb($info['MOD']['#']['ASSIGNMENTTYPE']['0']['#']);
             $assignment->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
             $assignment->timedue = backup_todb($info['MOD']['#']['TIMEDUE']['0']['#']);
-            $date = usergetdate($assignment->timedue);
-            fwrite ($restorelog_file,"<br>The Assignment - ".$assignment->name." <br>");
-            fwrite ($restorelog_file,"The TIMEDUE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");      
-            $assignment->timedue += $restore->course_startdateoffset;
-            $date = usergetdate($assignment->timedue);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEDUE is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $assignment->timeavailable = backup_todb($info['MOD']['#']['TIMEAVAILABLE']['0']['#']);
-            $date = usergetdate($assignment->timeavailable);
-            fwrite ($restorelog_file,"The TIMEAVAILABLE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $assignment->timeavailable += $restore->course_startdateoffset;
-            $date = usergetdate($assignment->timeavailable);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEAVAILABLE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $assignment->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
             $assignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
 
index ca453297f701a994c5825c1b7fda25f9d4be4b49..41ab133fc04d5d416ebcb25d7bcf9d9775b2ecff 100644 (file)
         if ($data) {
             //Now get completed xmlized object   
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
-
+            // if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Chat', $restore, $info['MOD']['#'], array('CHATTIME'));
+            }
             //Now, build the CHAT record structure
             $chat->course = $restore->course_id;
             $chat->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
             $chat->studentlogs = backup_todb($info['MOD']['#']['STUDENTLOGS']['0']['#']);
             $chat->schedule = backup_todb($info['MOD']['#']['SCHEDULE']['0']['#']);
             $chat->chattime = backup_todb($info['MOD']['#']['CHATTIME']['0']['#']);
-            $date = usergetdate($chat->chattime);
-            fwrite ($restorelog_file,"The Chat - ".$chat->name." <br>");
-            fwrite ($restorelog_file,"The CHATTIME was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $chat->chattime += $restore->course_startdateoffset;
-            $date = usergetdate($chat->chattime);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the CHATTIME is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br><br>");
             $chat->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
 
             //The structure is equal to the db, so insert the chat
index 06d0d8805daa9bc660b42c9e0b9c216ae5ca4f83..44a6d4a7d8c7c4cf6c3d3134ae914fe96e12e253 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+            // if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Choice', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $choice->showunanswered = backup_todb($info['MOD']['#']['SHOWUNANSWERED']['0']['#']);
             $choice->limitanswers = backup_todb($info['MOD']['#']['LIMITANSWERS']['0']['#']); 
             $choice->timeopen = backup_todb($info['MOD']['#']['TIMEOPEN']['0']['#']);
-            $date = usergetdate($choice->timeopen);
-            fwrite ($restorelog_file,"<br>The Choice - ".$choice->name." <br>");
-            fwrite ($restorelog_file,"The TIMEOPEN was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");         
-            $choice->timeopen += $restore->course_startdateoffset;
-            $date = usergetdate($choice->timeopen);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;The TIMEOPEN is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $choice->timeclose = backup_todb($info['MOD']['#']['TIMECLOSE']['0']['#']);
-            $date = usergetdate($choice->timeclose);
-            fwrite ($restorelog_file,"The TIMECLOSE was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $choice->timeclose += $restore->course_startdateoffset;
-            $date = usergetdate($choice->timeclose);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMECLOSE is now  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $choice->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
 
             //To mantain compatibilty, in 1.4 the publish setting meaning has changed. We
index 54f1c3c5935b5b37e0457a11d23b9fe2c80c0b1c..8e08a1e3918d11e1dfee7892ed54e57e175c79cb 100644 (file)
@@ -46,11 +46,11 @@ function data_restore_mods($mod,$restore) {
 
     if ($data) {
         //Now get completed xmlized object
-        $info = $data->info; 
-        //First, check the course_id backup folder exists in CFG->dataroot
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+        $info = $data->info;
+        // if necessary, write to restorelog and adjust date/time fields
+        if ($restore->course_startdateoffset) {
+            restore_log_date_changes('Database', $restore, $info['MOD']['#'], array('TIMEAVAILABLEFROM', 'TIMEAVAILABLETO','TIMEVIEWFROM', 'TIMEVIEWTO'));
+        }
         //traverse_xmlize($info);                                                                     //Debug
         //print_object ($GLOBALS['traverse_array']);                                                  //Debug
         //$GLOBALS['traverse_array']="";                                                              //Debug
@@ -65,30 +65,9 @@ function data_restore_mods($mod,$restore) {
         }
         $database->comments = backup_todb($info['MOD']['#']['COMMENTS']['0']['#']);
         $database->timeavailablefrom = backup_todb($info['MOD']['#']['TIMEAVAILABLEFROM']['0']['#']);
-        $date = usergetdate($database->timeavailablefrom);
-        fwrite ($restorelog_file,"<br>The Database - ".$database->name." <br>");
-        fwrite ($restorelog_file,"The TIMEAVAILABLEFROM was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year'].""); 
-        $database->timeavailablefrom += $restore->course_startdateoffset;
-        $date = usergetdate($database->timeavailablefrom);
-        fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TTIMEAVAILABLEFROM is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
         $database->timeavailableto = backup_todb($info['MOD']['#']['TIMEAVAILABLETO']['0']['#']);
-        $date = usergetdate($database->timeavailableto);
-        fwrite ($restorelog_file,"The TIMEAVAILABLETO was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year'].""); 
-        $database->timeavailableto += $restore->course_startdateoffset;
-        $date = usergetdate($database->timeavailableto);
-        fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEAVAILABLETO is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
         $database->timeviewfrom = backup_todb($info['MOD']['#']['TIMEVIEWFROM']['0']['#']);
-        $date = usergetdate($database->timeviewfrom);
-        fwrite ($restorelog_file,"The TIMEVIEWFROM was  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."");
-        $database->timeviewfrom += $restore->course_startdateoffset;
-        $date = usergetdate($database->timeviewfrom);
-        fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEVIEWFROM is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
         $database->timeviewto = backup_todb($info['MOD']['#']['TIMEVIEWTO']['0']['#']);
-        $date = usergetdate($database->timeviewto);
-        fwrite ($restorelog_file,"The TIMEVIEWTO was  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."");
-        $database->timeviewto += $restore->course_startdateoffset;
-        $date = usergetdate($database->timeviewto);
-        fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEVIEWTO is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
         // Only relevant for restoring backups from 1.6 in a 1.7 install.
         if (isset($info['MOD']['#']['PARTICIPANTS']['0']['#'])) {
             $database->participants = backup_todb($info['MOD']['#']['PARTICIPANTS']['0']['#']);
index eee4c9ab7c502507b698f5ccb1dd96f81b6974ca..a86b157e70886927c9ae32f89ed14c53951912e8 100644 (file)
         $data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);
 
         if ($data) {
-            //Now get completed xmlized object   
-            $info = $data->info; 
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");     
+            //Now get completed xmlized object
+            $info = $data->info;
+            // if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Exercise', $restore, $info['MOD']['#'], array('DEADLINE'));
+            }
             //traverse_xmlize($info);                                                              //Debug
             //print_object ($GLOBALS['traverse_array']);                                           //Debug
             //$GLOBALS['traverse_array']="";                                                       //Debug
index 38ed2716dc73c4c715e8fccfeb7ba70742df1463..4ed15447891d72a92b277094cf279928a37e9985 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Forum', $restore, $info['MOD']['#'], array('ASSESSTIMESTART', 'ASSESSTIMEFINISH'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             
             $forum->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);  
             $forum->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']);
-            $date = usergetdate($forum->assesstimestart);
-            fwrite ($restorelog_file,"<br>The Forum - ".$forum->name." <br>");
-            fwrite ($restorelog_file,"The ASSESSTIMESTART was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year'].""); 
-            $forum->assesstimestart += $restore->course_startdateoffset;
-            $date = usergetdate($forum->assesstimestart);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the ASSESSTIMESTART is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");         
             $forum->assesstimefinish = backup_todb($info['MOD']['#']['ASSESSTIMEFINISH']['0']['#']);
-            $date = usergetdate($forum->assesstimefinish);
-            fwrite ($restorelog_file,"The ASSESSTIMEFINISH was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year'].""); 
-            $forum->assesstimefinish += $restore->course_startdateoffset;
-            $date = usergetdate($forum->assesstimefinish);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the ASSESSTIMEFINISH is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $forum->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
             $forum->scale = backup_todb($info['MOD']['#']['SCALE']['0']['#']);
             $forum->forcesubscribe = backup_todb($info['MOD']['#']['FORCESUBSCRIBE']['0']['#']);
         if (!empty($info['MOD']['#']['DISCUSSIONS']['0']['#']['DISCUSSION'])) {
             $discussions = $info['MOD']['#']['DISCUSSIONS']['0']['#']['DISCUSSION'];
         }
-        //First, check the course_id backup folder exists in CFG->dataroot
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+
         //Iterate over discussions
         for($i = 0; $i < sizeof($discussions); $i++) {
             $dis_info = $discussions[$i];
             $discussion->groupid = backup_todb($dis_info['#']['GROUPID']['0']['#']);
             $discussion->assessed = backup_todb($dis_info['#']['ASSESSED']['0']['#']);
             $discussion->timemodified = backup_todb($dis_info['#']['TIMEMODIFIED']['0']['#']);
-            $date = usergetdate($discussion->timemodified);
-            fwrite ($restorelog_file,"<br>The Discussion - ".$discussion->name." <br>");
-            fwrite ($restorelog_file,"The Discussion TIMEMODIFIED was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year'].""); 
             $discussion->timemodified += $restore->course_startdateoffset;
-            $date = usergetdate($discussion->timemodified);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Discussion TIMEMODIFIED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $discussion->usermodified = backup_todb($dis_info['#']['USERMODIFIED']['0']['#']);  
             $discussion->timestart = backup_todb($dis_info['#']['TIMESTART']['0']['#']);
             $discussion->timestart += $restore->course_startdateoffset;
index 134426f48cf453426760b75b163b8210b8535beb..acbdb368bbd30f2999f8f27911e289ea059be86b 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            // if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Glossary', $restore, $info['MOD']['#'], array('ASSESSTIMESTART', 'ASSESSTIMEFINISH'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             $glossary->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
             $glossary->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']);
-            $date = usergetdate($glossary->assesstimestart);
-            fwrite ($restorelog_file,"<br>The Glossary - ".$glossary->name." <br>");
-            fwrite ($restorelog_file,"The Glossary ASSESSTIMESTART was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $glossary->assesstimestart += $restore->course_startdateoffset;
-            $date = usergetdate($glossary->assesstimestart);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Glossary ASSESSTIMESTART is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $glossary->assesstimefinish = backup_todb($info['MOD']['#']['ASSESSTIMEFINISH']['0']['#']);
-            $date = usergetdate($glossary->assesstimefinish);
-            fwrite ($restorelog_file,"The Glossary ASSESSTIMEFINISH was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $glossary->assesstimefinish += $restore->course_startdateoffset;
-            $date = usergetdate($glossary->assesstimefinish);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Glossary ASSESSTIMEFINISH is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $glossary->scale = backup_todb($info['MOD']['#']['SCALE']['0']['#']);
 
             //We have to recode the scale field if it's <0 (positive is a grade, not a scale)
index ff1d1842ec68b21da55bec3c915f71267121e903..140a388b0ff571eab7fb1e7c6043f3becfef3d1d 100644 (file)
@@ -108,9 +108,9 @@ function hotpot_restore_mods($mod, $restore) {
         }
 
         // if necessary, adjust HotPot date/time fields and write to restorelog
-        hotpot_restore_dates(
-            'Hotpot', $restore, $xml, array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED')
-        );  
+        if ($restore->course_startdateoffset) {
+            restore_log_date_changes('Hotpot', $restore, $xml, array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED'));
+        }
 
         $status = hotpot_restore_records(
             $restore, $status, $xml, $table, $foreign_keys, $more_restore
@@ -479,39 +479,4 @@ function hotpot_restore_logs($restore, $log) {
     } // end switch
     return $status ? $log : false;
 }
-function hotpot_restore_dates($recordtype, &$restore, &$xml, $TAGS, $NAMETAG='NAME') {
-    global $CFG;
-    if (!empty($restore->course_startdateoffset)) {
-
-        // check course backup data directory exists
-        $course_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($course_dir, true);
-
-        // open $restorelog and start output for this HotPot
-        $restorelog = fopen("$course_dir/restorelog.html", "a");
-        fwrite ($restorelog, "<br>Hotpot - ".$xml['NAME'][0]['#']." <br>");
-
-        // loop through time fields
-        $TAGS = array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED');
-        foreach ($TAGS as $TAG) {
-
-            // check $TAG has a sensible value
-            if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#'])) {
-
-                // write old date to $restorelog
-                $value = $xml[$TAG][0]['#'];
-                $date = usergetdate($value);
-                fwrite ($restorelog, "$TAG was ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']);
-
-                // write new date to $restorelog
-                $value += $restore->course_startdateoffset;
-                $date = usergetdate($value);
-                fwrite ($restorelog, "&nbsp;&nbsp;&nbsp;$TAG is now ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
-
-                // update $value in $xml tree (as a string)
-                $xml[$TAG][0]['#'] = "$value";
-            }
-        }
-    }
-}
 ?>
index a8eb0276cb69a2f4683ac6ce4ad72165cd1c4e86..ce8ff0f3bf7d0208c07e0f7121562e817392d7e0 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Journal', $restore, $info['MOD']['#'], array('TIMEMODIFIED'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $journal->days = backup_todb($info['MOD']['#']['DAYS']['0']['#']);
             $journal->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
             $journal->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
-            $date = usergetdate($journal->timemodified);
-            fwrite ($restorelog_file,"<br>The Journal - ".$journal->name." <br>");
-            fwrite ($restorelog_file,"The Journal TIMEMODIFIED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $journal->timemodified += $restore->course_startdateoffset;
-            $date = usergetdate($journal->timemodified);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Journal TTIMEMODIFIED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
 
             //We have to recode the assessed field if it is <0 (scale)
             if ($journal->assessed < 0) {
 
         //Get the entries array
         $entries = $info['MOD']['#']['ENTRIES']['0']['#']['ENTRY'];
-        //First, check the course_id backup folder exists in CFG->dataroot
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+
         //Iterate over entries
         for($i = 0; $i < sizeof($entries); $i++) {
             $entry_info = $entries[$i];
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
-            //We'll need this later!!
-            $oldid = backup_todb($sub_info['#']['ID']['0']['#']);
-            $olduserid = backup_todb($sub_info['#']['USERID']['0']['#']);
+            //We'll need this later!! $sub_info changed to $entry_info
+            $oldid = backup_todb($entry_info['#']['ID']['0']['#']);
+            $olduserid = backup_todb($entry_info['#']['USERID']['0']['#']);
 
             //Now, build the JOURNAL_ENTRIES record structure
             $entry->journal = $new_journal_id;
-            $entry->userid = backup_todb($entry_info['#']['USERID']['0']['#']);  
+            $entry->userid = backup_todb($entry_info['#']['USERID']['0']['#']);
             $entry->modified = backup_todb($entry_info['#']['MODIFIED']['0']['#']);
-            $date = usergetdate($entry->modified);
-            fwrite ($restorelog_file,"The Entry -".$entry->journal."- MODIFIED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
             $entry->modified += $restore->course_startdateoffset;
-            $date = usergetdate($entry->modified);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Entry MODIFIED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $entry->text = backup_todb($entry_info['#']['TEXT']['0']['#']);
             $entry->format = backup_todb($entry_info['#']['FORMAT']['0']['#']);
             $entry->rating = backup_todb($entry_info['#']['RATING']['0']['#']);
             }
             $entry->teacher = backup_todb($entry_info['#']['TEACHER']['0']['#']);
             $entry->timemarked = backup_todb($entry_info['#']['TIMEMARKED']['0']['#']);
-            $date = usergetdate($entry->timemarked);
-            fwrite ($restorelog_file,"The Entry -".$entry->journal."- TIMEMARKED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
             $entry->timemarked += $restore->course_startdateoffset;
-            $date = usergetdate($entry->timemarked);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Entry TIMEMARKED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $entry->mailed = backup_todb($entry_info['#']['MAILED']['0']['#']);
 
             //We have to recode the userid field
index 4808a73ade5f516923db75169506b7cf557548cb..c42174a2aae37d51a348ceb6e5f611be7b724174 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Lesson', $restore, $info['MOD']['#'], array('AVAILABLE', 'DEADLINE'));
+            }
             //traverse_xmlize($info);                                                              //Debug
             //print_object ($GLOBALS['traverse_array']);                                           //Debug
             //$GLOBALS['traverse_array']="";                                                       //Debug
             $lesson->displayleftif = isset($info['MOD']['#']['DISPLAYLEFTIF']['0']['#'])?backup_todb($info['MOD']['#']['DISPLAYLEFTIF']['0']['#']):'';
             $lesson->progressbar = isset($info['MOD']['#']['PROGRESSBAR']['0']['#'])?backup_todb($info['MOD']['#']['PROGRESSBAR']['0']['#']):'';
             $lesson->highscores = backup_todb($info['MOD']['#']['SHOWHIGHSCORES']['0']['#']);
-            $lesson->maxhighscores = backup_todb($info['MOD']['#']['MAXHIGHSCORES']['0']['#']);  
+            $lesson->maxhighscores = backup_todb($info['MOD']['#']['MAXHIGHSCORES']['0']['#']);
             $lesson->available = backup_todb($info['MOD']['#']['AVAILABLE']['0']['#']);
-            $date = usergetdate($lesson->available);
-            fwrite ($restorelog_file,"<br>The Lesson - ".$lesson->name." <br>");
-            fwrite ($restorelog_file,"The Time AVAILABLE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $lesson->available += $restore->course_startdateoffset;
-            $date = usergetdate($lesson->available);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Time AVAILABLE is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $lesson->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
-            $date = usergetdate($lesson->deadline);
-            fwrite ($restorelog_file,"The DEADLINE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $lesson->deadline += $restore->course_startdateoffset;
-            $date = usergetdate($lesson->deadline);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the DEADLINE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $lesson->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
 
             //The structure is equal to the db, so insert the lesson
index 447f49bcbe1a70d199f4e2a9cdc1a1358f3695fc..e745d6ad642001ebda70b364d4a8c124f2beec9c 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Quiz', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
+            }            
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $quiz->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
             $quiz->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']); 
             $quiz->timeopen = backup_todb($info['MOD']['#']['TIMEOPEN']['0']['#']);
-            $date = usergetdate($quiz->timeopen);
-            fwrite ($restorelog_file,"<br>The Quiz - ".$quiz->name." <br>");
-            fwrite ($restorelog_file,"The TIMEOPEN was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $quiz->timeopen += $restore->course_startdateoffset;
-            $date = usergetdate($quiz->timeopen);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEOPEN is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $quiz->timeclose = backup_todb($info['MOD']['#']['TIMECLOSE']['0']['#']);
-            $date = usergetdate($quiz->timeclose);
-            fwrite ($restorelog_file,"The TIMECLOSE was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $quiz->timeclose += $restore->course_startdateoffset;
-            $date = usergetdate($quiz->timeclose);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMECLOSE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br><br>");
             $quiz->optionflags = backup_todb($info['MOD']['#']['OPTIONFLAGS']['0']['#']);
             $quiz->penaltyscheme = backup_todb($info['MOD']['#']['PENALTYSCHEME']['0']['#']);
             $quiz->attempts = backup_todb($info['MOD']['#']['ATTEMPTS_NUMBER']['0']['#']);
index 239ecea0265aeee3d71151877f5efc17fbd02e20..68b1c5b3ee901cf7b5782d0996fcd7c4cb3f6812 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Quiz', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
+            }            
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $quiz->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
             $quiz->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
             $quiz->timeopen = backup_todb($info['MOD']['#']['TIMEOPEN']['0']['#']);
-            $date = usergetdate($quiz->timeopen);
-            fwrite ($restorelog_file,"The Quiz Named - ".$quiz->name." <br>");
-            fwrite ($restorelog_file,"The Original Time Open was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $quiz->timeopen += $restore->course_startdateoffset;
-            $date = usergetdate($quiz->timeopen);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;Time Open is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $quiz->timeclose = backup_todb($info['MOD']['#']['TIMECLOSE']['0']['#']);
-            $date = usergetdate($quiz->timeclose);
-            fwrite ($restorelog_file,"The Original Time Close was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $quiz->timeclose += $restore->course_startdateoffset;
-            $date = usergetdate($quiz->timeclose);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;Time Close is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br><br>");
             $quiz->attempts = backup_todb($info['MOD']['#']['ATTEMPTS_NUMBER']['0']['#']);
             $quiz->attemptonlast = backup_todb($info['MOD']['#']['ATTEMPTONLAST']['0']['#']);
             $quiz->feedback = backup_todb($info['MOD']['#']['FEEDBACK']['0']['#']);
index 09d5c14e82f407568571bedff2e648096e2eecd1..a696be04ac11ff239f2c2de733f9deea9cac65c0 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Wiki', $restore, $info['MOD']['#'], array('TIMEMODIFIED'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $wiki->revertchanges = backup_todb($info['MOD']['#']['REVERTCHANGES']['0']['#']);
             $wiki->initialcontent = backup_todb($info['MOD']['#']['INITIALCONTENT']['0']['#']);
             $wiki->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
-            $date = usergetdate($wiki->timemodified);
-            fwrite ($restorelog_file,"The Wiki - ".$wiki->name." <br>");
-            $status = fwrite ($restorelog_file,"The Wiki TIMEMODIFIED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $wiki->timemodified += $restore->course_startdateoffset;
-            $date = usergetdate($wiki->timemodified);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Wiki TIMEMODIFIED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
 
             //The structure is equal to the db, so insert the wiki
             $newid = insert_record ("wiki",$wiki);
 
         //Get the entries array
         $entries = $info['MOD']['#']['ENTRIES']['0']['#']['ENTRY'];
-        //First, check the course_id backup folder exists in CFG->dataroot
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+
         //Iterate over entries
         for($i = 0; $i < sizeof($entries); $i++) {
             $ent_info = $entries[$i];
             $entry->groupid = backup_todb($ent_info['#']['GROUPID']['0']['#']);
             $entry->pagename = backup_todb($ent_info['#']['PAGENAME']['0']['#']);
             $entry->timemodified = backup_todb($ent_info['#']['TIMEMODIFIED']['0']['#']);
-            $date = usergetdate($entry->timemodified);
-            fwrite ($restorelog_file,"The Entry TIMEMODIFIED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
             $entry->timemodified += $restore->course_startdateoffset;
-            $date = usergetdate($entry->timemodified);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;The Entry TIMEMODIFIED is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br><br>");
             //We have to recode the userid field
             $user = backup_getid($restore->backup_unique_code,"user",$entry->userid);
             if ($user) {
index edf66fbf9282746f971a80991ff75cf4a0d72545..bc9a12bc3b19aa60eaf6b570501b6418b6608a01 100644 (file)
         if ($data) {
             //Now get completed xmlized object   
             $info = $data->info;
-            //First, check the course_id backup folder exists in CFG->dataroot
-            $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-            check_dir_exists($dest_dir,true);
-            $restorelog_file = fopen("$dest_dir/restorelog.html","a");
+            //if necessary, write to restorelog and adjust date/time fields
+            if ($restore->course_startdateoffset) {
+                restore_log_date_changes('Workshop', $restore, $info['MOD']['#'], array('SUBMISSIONSTART','ASSESSMENTSTART', 'SUBMISSIONEND', 'ASSESSMENTEND', 'RELEASEGRADES'));
+            }
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $workshop->includeself = backup_todb($info['MOD']['#']['INCLUDESELF']['0']['#']);
             $workshop->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
             $workshop->submissionstart = backup_todb($info['MOD']['#']['SUBMISSIONSTART']['0']['#']);
-            $date = usergetdate($workshop->submissionstart);
-            fwrite ($restorelog_file,"<br>The Workshop - ".$workshop->name." <br>");
-            fwrite ($restorelog_file,"The SUBMISSIONSTART time was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $workshop->submissionstart  += $restore->course_startdateoffset;
-            $date = usergetdate($workshop->submissionstart);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the SUBMISSIONSTART time is now " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $workshop->assessmentstart = backup_todb($info['MOD']['#']['ASSESSMENTSTART']['0']['#']);
-            $date = usergetdate($workshop->assessmentstart);
-            fwrite ($restorelog_file,"The ASSESSMENTSTART time was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $workshop->assessmentstart  += $restore->course_startdateoffset;
-            $date = usergetdate($workshop->assessmentstart);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the ASSESSMENTSTART time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $workshop->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
             $workshop->submissionend = backup_todb($info['MOD']['#']['SUBMISSIONEND']['0']['#']);
-            $date = usergetdate($workshop->submissionend);
-            fwrite ($restorelog_file,"The SUBMISSIONEND time was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $workshop->submissionend  += $restore->course_startdateoffset;
-            $date = usergetdate($workshop->submissionend);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the SUBMISSIONEND time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $workshop->assessmentend = backup_todb($info['MOD']['#']['ASSESSMENTEND']['0']['#']);
-            $date = usergetdate($workshop->assessmentend);
-            fwrite ($restorelog_file,"The ASSESSMENTEND time was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $workshop->assessmentend  += $restore->course_startdateoffset;
-            $date = usergetdate($workshop->assessmentend);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the ASSESSMENTEND time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $workshop->releasegrades = backup_todb($info['MOD']['#']['RELEASEGRADES']['0']['#']);
-            $date = usergetdate($workshop->releasegrades);
-            fwrite ($restorelog_file,"The RELEASEGRADES time was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
-            $workshop->releasegrades  += $restore->course_startdateoffset;
-            $date = usergetdate($workshop->releasegrades);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the RELEASEGRADES time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
             $workshop->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
             $workshop->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']);
             $workshop->ntassessments = backup_todb($info['MOD']['#']['NTASSESSMENTS']['0']['#']);
 
         //Get the submissions array 
         $submissions = $info['MOD']['#']['SUBMISSIONS']['0']['#']['SUBMISSION'];
-        //First, we check the course_id backup folder exists in CFG->dataroot
-        $dest_dir = $CFG->dataroot."/".$restore->course_id."/backupdata";
-        check_dir_exists($dest_dir,true);
-        $restorelog_file = fopen("$dest_dir/restorelog.html","a");            
+            
         //Iterate over submissions
         for($i = 0; $i < sizeof($submissions); $i++) {
             $sub_info = $submissions[$i];
             $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);
             $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']); 
             $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);
-            $date = usergetdate($submission->timecreated);
-            fwrite ($restorelog_file,"The Submission - ".$submission->title. " - TIMECREATED was " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
             $submission->timecreated += $restore->course_startdateoffset;
-            $date = usergetdate($submission->timecreated);
-            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the Submission TIMECREATED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>"); 
             $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']);
             $submission->description = backup_todb($sub_info['#']['DESCRIPTION']['0']['#']);
             $submission->gradinggrade = backup_todb($sub_info['#']['GRADINGGRADE']['0']['#']);
index e8fa4c54e60b76f299ca1c3385d64be189b83ffb..a37cc39a4f6f04adcfdad40c8c57dc176068dbd2 100644 (file)
@@ -1,9 +1,13 @@
 body {
   font-size: 100%;
   color: #333333;
-  font-family: georgia, times, serif;
+  font-family: 'Bitstream Vera Serif', georgia, times, serif;
   margin: 0;
-  padding: 5px 10px 10px;
+  padding: 0;
+}
+div#page {
+  margin: 0 10px;
+  padding-top: 5px;
   border-top-width: 10px;
   border-top-style: solid;
   border-top-color: #55CC00;
@@ -341,3 +345,6 @@ fieldset.adminsettings {
   border-style: solid;
   border-color: #FFFFFF #DDDDDD #DDDDDD #FFFFFF;
 }
+form.mform div.textarea textarea {
+  width: 35em;
+}