]> git.mjollnir.org Git - moodle.git/commitdiff
Added ability to specify destination category within GIFT file.
authorthepurpleblob <thepurpleblob>
Wed, 29 Nov 2006 13:34:32 +0000 (13:34 +0000)
committerthepurpleblob <thepurpleblob>
Wed, 29 Nov 2006 13:34:32 +0000 (13:34 +0000)
MDL-4163

question/format/gift/format.php

index f70574e924c3a53056ba544c4aece46176f99219..c48b6d4bb963128be686f4578a88e9e3d05e108c 100755 (executable)
@@ -142,6 +142,16 @@ class qformat_gift extends qformat_default {
         // Substitute escaped control characters with placeholders
         $text = $this->escapedchar_pre($text);
 
+        // Look for category modifier
+        if (ereg( '^\$CATEGORY:(.+)', $text, $matches)) {
+            $newcategory = $matches[1];
+
+            // build fake question to contain category
+            $question->qtype = 'category';
+            $question->category = $newcategory;
+            return $question;
+        }
+
         // QUESTION NAME parser
         if (substr($text, 0, 2) == "::") {
             $text = substr($text, 2);