]> git.mjollnir.org Git - moodle.git/commitdiff
Improved display of quiz listing to show the closing date, as well as
authormoodler <moodler>
Sat, 7 Jun 2003 06:08:45 +0000 (06:08 +0000)
committermoodler <moodler>
Sat, 7 Jun 2003 06:08:45 +0000 (06:08 +0000)
direct links for the teacher to review attempts.  Thanks, Scott Elliott!

mod/quiz/index.php

index 6d691cfb4e5f08a532ac2d227f2a00f2427dd0a3..20b1e46742442d6483cefd441f11aefdb51e40f0 100644 (file)
     $strweek  = get_string("week");
     $strtopic  = get_string("topic");
     $strbestgrade  = get_string("bestgrade", "quiz");
+    $strquizcloses = get_string("quizcloses", "quiz");
+    $strattempts = get_string("attempts", "quiz");
 
+    if (isteacher($course->id)) {
+        $gradecol = $strattempts;
+    } else {
+        $gradecol = $strbestgrade;
+    }
+  
     if ($course->format == "weeks") {
-        $table->head  = array ($strweek, $strname, $strbestgrade);
-        $table->align = array ("CENTER", "LEFT", "RIGHT");
+        $table->head  = array ($strweek, $strname, $strquizcloses, $gradecol);
+        $table->align = array ("center", "left", "left", "left");
         $table->width = array (10, "*", 10);
     } else if ($course->format == "topics") {
-        $table->head  = array ($strtopic, $strname, $strbestgrade);
-        $table->align = array ("CENTER", "LEFT", "RIGHT");
+        $table->head  = array ($strtopic, $strname, $strquizcloses, $gradecol);
+        $table->align = array ("center", "left", "left", "left");
         $table->width = array (10, "*", 10);
     } else {
-        $table->head  = array ($strname, $strbestgrade);
-        $table->align = array ("LEFT", "RIGHT");
+        $table->head  = array ($strname, $strquizcloses, $gradecol);
+        $table->align = array ("left", "left", "left");
         $table->width = array ("*", 10);
     }
 
             $section = "";
         }
 
+        $closequiz = userdate($quiz->timeclose);
+
+        if (isteacher($course->id)) {
+            if ($allanswers = get_records("quiz_grades", "quiz", $quiz->id)) {
+                $answercount = count($allanswers);
+                $gradecol = "<a href=\"report.php?id=$quiz->coursemodule\">" .
+                            get_string("viewallanswers","quiz",$answercount)."</a>";
+            } else {
+                $answercount = 0;
+                $gradecol = "";
+            }
+        } else { 
+            $gradecol = "$bestgrade / $quiz->grade";
+        }
+
         if ($course->format == "weeks" or $course->format == "topics") {
-            $table->data[] = array ($section, $link, "$bestgrade / $quiz->grade");
+            $table->data[] = array ($section, $link, $closequiz, $gradecol);
         } else {
-            $table->data[] = array ($link, "$bestgrade / $quiz->grade");
+            $table->data[] = array ($link, $closequiz, $gradecol);
         }
     }
 
-    echo "<BR>";
+    echo "<br />";
 
     print_table($table);