]> git.mjollnir.org Git - moodle.git/commitdiff
Fix for the way question texts were displayed bug 1381
authormoodler <moodler>
Thu, 13 May 2004 08:46:25 +0000 (08:46 +0000)
committermoodler <moodler>
Thu, 13 May 2004 08:46:25 +0000 (08:46 +0000)
mod/quiz/report/simplestat/report.php

index ce10b0f6b6c9e8fd8c4de2ec8f61b80075e99c47..c1edd3522a6e7022bfc89662c10e60bb5edc64ac 100644 (file)
@@ -27,6 +27,12 @@ class quiz_report extends quiz_default_report {
         $data = array();
         $questionorder = explode(',', $quiz->questions);
 
+        $count = 0;
+        foreach ($questionorder as $questionid) {
+            $count++;
+            $question[$count] = get_record("quiz_questions", "id", $questionid);
+        }
+
     /// For each person in the class, get their best attempt
     /// and create a table listing results for each person
         if ($users) {
@@ -55,7 +61,6 @@ class quiz_report extends quiz_default_report {
                 foreach ($questionorder as $questionid) {
                     $count++;
                     $data[$user->id]->grades[$count] = $results->grades[$questionid];
-                    $question[$count] = $questions[$questionid];
                 }
             }
         }
@@ -198,12 +203,15 @@ class quiz_report extends quiz_default_report {
 
     /// Otherwise, display the table as HTML
 
-   
         echo "<table border=1 align=\"center\">";
         echo "<tr>";
         echo "<td>&nbsp;</td>";
         for ($i=1; $i<=$count; $i++) {
-            echo "<th title=\"".strip_tags($question[$i]->questiontext)."\">$i</th>";
+            $title = '';
+            if (!empty($question[$i]->questiontext)) {
+                $title = strip_tags($question[$i]->questiontext);
+            }
+            echo "<th title=\"$title\">$i</th>";
         }
         echo "</tr>";