From: moodler Date: Wed, 21 Jan 2004 16:04:55 +0000 (+0000) Subject: Only list categories that belong to real courses X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=facbf40f92940f786f9cece545543d6391867cfa;p=moodle.git Only list categories that belong to real courses --- diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index feba601e30..7ab8c9fabb 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1066,7 +1066,7 @@ function quiz_get_category_menu($courseid, $published=false) { function quiz_print_category_form($course, $current) { // Prints a form to choose categories - if (!$categories = get_records_select("quiz_categories", "course='$course->id' OR publish = '1'", "name ASC")) { + if (!$categories = get_records_select("quiz_categories", "course = '$course->id' OR publish = '1'", "name ASC")) { if (!$category = quiz_get_default_category($course->id)) { notify("Error creating a default category!"); return false; @@ -1074,12 +1074,12 @@ function quiz_print_category_form($course, $current) { $categories[$category->id] = $category; } foreach ($categories as $key => $category) { - if ($category->publish) { - if ($catcourse = get_record("course", "id", $category->course)) { + if ($catcourse = get_record("course", "id", $category->course)) { + if ($category->publish) { $category->name .= " ($catcourse->shortname)"; } + $catmenu[$category->id] = $category->name; } - $catmenu[$category->id] = $category->name; } $strcategory = get_string("category", "quiz"); $strshow = get_string("show", "quiz");