]> git.mjollnir.org Git - moodle.git/commitdiff
Complete work on Roll Forwards - Restore from previous semester (MDL-5532)
authorthompson697 <thompson697>
Wed, 13 Sep 2006 13:19:39 +0000 (13:19 +0000)
committerthompson697 <thompson697>
Wed, 13 Sep 2006 13:19:39 +0000 (13:19 +0000)
* Add fields to restore form to enable changes to Short Name, Full Name and Start Date
* Start Date offset added to Restore process
* Created Restorelog file in Course files area
* Activity Modules use offset to change dates
* Activity Modules write changes to Restorelog

16 files changed:
.project [new file with mode: 0644]
backup/restore_check.html
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

diff --git a/.project b/.project
new file mode 100644 (file)
index 0000000..ef2de09
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>moodle17devw</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+       </buildSpec>
+       <natures>
+       </natures>
+</projectDescription>
index 3661d1dbb52f9c2134176a7d9f7a7d188008d89e..1f75e280e41d736261e888b34f228014658ab6f3 100644 (file)
 
     if ($form1 = data_submitted()); {
         $currentcourseshortname = $course_header->course_shortname; //"store_ShortName";
-        $course_header->course_shortname =  $form1->shortname;  //"update_ShortName";       
-        $course_header->course_fullname =   $form1->fullname;   //"update_FullName";   
+        $course_header->course_shortname =  $form1->shortname;  //"update_ShortName";    
+        $course_header->course_fullname =   $form1->fullname;   //"update_FullName";  
         $form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);          
-        $currentcoursestartdate = $course_header->course_startdate; 
+        $currentcoursestartdate = $course_header->course_startdate;
         $coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
         $restore->course_startdateoffset = $coursestartdatedateoffset; //change to restore
     } 
         $restore->course_files=$restore_course_files;
         $restore->messages=$restore_messages;
         $restore->course_id=$course_id;
-//add new vars to restore object 
+        //add new vars to restore object 
         $restore->course_startdateoffset = $coursestartdatedateoffset;
         $restore->course_shortname = $currentcourseshortname;
 
