Now logs from:

- Assignments
- Choices
- Workshops
are restored too.
This commit is contained in:
stronk7 2004-02-15 21:18:52 +00:00
parent 530931dd21
commit 0f318c26b4
5 changed files with 334 additions and 2 deletions

View File

@ -1359,7 +1359,7 @@
}
break;
default:
//echo "action (".$log->action.") unknow. Not restored<br>"; //Debug
echo "action (".$log->module."-".$log->action.") unknow. Not restored<br>"; //Debug
break;
}

View File

@ -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

View File

@ -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<br>"; //Debug
break;
}
if ($status) {
$status = $log;
}
return $status;
}
?>

View File

@ -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<br>"; //Debug
break;
}
if ($status) {
$status = $log;
}
return $status;
}
?>

View File

@ -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<br>"; //Debug
break;
}
if ($status) {
$status = $log;
}
return $status;
}
?>