From 4fa7532c246a86f573b92ff1c0b9ffd5cc273de5 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 7 Jun 2003 06:08:45 +0000 Subject: [PATCH] Improved display of quiz listing to show the closing date, as well as direct links for the teacher to review attempts. Thanks, Scott Elliott! --- mod/quiz/index.php | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/mod/quiz/index.php b/mod/quiz/index.php index 6d691cfb4e..20b1e46742 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -42,18 +42,26 @@ $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); } @@ -74,14 +82,29 @@ $section = ""; } + $closequiz = userdate($quiz->timeclose); + + if (isteacher($course->id)) { + if ($allanswers = get_records("quiz_grades", "quiz", $quiz->id)) { + $answercount = count($allanswers); + $gradecol = "coursemodule\">" . + get_string("viewallanswers","quiz",$answercount).""; + } 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 "
"; + echo "
"; print_table($table); -- 2.39.5