function quiz_print_category_form($course, $current) {
// Prints a form to choose categories
- if (!$categories = quiz_get_category_menu($course->id, true)) {
+ if (!$categories = get_records_sql("SELECT * FROM quiz_categories WHERE course='$course->id' OR publish = '1' ORDER by name ASC")) {
if (!$category = quiz_get_default_category($course->id)) {
notify("Error creating a default category!");
return false;
}
- $categories[$category->id] = $category->name;
}
foreach ($categories as $key => $category) {
if ($category->publish) {
- if ($course = get_record_sql("course", "id", $category->course)) {
- $categories[$key]->name .= " ($course->shortname)";
+ if ($catcourse = get_record("course", "id", $category->course)) {
+ $category->name .= " ($catcourse->shortname)";
}
}
+ $catmenu[$category->id] = $category->name;
}
$strcategory = get_string("category", "quiz");
$strshow = get_string("show", "quiz");
echo "<TABLE width=\"100%\"><TR><TD>";
echo "<FORM METHOD=POST ACTION=edit.php>";
echo "<B>$strcategory:</B> ";
- choose_from_menu($categories, "cat", "$current");
+ choose_from_menu($catmenu, "cat", "$current");
echo "<INPUT TYPE=submit VALUE=\"$strshow\">";
echo "</FORM>";
echo "</TD><TD align=right>";
}
+ make_upload_directory("$course->id"); // Just in case
$coursefiles = get_directory_list("$CFG->dataroot/$course->id", $CFG->moddata);
foreach ($coursefiles as $filename) {
if (mimeinfo("icon", $filename) == "image.gif") {