mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-16250
Added support for Essay type questions Merged from STABLE_19
This commit is contained in:
parent
706c4f7405
commit
b81d2dbee3
1 changed files with 39 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
<?php // $Id$
|
<?php // $Id$
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
/// Blackboard 6.0 Format
|
/// Blackboard 6.0 Format
|
||||||
///
|
///
|
||||||
|
@ -37,10 +38,48 @@ class qformat_blackboard extends qformat_default {
|
||||||
$this->process_ma($xml, $questions);
|
$this->process_ma($xml, $questions);
|
||||||
$this->process_fib($xml, $questions);
|
$this->process_fib($xml, $questions);
|
||||||
$this->process_matching($xml, $questions);
|
$this->process_matching($xml, $questions);
|
||||||
|
$this->process_essay($xml, $questions);
|
||||||
|
|
||||||
return $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
|
// Process True / False Questions
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue