]> git.mjollnir.org Git - moodle.git/commitdiff
sort category question list by type then name as suggested in http://moodle.org/bugs...
authorgustav_delius <gustav_delius>
Wed, 29 Dec 2004 07:19:54 +0000 (07:19 +0000)
committergustav_delius <gustav_delius>
Wed, 29 Dec 2004 07:19:54 +0000 (07:19 +0000)
Also removed a PHP notice

mod/quiz/lib.php

index 929b4db0322f158ccfaf67b6d0d762f15b2d90d8..b8cbd867af378ab68e590c9233e7a721c6ed5b4c 100644 (file)
@@ -1421,7 +1421,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true) {
 
     echo '</center>';
 
-    if (!$questions = get_records("quiz_questions", "category", $category->id, "qtype ASC")) {
+    if (!$questions = get_records("quiz_questions", "category", $category->id, "qtype ASC, name ASC")) {
         echo "<p align=\"center\">";
         print_string("noquestions", "quiz");
         echo "</p>";
@@ -1925,12 +1925,13 @@ function get_questions_category( $category ) {
     $qresults = array();
 
     // get the list of questions for the category
-    $questions = get_records("quiz_questions","category",$category->id);
+    if ($questions = get_records("quiz_questions","category",$category->id)) {
 
-    // iterate through questions, getting stuff we need
-    foreach($questions as $question) {
-        $new_question = get_question_data( $question );
-        $qresults[] = $new_question;
+        // iterate through questions, getting stuff we need
+        foreach($questions as $question) {
+            $new_question = get_question_data( $question );
+            $qresults[] = $new_question;
+        }
     }
 
     return $qresults;