From 53594cc653fb1265fff14a5bf565e8a6c39af497 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Wed, 20 Apr 2005 14:06:44 +0000 Subject: [PATCH] Export format to generate quiz category as page of xhtml. --- mod/quiz/format/xhtml/format.php | 127 +++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 mod/quiz/format/xhtml/format.php diff --git a/mod/quiz/format/xhtml/format.php b/mod/quiz/format/xhtml/format.php new file mode 100755 index 00000000000..3970ebd1de2 --- /dev/null +++ b/mod/quiz/format/xhtml/format.php @@ -0,0 +1,127 @@ +id; + + // add comment and div tags + $expout .= "\n"; + $expout .= "
\n"; + + // add header + $expout .= "

$question->name

\n"; + + // add question text + $expout .= "

$question->questiontext

\n"; + + // selection depends on question type + switch($question->qtype) { + case TRUEFALSE: + $st_true = get_string( 'true','quiz' ); + $st_false = get_string( 'false','quiz' ); + $expout .= "\n"; + break; + case MULTICHOICE: + $expout .= "\n"; + break; + case SHORTANSWER: + $expout .= "\n"; + break; + case NUMERICAL: + $expout .= '

\n'; + $expout .= " \n"; + $expout .= "

\n"; + break; + case MATCH: + $expout .= ""; + break; + case DESCRIPTION: + break; + case MULTIANSWER: + $expout .= "\n"; + break; + default: + notify("No handler for qtype $question->qtype for GIFT export" ); + } + // close off div + $expout .= "
\n\n\n"; + return $expout; +} + + +function presave_process( $content ) { + // override method to allow us to add xhtml headers and footers + + $xp = "\n"; + $xp .= "\n"; + $xp .= "\n"; + $xp .= "Moodle Quiz XHTML Export\n"; + $xp .= "\n"; + $xp .= "\n"; + $xp .= "
\n\n"; + $xp .= $content; + $xp .= "

\n"; + $xp .= " \n"; + $xp .= "

\n"; + $xp .= "
\n"; + $xp .= "\n"; + $xp .= "\n"; + + return $xp; +} + +function export_file_extension() { + return ".html"; +} + +} +?>