return $status;
}
+
+//This function returns a log record with all the necessay transformations
+ //done. It's used by restore_log_module() to restore modules log.
+ function assignment_restore_logs($restore,$log) {
+
+ $status = false;
+
+ //Depending of the action, we recode different things
+ switch ($log->action) {
+ case "add":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "update":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view all":
+ $log->url = "index.php?id=".$log->course;
+ $status = true;
+ break;
+ case "upload":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?a=".$mod->new_id;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view submission":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "submissions.php?id=".$mod->new_id;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "update grades":
+ if ($log->cmid) {
+ //Extract the assignment id from the url field
+ $assid = substr(strrchr($log->url,"="),1);
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$assid);
+ if ($mod) {
+ $log->url = "submissions.php?id=".$mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ default:
+ echo "action (".$log->module."-".$log->action.") unknow. Not restored<br>"; //Debug
+ break;
+ }
+
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>
return $status;
}
+ //This function returns a log record with all the necessay transformations
+ //done. It's used by restore_log_module() to restore modules log.
+ function choice_restore_logs($restore,$log) {
+
+ $status = false;
+
+ //Depending of the action, we recode different things
+ switch ($log->action) {
+ case "add":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "update":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view all":
+ $log->url = "index.php?id=".$log->course;
+ $status = true;
+ break;
+ default:
+ echo "action (".$log->module."-".$log->action.") unknow. Not restored<br>"; //Debug
+ break;
+ }
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>
return $status;
}
+
+ //This function returns a log record with all the necessay transformations
+ //done. It's used by restore_log_module() to restore modules log.
+ function workshop_restore_logs($restore,$log) {
+
+ $status = false;
+
+ //Depending of the action, we recode different things
+ switch ($log->action) {
+ case "add":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "update":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "view all":
+ $log->url = "index.php?id=".$log->course;
+ $status = true;
+ break;
+ case "submit":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "resubmit":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "league table":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "submissions":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "allow both":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "set up":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "assessments onl":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "close":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "display grades":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "over allocation":
+ if ($log->cmid) {
+ //Get the new_id of the module (to recode the info field)
+ $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
+ if ($mod) {
+ $log->url = "view.php?id=".$log->cmid;
+ $log->info = $mod->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "assess":
+ if ($log->cmid) {
+ //Get the new_id of the workshop assessments
+ $ass = backup_getid($restore->backup_unique_code,"workshop_assessments",$log->info);
+ if ($ass) {
+ $log->url = "assessments.php?action=viewassessment&id=".$log->cmid."&aid=".$ass->new_id;
+ $log->info = $ass->new_id;
+ $status = true;
+ }
+ }
+ break;
+ case "grade":
+ if ($log->cmid) {
+ //Get the new_id of the workshop assessments
+ $ass = backup_getid($restore->backup_unique_code,"workshop_assessments",$log->info);
+ if ($ass) {
+ $log->url = "assessments.php?action=viewassessment&id=".$log->cmid."&aid=".$ass->new_id;
+ $log->info = $ass->new_id;
+ $status = true;
+ }
+ }
+ break;
+ default:
+ echo "action (".$log->module."-".$log->action.") unknow. Not restored<br>"; //Debug
+ break;
+ }
+
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>