]> git.mjollnir.org Git - moodle.git/commitdiff
Added overidable method presave_process - allows last minute modification of
authorthepurpleblob <thepurpleblob>
Mon, 9 Aug 2004 13:56:47 +0000 (13:56 +0000)
committerthepurpleblob <thepurpleblob>
Mon, 9 Aug 2004 13:56:47 +0000 (13:56 +0000)
data to be exported to file. Done to get xml output working.

mod/quiz/format.php

index 6f5d9c4456cb0e6af155dfa228dc3f27e1b83657..5ab1d4e56044bc404ffdf4b3ed683544af95bdbf 100644 (file)
@@ -164,6 +164,14 @@ class quiz_default_format {
         return true;
     }
 
+    function presave_process( $content ) {
+    /// enables any processing to be done on the content
+    /// just prior to the file being saved
+    /// default is to do nothing
+        return $content;
+    }
+
     function exportprocess($filename) {
     /// Exports a given category.  There's probably little need to change this
 
@@ -194,9 +202,12 @@ class quiz_default_format {
         foreach($questions as $question) {
           $count++;
           echo "<hr><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
-          $expout .= $this->writequestion( $question );
+          $expout .= $this->writequestion( $question ) . "\n";
           }
 
+        // final pre-process on exported data
+        $expout = $this->presave_process( $expout );
+
         // write file
         $filepath = $path."/".$filename . $this->export_file_extension();
         if (!$fh=fopen($filepath,"w")) {
@@ -212,8 +223,6 @@ class quiz_default_format {
 
     function exportpostprocess() {
     /// Does any post-processing that may be desired
-    /// Argument is a simple array of question ids that 
-    /// have just been added.
 
         return true;
     }