]> git.mjollnir.org Git - moodle.git/commitdiff
Simplified a bit and removed a notice
authormoodler <moodler>
Sun, 24 Sep 2006 12:02:00 +0000 (12:02 +0000)
committermoodler <moodler>
Sun, 24 Sep 2006 12:02:00 +0000 (12:02 +0000)
mod/quiz/index.php

index 176a0ee070832f21e448b6eb3d1bb85999a5872b..0b04c265e149b3aa582adf91af00209315198d62 100644 (file)
 
         $closequiz = $quiz->timeclose ? userdate($quiz->timeclose) : '';
 
+        $gradecol = '';
+        $feedbackcol = '';
+
         if (has_capability('mod/quiz:viewreports', $context)) {
             if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
                 $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
                 $a->studentstring  = $course->students;
                 $gradecol = "<a href=\"report.php?mode=overview&amp;q=$quiz->id\">".get_string('numattempts', 'quiz', $a).'</a>';
-            } else {
-                $gradecol = "";
             }
         } else {
             // If student has no grade for this quiz, 
             // or the quiz has no grade, display nothing in grade col
-            if ($bestgrade === NULL || $quiz->grade == 0) {
-                $gradecol = "";
-                $feedbackcol = '';
-            } else {
+            if ($bestgrade !== NULL && $quiz->grade != 0) {
                 //If all quiz's attempts have visible results, show bestgrade
-                if(all_attempt_results_visible($quiz, $USER)) {
+                if (all_attempt_results_visible($quiz, $USER)) {
                     $gradecol = "$bestgrade / $quiz->grade";
                     $feedbackcol = quiz_get_feedback($quiz, $bestgrade);
-                } else {
-                    $gradecol = "";
-                    $feedbackcol = '';
                 }
             }
         }
         }
     }
 
-    echo "<br />";
+    echo '<br />';
 
     print_table($table);
 
 
     print_footer($course);
 
-?>
\ No newline at end of file
+?>