Skip to content
Browse files

Added functions to only display categories that the user is actually

allowed to edit. Used in question edit screens
  • Loading branch information...
1 parent 33bee34 commit 2ceec2d6be52acf32b610d59d283162478256b48 thepurpleblob committed Jun 18, 2004
Showing with 20 additions and 0 deletions.
  1. +20 −0 mod/quiz/lib.php
View
20 mod/quiz/lib.php
@@ -1331,6 +1331,26 @@ function quiz_print_category_form($course, $current) {
echo "</td></tr></table>";
}
+function quiz_category_select_menu($courseid,$published=false,$only_editable=false) {
+/// displays a select menu of categories with appended coursenames
+/// optionaly non editable categories may be excluded
+/// added Howard Miller June '04
+ // get sql fragment for published
+ $publishsql="";
+ if ($published) {
+ $publishsql = "or publish=1";
+ }
+ $categories = get_records_select("quiz_categories","course=$courseid $publishsql");
+ echo "<select name=\"category\">\n";
+ foreach ($categories as $category) {
+ $cid = $category->id;
+ $cname = quiz_get_category_coursename( $category );
+ if ((!$only_editable) || isteacheredit($category->course)) {
+ echo " <option value=\"$cid\">$cname</option>\n";
+ }
+ }
+ echo "</select>\n";
+}
function quiz_get_category_coursename($category) {
/// if the category is published, adds on the course

0 comments on commit 2ceec2d

Please sign in to comment.
Something went wrong with that request. Please try again.