Merge branch 'MDL-26369' of git://github.com/timhunt/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 14 Feb 2011 23:58:01 +0000 (00:58 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 14 Feb 2011 23:58:01 +0000 (00:58 +0100)
mod/quiz/locallib.php

index e085c18..0fbb7d1 100644 (file)
@@ -916,7 +916,8 @@ function quiz_get_reviewoptions($quiz, $attempt, $context) {
     }
 
     // Show a link to the comment box only for closed attempts
-    if ($attempt->timefinish && has_capability('mod/quiz:grade', $context)) {
+    if (!empty($attempt->id) && $attempt->timefinish &&
+            has_capability('mod/quiz:grade', $context)) {
         $options->questioncommentlink = new moodle_url('/mod/quiz/comment.php', array('attempt' => $attempt->id));
     }