From b1984b0d336d55bbb359b13f993568658f4808e2 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Mon, 9 Aug 2004 13:56:47 +0000 Subject: [PATCH] Added overidable method presave_process - allows last minute modification of data to be exported to file. Done to get xml output working. --- mod/quiz/format.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mod/quiz/format.php b/mod/quiz/format.php index 6f5d9c4456..5ab1d4e560 100644 --- a/mod/quiz/format.php +++ b/mod/quiz/format.php @@ -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 "

$count. ".stripslashes($question->questiontext)."

"; - $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; } -- 2.39.5