From 10672458f952b6eb2272f9e9a740af5683e24b46 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 17 Feb 2004 17:27:27 +0000 Subject: [PATCH] Now "attempt", "submit" and "review" actions use the q=xxx&attempt=yyyy syntax instead of id=xxxx&attempt=yyyy (not working old one) It's necessary to change the "review" add_to_log() call to use this sintax. It uses the old (nor working) one. I wait to Martin to do this, because I've sent one email about this. For info, the line to correct is number 57 in review.php from: add_to_log($course->id, "quiz", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", "$cm->id"); to: add_to_log($course->id, "quiz", "review", "review.php?q=$quiz->id&attempt=$attempt->id", "$quiz->id", "$cm->id"); Ciao :-) --- mod/quiz/restorelib.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index c9edc53c8db..d72c2bba80d 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -1604,9 +1604,15 @@ //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 = "attempt.php?id=".$log->cmid; - $log->info = $mod->new_id; - $status = true; + //Extract the attempt id from the url field + $attid = substr(strrchr($log->url,"="),1); + //Get the new_id of the attempt (to recode the url field) + $att = backup_getid($restore->backup_unique_code,"quiz_attempts",$attid); + if ($att) { + $log->url = "review.php?q=".$mod->new_id."&attempt=".$att->new_id; + $log->info = $mod->new_id; + $status = true; + } } } break; @@ -1615,9 +1621,15 @@ //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 = "attempt.php?id=".$log->cmid; - $log->info = $mod->new_id; - $status = true; + //Extract the attempt id from the url field + $attid = substr(strrchr($log->url,"="),1); + //Get the new_id of the attempt (to recode the url field) + $att = backup_getid($restore->backup_unique_code,"quiz_attempts",$attid); + if ($att) { + $log->url = "review.php?q=".$mod->new_id."&attempt=".$att->new_id; + $log->info = $mod->new_id; + $status = true; + } } } break; @@ -1630,8 +1642,8 @@ $attid = substr(strrchr($log->url,"="),1); //Get the new_id of the attempt (to recode the url field) $att = backup_getid($restore->backup_unique_code,"quiz_attempts",$attid); - if ($mod) { - $log->url = "review.php?id=".$log->cmid."&attempt=".$att->new_id; + if ($att) { + $log->url = "review.php?q=".$mod->new_id."&attempt=".$att->new_id; $log->info = $mod->new_id; $status = true; }