]> git.mjollnir.org Git - moodle.git/commitdiff
This new moodle_url thing (which is really confusing by the way)
authorthepurpleblob <thepurpleblob>
Thu, 26 Jul 2007 13:50:59 +0000 (13:50 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 26 Jul 2007 13:50:59 +0000 (13:50 +0000)
had broken the page. The selected category was being ignored.
Fixed, but possibly not in the most elegant way!!

question/export.php

index 55c89197d2af4d2a28e7ebd6045a3372cf45a890..57d0ede8e092dee88bc1d74ee747687749a2658a 100644 (file)
@@ -18,7 +18,7 @@
     
     $exportfilename = optional_param('exportfilename','',PARAM_FILE );
     $format = optional_param('format','', PARAM_FILE );
-
+    $categoryid = optional_param('category',0,PARAM_INT);
 
     // get display strings
     $txt = new object;
         error("Course does not exist!");
     }
 
+    // make sure we are using the user's most recent category choice
+    if (empty($categoryid)) {
+        $categoryid = $pagevars['cat'];
+    }
 
-    if (!$category = get_record("question_categories", "id", $pagevars['cat'])) {   
+    if (!$category = get_record("question_categories", "id", $categoryid)) {   
         $category = get_default_question_category($courseid); 
     }
     
     make_upload_directory( "$course->id" );
 
     // check category is valid
-    if (!empty($pagevars['cat'])) {
-        $validcats = question_category_options( $course->id, true, false );
-        if (!array_key_exists( $pagevars['cat'], $validcats)) {
-            print_error( 'invalidcategory','quiz' );
-        }
+    $validcats = question_category_options( $course->id, true, false );
+    if (!array_key_exists( $categoryid, $validcats)) {
+        print_error( 'invalidcategory','quiz' );
     }
 
     /// Header