Skip to content

Commit

Permalink
Added overidable method presave_process - allows last minute modifica…
Browse files Browse the repository at this point in the history
…tion of

data to be exported to file. Done to get xml output working.
  • Loading branch information
thepurpleblob committed Aug 9, 2004
1 parent 29a95fe commit b1984b0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mod/quiz/format.php
Expand Up @@ -164,6 +164,14 @@ function exportpreprocess($category, $course) {
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

Expand Down Expand Up @@ -194,9 +202,12 @@ function exportprocess($filename) {
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")) {
Expand All @@ -212,8 +223,6 @@ function exportprocess($filename) {

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;
}
Expand Down

0 comments on commit b1984b0

Please sign in to comment.