diff --git a/backup/restorelib.php b/backup/restorelib.php
index 5b7ffcfed42..8b7b2789f18 100644
--- a/backup/restorelib.php
+++ b/backup/restorelib.php
@@ -1359,7 +1359,7 @@
}
break;
default:
- //echo "action (".$log->action.") unknow. Not restored
"; //Debug
+ echo "action (".$log->module."-".$log->action.") unknow. Not restored
"; //Debug
break;
}
diff --git a/backup/version.php b/backup/version.php
index d60a3739e1e..10d5764a60f 100644
--- a/backup/version.php
+++ b/backup/version.php
@@ -5,6 +5,6 @@
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
-$backup_version = 2004021400; // The current version is a date (YYYYMMDDXX)
+$backup_version = 2004021500; // The current version is a date (YYYYMMDDXX)
$backup_release = "1.2 development"; // User-friendly version number
diff --git a/mod/assignment/restorelib.php b/mod/assignment/restorelib.php
index 4ba64b5436d..f93cc6cff07 100644
--- a/mod/assignment/restorelib.php
+++ b/mod/assignment/restorelib.php
@@ -215,4 +215,94 @@
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
"; //Debug
+ break;
+ }
+
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>
diff --git a/mod/choice/restorelib.php b/mod/choice/restorelib.php
index 4be35a645e8..ddca3f52d2f 100644
--- a/mod/choice/restorelib.php
+++ b/mod/choice/restorelib.php
@@ -139,5 +139,59 @@
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
"; //Debug
+ break;
+ }
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>
diff --git a/mod/workshop/restorelib.php b/mod/workshop/restorelib.php
index 642c3edb101..f94cf7634cd 100644
--- a/mod/workshop/restorelib.php
+++ b/mod/workshop/restorelib.php
@@ -510,4 +510,192 @@
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
"; //Debug
+ break;
+ }
+
+ if ($status) {
+ $status = $log;
+ }
+ return $status;
+ }
?>