]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7913\rImproved category detection (again) to extract all characters.
authorthepurpleblob <thepurpleblob>
Fri, 5 Jan 2007 10:35:13 +0000 (10:35 +0000)
committerthepurpleblob <thepurpleblob>
Fri, 5 Jan 2007 10:35:13 +0000 (10:35 +0000)
question/format/gift/format.php

index fc6e3fe2668eefa4dd1e46aa9df6a2ff8741629e..ae0dfe46d6beea7e468d4e2609bf609a504a56ee 100755 (executable)
@@ -1,5 +1,5 @@
+
 <?php // $Id$
-//
 ///////////////////////////////////////////////////////////////
 // The GIFT import filter was designed as an easy to use method 
 // for teachers writing questions as a text file. It supports most
@@ -141,14 +141,17 @@ class qformat_gift extends qformat_default {
         $text = $this->escapedchar_pre($text);
 
         // Look for category modifier
-        if (ereg( '^\$CATEGORY: *([A-Za-z0-9/]+)[[:space:]]', $text, $matches)) {
-            $newcategory = $matches[1];
+        if (ereg( '^\$CATEGORY:', $text)) {
+            // $newcategory = $matches[1];
+            $newcategory = trim(substr( $text, 10 ));
 
             // build fake question to contain category
             $question->qtype = 'category';
             $question->category = $newcategory;
             return $question;
         }
+        
+        
 
         // QUESTION NAME parser
         if (substr($text, 0, 2) == "::") {