From cf0b1faded301b142413b9aa00423fbc1d5eaf41 Mon Sep 17 00:00:00 2001 From: thompson697 Date: Tue, 17 Oct 2006 10:05:41 +0000 Subject: [PATCH] Apply modularity to the creation of the log file during restore to a new course. Remove the responsibility for loging the application of the course start date offset, from activity modules to the backup module. Merged from stable branch --- backup/restorelib.php | 77 ++++++++++++++++++++++++++++----- lang/en_utf8/moodle.php | 5 ++- mod/assignment/restorelib.php | 23 +++------- mod/chat/restorelib.php | 16 +++---- mod/choice/restorelib.php | 19 ++------ mod/data/restorelib.php | 31 +++---------- mod/exercise/restorelib.php | 12 ++--- mod/forum/restorelib.php | 29 +++---------- mod/glossary/restorelib.php | 19 ++------ mod/hotpot/restorelib.php | 41 ++---------------- mod/journal/restorelib.php | 35 ++++----------- mod/lesson/restorelib.php | 21 +++------ mod/quiz/restorelib.php | 19 ++------ mod/quiz/restorelibpre15.php | 19 ++------ mod/wiki/restorelib.php | 23 +++------- mod/workshop/restorelib.php | 43 +++--------------- theme/chameleon/user_styles.css | 11 ++++- 17 files changed, 150 insertions(+), 293 deletions(-) diff --git a/backup/restorelib.php b/backup/restorelib.php index ac1ce8dcd0..a64809bafe 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -2205,10 +2205,7 @@ //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) { @@ -2227,6 +2224,11 @@ //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']['#']); @@ -2239,11 +2241,6 @@ $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,"   the Event TIMESTART is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $eve->timeduration = backup_todb($info['EVENT']['#']['TIMEDURATION']['0']['#']); $eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']); $eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']); @@ -6259,5 +6256,65 @@ 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 diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 7726798ab0..9dd4b0ea7a 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -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'] = '   $a->TAG is now $a->weekday, $a->mday $a->month $a->year
\n'; +$string['backupdateold'] = '$a->TAG was $a->weekday, $a->mday $a->month $a->year\n'; +$string['backupdaterecordtype'] = '
$a->recordtype - $a->recordname
\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 diff --git a/mod/assignment/restorelib.php b/mod/assignment/restorelib.php index afc1f26856..6c7648e5e4 100644 --- a/mod/assignment/restorelib.php +++ b/mod/assignment/restorelib.php @@ -32,12 +32,12 @@ $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 @@ -59,18 +59,7 @@ $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,"
The Assignment - ".$assignment->name."
"); - 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,"   the TIMEDUE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMEAVAILABLE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $assignment->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']); $assignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']); diff --git a/mod/chat/restorelib.php b/mod/chat/restorelib.php index ca453297f7..41ab133fc0 100644 --- a/mod/chat/restorelib.php +++ b/mod/chat/restorelib.php @@ -34,14 +34,14 @@ 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']['#']); @@ -50,12 +50,6 @@ $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."
"); - 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,"   the CHATTIME is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."

