]> git.mjollnir.org Git - moodle.git/commitdiff
quiz: Check this is the users own attempt before sending them to the attempt.php...
authortjhunt <tjhunt>
Wed, 22 Jul 2009 09:25:46 +0000 (09:25 +0000)
committertjhunt <tjhunt>
Wed, 22 Jul 2009 09:25:46 +0000 (09:25 +0000)
mod/quiz/review.php

index 619f0a0b200b90f03e0d83d30b3a801856984caa..6fd122717002ede1dbdfce1b3e0db98e3ba1891d 100644 (file)
 
 /// Permissions checks for normal users who do not have quiz:viewreports capability.
     if (!$attemptobj->has_capability('mod/quiz:viewreports')) {
+    /// Can't review other users' attempts.
+        if (!$attemptobj->is_own_attempt()) {
+            quiz_error($attemptobj->get_quiz(), 'notyourattempt');
+        }
     /// Can't review during the attempt - send them back to the attempt page.
         if (!$attemptobj->is_finished()) {
             redirect($attemptobj->attempt_url(0, $page));
         }
-    /// Can't review other users' attempts.
-        if (!$attemptobj->is_own_attempt()) {
-            quiz_error($quiz, 'notyourattempt');
-        }
     /// Can't review unless Students may review -> Responses option is turned on.
         if (!$options->responses) {
             $accessmanager->back_to_view_page($attemptobj->is_preview_user(),
@@ -99,7 +99,6 @@
     }
 
 /// Print heading.
-    print_heading(format_string($attemptobj->get_quiz_name()));
     if ($attemptobj->is_preview_user() && $attemptobj->is_own_attempt()) {
         $attemptobj->print_restart_preview_button();
     }