From: thepurpleblob <thepurpleblob>
Date: Thu, 26 Jul 2007 13:50:59 +0000 (+0000)
Subject: This new moodle_url thing (which is really confusing by the way)
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=46d798182ac2447430b71a9b3abf77c34e9eba66;p=moodle.git

This new moodle_url thing (which is really confusing by the way)
had broken the page. The selected category was being ignored.
Fixed, but possibly not in the most elegant way!!
---

diff --git a/question/export.php b/question/export.php
index 55c89197d2..57d0ede8e0 100644
--- a/question/export.php
+++ b/question/export.php
@@ -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;
@@ -39,8 +39,12 @@
         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); 
     }
     
@@ -57,11 +61,9 @@
     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