Complete work on Roll Forwards - Restore from previous semester (MDL-5532)

* 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
This commit is contained in:
thompson697
2006-09-13 13:19:39 +00:00
parent ea82d6b638
commit 163ff97e84
16 changed files with 308 additions and 25 deletions
+17 -1
View File
@@ -33,7 +33,12 @@
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
@@ -55,7 +60,18 @@
$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']['#']);