From b81d2dbee353844e2865ed89c5881d2a319aa1aa Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 28 Aug 2008 10:07:51 +0000 Subject: [PATCH] MDL-16250 Added support for Essay type questions Merged from STABLE_19 --- question/format/blackboard/format.php | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/question/format/blackboard/format.php b/question/format/blackboard/format.php index 95ee5b6f47..460d430ee4 100644 --- a/question/format/blackboard/format.php +++ b/question/format/blackboard/format.php @@ -1,5 +1,6 @@ process_ma($xml, $questions); $this->process_fib($xml, $questions); $this->process_matching($xml, $questions); + $this->process_essay($xml, $questions); return $questions; } +//---------------------------------------- +// Process Essay Questions +//---------------------------------------- +function process_essay($xml, &$questions ) { + + if (isset($xml["POOL"]["#"]["QUESTION_ESSAY"])) { + $essayquestions = $xml["POOL"]["#"]["QUESTION_ESSAY"]; + } + else { + return; + } + + foreach ($essayquestions as $essayquestion) { + + $question = $this->defaultquestion(); + + $question->qtype = ESSAY; + + // determine if the question is already escaped html + $ishtml = $essayquestion["#"]["BODY"][0]["#"]["FLAGS"][0]["#"]["ISHTML"][0]["@"]["value"]; + + // put questiontext in question object + if ($ishtml) { + $question->questiontext = html_entity_decode_php4(trim($essayquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + } + $question->questiontext = addslashes($question->questiontext); + + // put name in question object + $question->name = substr($question->questiontext, 0, 254); + $question->answer = ''; + $question->feedback = ''; + $question->fraction = 0; + + $questions[] = $question; + } +} + //---------------------------------------- // Process True / False Questions //---------------------------------------- -- 2.39.5