index ee255e0ec164856a9a766d8b1eccfa5edb8f66a4..a60f3249265d42c953ce193ddb80fc0f2d6735eb 100644 (file)
 
         if ($data) {
             //Now get completed xmlized object   
-            $info = $data->info;
+            $info = $data->info; 
+            //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //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 dddf7fec5a6fe409d8f191afb2c4579204c378df..40669b0a87da28ac3006dfc66d5ba5b997e08def 100644 (file)
 
         if ($data) {
             //Now get completed xmlized object   
-            $info = $data->info;
+            $info = $data->info; 
+            //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $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 83ab0461e7eda1c8314daab464c3ac435b637787..c9be13e200ea14fe5f0d54977a862fada8638b20 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");                        
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $choice->display = backup_todb($info['MOD']['#']['DISPLAY']['0']['#']);
             $choice->allowupdate = backup_todb($info['MOD']['#']['ALLOWUPDATE']['0']['#']);
             $choice->showunanswered = backup_todb($info['MOD']['#']['SHOWUNANSWERED']['0']['#']);
-            $choice->limitanswers = backup_todb($info['MOD']['#']['LIMITANSWERS']['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 080e8dca6bc17c0de76f0bc9e6c8ad47147521c4..4a830a3f73f680ed4fcda24791f50c0e4da8c0fd 100644 (file)
@@ -46,7 +46,12 @@ function data_restore_mods($mod,$restore) {
 
     if ($data) {
         //Now get completed xmlized object
-        $info = $data->info;
+        $info = $data->info; 
+        //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+        $dest_dir = $CFG->dataroot."/".$restore->course_id;
+        check_dir_exists($dest_dir,true);
+        $file = $dest_dir."/restorelog.html";
+        $restorelog_file = fopen($file,"a");        
         //traverse_xmlize($info);                                                                     //Debug
         //print_object ($GLOBALS['traverse_array']);                                                  //Debug
         //$GLOBALS['traverse_array']="";                                                              //Debug
@@ -58,9 +63,30 @@ function data_restore_mods($mod,$restore) {
         $database->ratings = backup_todb($info['MOD']['#']['RATINGS']['0']['#']);
         $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>");
         $database->participants = backup_todb($info['MOD']['#']['PARTICIPANTS']['0']['#']);
         $database->requiredentries = backup_todb($info['MOD']['#']['REQUIREDENTRIES']['0']['#']);
         $database->requiredentriestoview = backup_todb($info['MOD']['#']['REQUIREDENTRIESTOVIEW']['0']['#']);
index f5169415ff16806a73e1656d8249c61d2bd6b01f..4ea561ffe5544377d2266dfe4422ad1fff0c4c77 100644 (file)
 
         if ($data) {
             //Now get completed xmlized object   
-            $info = $data->info;
+            $info = $data->info; 
+            //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //traverse_xmlize($info);                                                              //Debug
             //print_object ($GLOBALS['traverse_array']);                                           //Debug
             //$GLOBALS['traverse_array']="";                                                       //Debug
             $exercise->usemaximum = backup_todb($info['MOD']['#']['USEMAXIMUM']['0']['#']);
             $exercise->assessmentcomps = backup_todb($info['MOD']['#']['ASSESSMENTCOMPS']['0']['#']);
             $exercise->anonymous = backup_todb($info['MOD']['#']['ANONYMOUS']['0']['#']);
-            $exercise->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
+            $exercise->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']); 
             $exercise->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
+            $date = usergetdate($exercise->deadline);
+            fwrite ($restorelog_file,"<br>The Exercise - ".$exercise->name." <br>");
+            fwrite ($restorelog_file,"The DEADLINE was  " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");            
+            $exercise->deadline += $restore->course_startdateoffset;
+            $date = usergetdate($exercise->deadline);
+            fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the DEADLINE is now  " .$date['weekday'].",  ".$date['mday']." ".$date['month']." ".$date['year']."<br>");         
             $exercise->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
             $exercise->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
             $exercise->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']);
index b1a4e6f86535619adf4028dcc11efaeeeff385dd..c37309c4a9b8b4fbd04273dc4004bbe12dc20a2f 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
                 $forum->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
             }
             
-            $forum->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
+            $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']['#']);
 
         //Get the discussions array
         $discussions = $info['MOD']['#']['DISCUSSIONS']['0']['#']['DISCUSSION'];
-
+        //First, we check that "course_id" folder exists and create is as necessary in CFG->dataroot
+        $dest_dir = $CFG->dataroot."/".$restore->course_id;
+        check_dir_exists($dest_dir,true);
+        $file = $dest_dir."/restorelog.html";
+        $restorelog_file = fopen($file,"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']['#']);
-            $discussion->usermodified = backup_todb($dis_info['#']['USERMODIFIED']['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;
             $discussion->timeend = backup_todb($dis_info['#']['TIMEEND']['0']['#']);
-
+            $discussion->timeend += $restore->course_startdateoffset;
             //We have to recode the userid field
             $user = backup_getid($restore->backup_unique_code,"user",$discussion->userid);
             if ($user) {
             //Now, build the FORUM_POSTS record structure
             $post->discussion = $discussion_id;
             $post->parent = backup_todb($pos_info['#']['PARENT']['0']['#']);
-            $post->userid = backup_todb($pos_info['#']['USERID']['0']['#']);
+            $post->userid = backup_todb($pos_info['#']['USERID']['0']['#']);   
             $post->created = backup_todb($pos_info['#']['CREATED']['0']['#']);
+            $post->created += $restore->course_startdateoffset;
             $post->modified = backup_todb($pos_info['#']['MODIFIED']['0']['#']);
+            $post->modified += $restore->course_startdateoffset;             
             $post->mailed = backup_todb($pos_info['#']['MAILED']['0']['#']);
             $post->subject = backup_todb($pos_info['#']['SUBJECT']['0']['#']);
             $post->message = backup_todb($pos_info['#']['MESSAGE']['0']['#']);
index a3b58fe185a2967bbfa1ac522de034d4240f2ee8..d234e5c57a2a312c7704fb8979008320ace8e04c 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //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 a702fe4cb4924022fb5a17a35ae529dee6165929..d975a30b4cd4e9af6b93d5be3136a480b2e0927f 100644 (file)
@@ -290,11 +290,16 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
 
     // maintain a cache of info on table columns
     static $table_columns = array();
+    global $CFG, $db; //move outside if - increase scope 
     if (empty($table_columns[$table])) {
-        global $CFG, $db;
         $table_columns[$table] = $db->MetaColumns("$CFG->prefix$table");
     }
-
+    //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+    //global $CFG;
+    $dest_dir = $CFG->dataroot."/".$restore->course_id;
+    check_dir_exists($dest_dir,true);
+    $file = $dest_dir."/restorelog.html";
+    $restorelog_file = fopen($file,"a");
     // get values for fields in this record
     $record = new stdClass();
     $TAGS = array_keys($xml);
@@ -302,6 +307,14 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
         $value = $xml[$TAG][0]['#'];
         if (is_string($value)) {
             $tag = strtolower($TAG);
+            if ($TAG == "TIMEOPEN" || $TAG == "TIMECLOSE" || $TAG == "TIMECREATED" ||$TAG == "TIMEMODIFIED"){
+                $date = usergetdate($value);
+                fwrite ($restorelog_file,"<br>The Hotpot - ".$record->name." <br>");
+                fwrite ($restorelog_file,"The date was ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."");
+                $value += $restore->course_startdateoffset;
+                $date = usergetdate($value);
+                fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the date is now ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
+            }
             $record->$tag = backup_todb($value);
         }
     }
index 2ac8a5ad7345f62a31a329b1129c32a13e1b9548..da1a426194caf1083bc994c52cee7fb5b4bfbb8a 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");
             //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, we check to "course_id" folder exists and create is as necessary in CFG->dataroot 
+        $dest_dir = $CFG->dataroot."/".$restore->course_id;
+        check_dir_exists($dest_dir,true);
+        $file = $dest_dir."/restorelog.html";
+        $restorelog_file = fopen($file,"a");
         //Iterate over entries
         for($i = 0; $i < sizeof($entries); $i++) {
             $entry_info = $entries[$i];
 
             //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->comment = backup_todb($entry_info['#']['COMMENT']['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 89adcb3652b209d3e4b3aa30194cfe0603f6e1be..6ed6137de70d36d3203c25927d5c7b5923f0a7db 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //traverse_xmlize($info);                                                              //Debug
             //print_object ($GLOBALS['traverse_array']);                                           //Debug
             //$GLOBALS['traverse_array']="";                                                       //Debug
             $lesson->displayleftif = backup_todb($info['MOD']['#']['DISPLAYLEFTIF']['0']['#']);
             $lesson->progressbar = 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 f1b666d55326873ee4dc35bb495722b3b6a9dd3e..fb44a866610b978a4947b491d587fca86aae1bce 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //traverse_xmlize($info);                                                                     //Debug
             //print_object ($GLOBALS['traverse_array']);                                                  //Debug
             //$GLOBALS['traverse_array']="";                                                              //Debug
             $quiz = new stdClass;
             $quiz->course = $restore->course_id;
             $quiz->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
-            $quiz->intro = backup_todb($info['MOD']['#']['INTRO']['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 823d1d216546d9f9bc17f5017c816bd997bb3a61..214db9b5b7fcf03ccbaeaa1e90747ede5148c6ae 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //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 8a016b0e5941e56ae75e2bca897c6b2d292d5bbd..3e9c753d7395867826b0683712d3796ed7794736 100644 (file)
         if ($data) {
             //Now get completed xmlized object
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");            
             //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, we check to "course_id" folder exists and create is as necessary in CFG->dataroot 
+        $dest_dir = $CFG->dataroot."/".$restore->course_id;
+        check_dir_exists($dest_dir,true);
+        $file = $dest_dir."/restorelog.html";
+        $restorelog_file = fopen($file,"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) {
             $page->author = backup_todb($pag_info['#']['AUTHOR']['0']['#']);
             $page->userid = backup_todb($pag_info['#']['USERID']['0']['#']);
             $page->created = backup_todb($pag_info['#']['CREATED']['0']['#']);
+            $page->created += $restore->course_startdateoffset;
             $page->lastmodified = backup_todb($pag_info['#']['LASTMODIFIED']['0']['#']);
+            $page->lastmodified += $restore->course_startdateoffset;
             $page->refs = str_replace("$@LINEFEED@$","\n",backup_todb($pag_info['#']['REFS']['0']['#']));
             $page->meta = backup_todb($pag_info['#']['META']['0']['#']);
             $page->hits = backup_todb($pag_info['#']['HITS']['0']['#']);
index 1bd107e83aef67751f229b8fa1a82acf0239d262..1258529fb8240913c64d1fcfafa02269bcce59ed 100644 (file)
         if ($data) {
             //Now get completed xmlized object   
             $info = $data->info;
+            //First, we check to "course_id" folder exists and create is as necessary in CFG->dataroot
+            $dest_dir = $CFG->dataroot."/".$restore->course_id;
+            check_dir_exists($dest_dir,true);
+            $file = $dest_dir."/restorelog.html";
+            $restorelog_file = fopen($file,"a");
             //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 to "course_id" folder exists and create is as necessary in CFG->dataroot
+        $dest_dir = $CFG->dataroot."/".$restore->course_id;
+        check_dir_exists($dest_dir,true);
+        $file = $dest_dir."/restorelog.html";
+        $restorelog_file = fopen($file,"a");
         //Iterate over submissions
         for($i = 0; $i < sizeof($submissions); $i++) {
             $sub_info = $submissions[$i];
             //Now, build the WORKSHOP_SUBMISSIONS record structure
             $submission->workshopid = $new_workshop_id;
             $submission->userid = backup_todb($sub_info['#']['USERID']['0']['#']);
-            $submission->title = backup_todb($sub_info['#']['TITLE']['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']['#']);