]> git.mjollnir.org Git - moodle.git/commitdiff
Now "attempt", "submit" and "review" actions
authorstronk7 <stronk7>
Tue, 17 Feb 2004 17:27:27 +0000 (17:27 +0000)
committerstronk7 <stronk7>
Tue, 17 Feb 2004 17:27:27 +0000 (17:27 +0000)
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

index c9edc53c8db9143d8b3321c0a72ac1732f7ee59b..d72c2bba80d025f1d8ed999092edaa6369737632 100644 (file)
                 //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;
                 //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;
                     $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;
                     }