]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11624 - /mod/quiz/index.php too dependant on individual course format names....
authortjhunt <tjhunt>
Wed, 31 Oct 2007 16:42:02 +0000 (16:42 +0000)
committertjhunt <tjhunt>
Wed, 31 Oct 2007 16:42:02 +0000 (16:42 +0000)
mod/quiz/index.php

index 54d19c736060f6b3ae1bc7228e4e905123aa6e46..f2581761d6190a05735d3950092fb71b136bb12e 100644 (file)
 // Configure table for displaying the list of instances.
     $headings = array(get_string('name'), get_string('quizcloses', 'quiz'));
     $align = array('left', 'left');
-    $colsize = array('', '');
-    if ($course->format == "weeks" || $course->format == "weekscss") {
+    if ($course->format == 'weeks' or $course->format == 'weekscss') {
         array_unshift($headings, get_string('week'));
-        array_unshift($align, 'center');
-        array_unshift($colsize, 10);
-    } else if ($course->format == "topics") {
-        array_unshift($headings, get_string('topic'));
-        array_unshift($align, 'center');
-        array_unshift($colsize, 10);
+    } else {
+        array_unshift($headings, get_string('section'));
     }
+    array_unshift($align, 'center');
 
     if (has_capability('mod/quiz:viewreports', $coursecontext)) {
         array_push($headings, get_string('attempts', 'quiz'));
         array_push($align, 'left');
-        array_push($colsize, '');
         $showing = 'stats';
     } else if (has_capability('mod/quiz:attempt', $coursecontext)) {
         array_push($headings, get_string('bestgrade', 'quiz'), get_string('feedback', 'quiz'));
         array_push($align, 'left', 'left');
-        array_push($colsize, '', '');
         $showing = 'scores';
     }
 
     $table->head = $headings;
     $table->align = $align;
-    $table->size = $colsize;
 
 // Poplate the table with the list of instances.
     $currentsection = '';
 
         // Section number if necessary.
         $strsection = '';
-        if ($course->format == "weeks" || $course->format == "weekscss" || $course->format == "topics") {
-            if ($quiz->section !== $currentsection) {
-                if ($quiz->section) {
-                    $strsection = $quiz->section;
-                }
-                if ($currentsection !== "") {
-                    $table->data[] = 'hr';
-                }
-                $currentsection = $quiz->section;
+        if ($quiz->section != $currentsection) {
+            if ($quiz->section) {
+                $strsection = $quiz->section;
+            }
+            if ($currentsection) {
+                $learningtable->data[] = 'hr';
             }
+            $currentsection = $quiz->section;
         }
         $data[] = $strsection;