diff --git a/question/type/ddwtos/question.php b/question/type/ddwtos/question.php index f6edc020ddb..58c4ac9c629 100644 --- a/question/type/ddwtos/question.php +++ b/question/type/ddwtos/question.php @@ -52,12 +52,12 @@ class qtype_ddwtos_question extends qtype_gapselect_question_base { class qtype_ddwtos_choice { public $text; public $draggroup; - public $isinfinite; + public $infinite; - public function __construct($text, $draggroup = 1, $isinfinite = false) { + public function __construct($text, $draggroup = 1, $infinite = false) { $this->text = $text; $this->draggroup = $draggroup; - $this->isinfinite = $isinfinite; + $this->infinite = $infinite; } public function choice_group() { diff --git a/question/type/ddwtos/questiontype.php b/question/type/ddwtos/questiontype.php index 8b46966a759..fb19bfa115d 100644 --- a/question/type/ddwtos/questiontype.php +++ b/question/type/ddwtos/questiontype.php @@ -105,7 +105,8 @@ class qtype_ddwtos extends qtype_gapselect_base { } $format->import_combined_feedback($question, $data, true); - $format->import_hints($question, $data, true); + $format->import_hints($question, $data, true, false, + $format->get_format($question->questiontextformat)); return $question; } @@ -116,7 +117,9 @@ class qtype_ddwtos extends qtype_gapselect_base { $output .= ' ' . $question->options->shuffleanswers . "\n"; - $output .= $format->write_combined_feedback($question->options); + $output .= $format->write_combined_feedback($question->options, + $question->id, + $question->contextid); foreach ($question->options->answers as $answer) { $options = unserialize($answer->feedback); diff --git a/question/type/ddwtos/renderer.php b/question/type/ddwtos/renderer.php index e381aa5048c..1233831fbd4 100644 --- a/question/type/ddwtos/renderer.php +++ b/question/type/ddwtos/renderer.php @@ -141,7 +141,7 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren $content = str_replace(' ', ' ', $content); $infinite = ''; - if ($choice->isinfinite) { + if ($choice->infinite) { $infinite = ' infinite'; } diff --git a/question/type/ddwtos/simpletest/testquestiontype.php b/question/type/ddwtos/simpletest/testquestiontype.php index f5678e7897e..dbc23f7d548 100644 --- a/question/type/ddwtos/simpletest/testquestiontype.php +++ b/question/type/ddwtos/simpletest/testquestiontype.php @@ -237,6 +237,7 @@ class qtype_ddwtos_test extends UnitTestCase { $expectedq->hintclearwrong = array(false, true); $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q); + $this->assertEqual($expectedq->hint, $q->hint); } public function test_xml_import_legacy() { @@ -387,34 +388,34 @@ class qtype_ddwtos_test extends UnitTestCase { $expectedq->shuffleanswers = 0; $expectedq->correctfeedback = array('text' => 'Your answer is correct.', - 'format' => FORMAT_MOODLE, 'files' => array()); + 'format' => FORMAT_HTML, 'files' => array()); $expectedq->partiallycorrectfeedback = array( 'text' => 'Your answer is partially correct.', - 'format' => FORMAT_MOODLE, 'files' => array()); + 'format' => FORMAT_HTML, 'files' => array()); $expectedq->shownumcorrect = true; $expectedq->incorrectfeedback = array('text' => 'Your answer is incorrect.', - 'format' => FORMAT_MOODLE, 'files' => array()); + 'format' => FORMAT_HTML, 'files' => array()); $expectedq->choices = array( - array('answer' => array('text' => 'hydrogen', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'hydrogen', 'format' => FORMAT_PLAIN), 'choicegroup' => 1, 'infinite' => false), - array('answer' => array('text' => 'positive', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'positive', 'format' => FORMAT_PLAIN), 'choicegroup' => 1, 'infinite' => false), - array('answer' => array('text' => 'hydroxide', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'hydroxide', 'format' => FORMAT_PLAIN), 'choicegroup' => 1, 'infinite' => false), - array('answer' => array('text' => 'negative', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'negative', 'format' => FORMAT_PLAIN), 'choicegroup' => 1, 'infinite' => false), - array('answer' => array('text' => '107', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => '107', 'format' => FORMAT_PLAIN), 'choicegroup' => 2, 'infinite' => false), - array('answer' => array('text' => '7', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => '7', 'format' => FORMAT_PLAIN), 'choicegroup' => 2, 'infinite' => false), - array('answer' => array('text' => '1', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => '1', 'format' => FORMAT_PLAIN), 'choicegroup' => 2, 'infinite' => false), - array('answer' => array('text' => '10-7', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => '10-7', 'format' => FORMAT_PLAIN), 'choicegroup' => 2, 'infinite' => false), - array('answer' => array('text' => 'greater', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'greater', 'format' => FORMAT_PLAIN), 'choicegroup' => 3, 'infinite' => false), - array('answer' => array('text' => 'less', 'format' => FORMAT_MOODLE), + array('answer' => array('text' => 'less', 'format' => FORMAT_PLAIN), 'choicegroup' => 3, 'infinite' => false), );