]> git.mjollnir.org Git - moodle.git/commitdiff
Added hooks to qtype import/export
authorthepurpleblob <thepurpleblob>
Thu, 9 Aug 2007 14:12:12 +0000 (14:12 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 9 Aug 2007 14:12:12 +0000 (14:12 +0000)
question/format/gift/format.php

index b13e403daa21f85bce02486ca952f110a79ab9a2..662b885ef7dda4843e50a4633ff84b91a1495751 100755 (executable)
@@ -262,6 +262,10 @@ class qformat_gift extends qformat_default {
         }
 
         if (!isset($question->qtype)) {
+            // try for plugins
+            if ($question = $this->try_importing_using_qtypes( $lines, $question, $answertext )) {
+                return $question;
+            }
             $giftqtypenotset = get_string('giftqtypenotset','quiz');
             $this->error( $giftqtypenotset, $text );
             return false;
@@ -631,7 +635,13 @@ function writequestion( $question ) {
         $expout .= "// CLOZE type is not supported\n";
         break;
     default:
-        notify("No handler for qtype $question->qtype for GIFT export" );
+        // check for plugins
+        if ($out = $this->try_exporting_using_qtypes( $question->qtype, $question )) {
+            $expout .= $out;
+        }
+        else {
+            notify("No handler for qtype '$question->qtype' for GIFT export" );
+        }
     }
     // add empty line to delimit questions
     $expout .= "\n";