--- question/format/gift/format.php 2007-11-30 04:07:17.000000000 +0100 +++ question/format/gift_img/format.php 2008-03-12 15:35:00.000000000 +0100 @@ -31,8 +31,10 @@ // and others. Paul Tsuchido Shew wrote this filter in December 2003. ////////////////////////////////////////////////////////////////////////// // Based on default.php, included by ../import.php +// +// WG 2008 added image support -class qformat_gift extends qformat_default { +class qformat_gift_img extends qformat_default { function provide_import() { return true; @@ -115,6 +117,7 @@ $question = $this->defaultquestion(); $comment = NULL; + $image = NULL; // define replaced by simple assignment, stop redefine notices $gift_answerweight_regex = "^%\-*([0-9]{1,2})\.?([0-9]*)%"; @@ -122,6 +125,9 @@ foreach ($lines as $key => $line) { $line = trim($line); if (substr($line, 0, 2) == "//") { + if (substr($line, 2, 8) == " image: ") { + $image = substr($line, 10); + } $lines[$key] = " "; } } @@ -327,7 +333,10 @@ } // end foreach answer //$question->defaultgrade = 1; - //$question->image = ""; // No images with this format + if ($image) { + $question->image = $image; + //error_log("q->img = $image"); + } return $question; break; @@ -415,7 +424,8 @@ //$question->usecase = 0; // Ignore case //$question->defaultgrade = 1; - //$question->image = ""; // No images with this format + if ($image) + $question->image = $image; return $question; break; @@ -531,6 +541,8 @@ // add comment $expout .= "// question: $question->id name: $question->name \n"; + if ($question->image) + $expout .= "// image: $question->image\n"; // get question text format $textformat = $question->questiontextformat; @@ -647,7 +659,7 @@ $expout .= $out; } else { - notify("No handler for qtype '$question->qtype' for GIFT export" ); + notify("No handler for qtype '$question->qtype' for GIFT_IMG export" ); } } // add empty line to delimit questions