"); $chat->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']); //The structure is equal to the db, so insert the chat diff --git a/mod/choice/restorelib.php b/mod/choice/restorelib.php index 06d0d8805d..44a6d4a7d8 100644 --- a/mod/choice/restorelib.php +++ b/mod/choice/restorelib.php @@ -39,10 +39,10 @@ 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 @@ -59,18 +59,7 @@ $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,"
The Choice - ".$choice->name."
"); - 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,"   The TIMEOPEN is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMECLOSE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $choice->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']); //To mantain compatibilty, in 1.4 the publish setting meaning has changed. We diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index 54f1c3c593..8e08a1e391 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -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,"
The Database - ".$database->name."
"); - 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,"   the TTIMEAVAILABLEFROM is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMEAVAILABLETO is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMEVIEWFROM is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMEVIEWTO is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); // 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']['#']); diff --git a/mod/exercise/restorelib.php b/mod/exercise/restorelib.php index eee4c9ab7c..a86b157e70 100644 --- a/mod/exercise/restorelib.php +++ b/mod/exercise/restorelib.php @@ -47,12 +47,12 @@ $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 diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index 38ed2716dc..4ed1544789 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -44,10 +44,10 @@ 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 @@ -70,18 +70,7 @@ $forum->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']); $forum->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']); - $date = usergetdate($forum->assesstimestart); - fwrite ($restorelog_file,"
The Forum - ".$forum->name."
"); - 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,"   the ASSESSTIMESTART is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the ASSESSTIMEFINISH is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $forum->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']); $forum->scale = backup_todb($info['MOD']['#']['SCALE']['0']['#']); $forum->forcesubscribe = backup_todb($info['MOD']['#']['FORCESUBSCRIBE']['0']['#']); @@ -270,10 +259,7 @@ 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]; @@ -294,12 +280,7 @@ $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,"
The Discussion - ".$discussion->name."
"); - 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,"   the Discussion TIMEMODIFIED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $discussion->usermodified = backup_todb($dis_info['#']['USERMODIFIED']['0']['#']); $discussion->timestart = backup_todb($dis_info['#']['TIMESTART']['0']['#']); $discussion->timestart += $restore->course_startdateoffset; diff --git a/mod/glossary/restorelib.php b/mod/glossary/restorelib.php index 134426f48c..acbdb368bb 100644 --- a/mod/glossary/restorelib.php +++ b/mod/glossary/restorelib.php @@ -41,10 +41,10 @@ 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 @@ -74,18 +74,7 @@ $glossary->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']); $glossary->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']); - $date = usergetdate($glossary->assesstimestart); - fwrite ($restorelog_file,"
The Glossary - ".$glossary->name."
"); - 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,"   the Glossary ASSESSTIMESTART is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the Glossary ASSESSTIMEFINISH is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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) diff --git a/mod/hotpot/restorelib.php b/mod/hotpot/restorelib.php index ff1d1842ec..140a388b0f 100644 --- a/mod/hotpot/restorelib.php +++ b/mod/hotpot/restorelib.php @@ -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, "
Hotpot - ".$xml['NAME'][0]['#']."
"); - - // 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, "   $TAG is now ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); - - // update $value in $xml tree (as a string) - $xml[$TAG][0]['#'] = "$value"; - } - } - } -} ?> diff --git a/mod/journal/restorelib.php b/mod/journal/restorelib.php index a8eb0276cb..ce8ff0f3bf 100644 --- a/mod/journal/restorelib.php +++ b/mod/journal/restorelib.php @@ -34,10 +34,10 @@ 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 @@ -50,12 +50,6 @@ $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,"
The Journal - ".$journal->name."
"); - 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,"   the Journal TTIMEMODIFIED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); //We have to recode the assessed field if it is <0 (scale) if ($journal->assessed < 0) { @@ -103,10 +97,7 @@ //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]; @@ -114,19 +105,15 @@ //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,"   the Entry MODIFIED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $entry->text = backup_todb($entry_info['#']['TEXT']['0']['#']); $entry->format = backup_todb($entry_info['#']['FORMAT']['0']['#']); $entry->rating = backup_todb($entry_info['#']['RATING']['0']['#']); @@ -137,11 +124,7 @@ } $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,"   the Entry TIMEMARKED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $entry->mailed = backup_todb($entry_info['#']['MAILED']['0']['#']); //We have to recode the userid field diff --git a/mod/lesson/restorelib.php b/mod/lesson/restorelib.php index 4808a73ade..c42174a2aa 100644 --- a/mod/lesson/restorelib.php +++ b/mod/lesson/restorelib.php @@ -51,10 +51,10 @@ 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 @@ -95,20 +95,9 @@ $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,"
The Lesson - ".$lesson->name."
"); - 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,"   the Time AVAILABLE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the DEADLINE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $lesson->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']); //The structure is equal to the db, so insert the lesson diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index 447f49bcbe..e745d6ad64 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -54,10 +54,10 @@ 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 @@ -68,18 +68,7 @@ $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 - ".$quiz->name."
"); - 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,"   the TIMEOPEN is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the TIMECLOSE is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."

"); $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']['#']); diff --git a/mod/quiz/restorelibpre15.php b/mod/quiz/restorelibpre15.php index 239ecea026..68b1c5b3ee 100644 --- a/mod/quiz/restorelibpre15.php +++ b/mod/quiz/restorelibpre15.php @@ -1226,10 +1226,10 @@ 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 @@ -1239,18 +1239,7 @@ $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."
"); - 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,"   Time Open is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   Time Close is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."

"); $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']['#']); diff --git a/mod/wiki/restorelib.php b/mod/wiki/restorelib.php index 09d5c14e82..a696be04ac 100644 --- a/mod/wiki/restorelib.php +++ b/mod/wiki/restorelib.php @@ -34,10 +34,10 @@ 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 @@ -58,12 +58,6 @@ $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."
"); - $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,"   the Wiki TIMEMODIFIED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); //The structure is equal to the db, so insert the wiki $newid = insert_record ("wiki",$wiki); @@ -102,10 +96,7 @@ //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]; @@ -123,11 +114,7 @@ $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,"   The Entry TIMEMODIFIED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."

"); //We have to recode the userid field $user = backup_getid($restore->backup_unique_code,"user",$entry->userid); if ($user) { diff --git a/mod/workshop/restorelib.php b/mod/workshop/restorelib.php index edf66fbf92..bc9a12bc3b 100644 --- a/mod/workshop/restorelib.php +++ b/mod/workshop/restorelib.php @@ -48,10 +48,10 @@ 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 @@ -73,37 +73,11 @@ $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,"
The Workshop - ".$workshop->name."
"); - 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,"   the SUBMISSIONSTART time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the ASSESSMENTSTART time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the SUBMISSIONEND time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the ASSESSMENTEND time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $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,"   the RELEASEGRADES time is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $workshop->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']); $workshop->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']); $workshop->ntassessments = backup_todb($info['MOD']['#']['NTASSESSMENTS']['0']['#']); @@ -351,10 +325,7 @@ //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]; @@ -371,11 +342,7 @@ $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,"   the Submission TIMECREATED is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']); $submission->description = backup_todb($sub_info['#']['DESCRIPTION']['0']['#']); $submission->gradinggrade = backup_todb($sub_info['#']['GRADINGGRADE']['0']['#']); diff --git a/theme/chameleon/user_styles.css b/theme/chameleon/user_styles.css index e8fa4c54e6..a37cc39a4f 100644 --- a/theme/chameleon/user_styles.css +++ b/theme/chameleon/user_styles.css @@ -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; +} -- 2.39.5