1
0
mirror of https://github.com/moodle/moodle.git synced 2025-03-14 20:50:21 +01:00

Merge branch 'MDL-38705' of git://github.com/jonof/moodle

This commit is contained in:
Damyon Wiese 2013-04-03 14:35:12 +08:00
commit 6fb437b2bb
2 changed files with 40 additions and 6 deletions
question/format/blackboard_six

@ -53,6 +53,10 @@ class qformat_blackboard_six_qti extends qformat_blackboard_six_base {
}
$questions = array();
// Treat the assessment title as a category title.
$this->process_category($xml, $questions);
// First step : we are only interested in the <item> tags.
$rawquestions = $this->getpath($xml,
array('questestinterop', '#', 'assessment', 0, '#', 'section', 0, '#', 'item'),
@ -871,6 +875,21 @@ class qformat_blackboard_six_qti extends qformat_blackboard_six_base {
}
}
/**
* Add a category question entry based on the assessment title
* @param array $xml the xml tree
* @param array $questions the questions already parsed
*/
public function process_category($xml, &$questions) {
$title = $this->getpath($xml, array('questestinterop', '#', 'assessment', 0, '@', 'title'), '', true);
$dummyquestion = new stdClass();
$dummyquestion->qtype = 'category';
$dummyquestion->category = $this->cleaninput($this->clean_question_name($title));
$questions[] = $dummyquestion;
}
/**
* Strip the applet tag used by Blackboard to render mathml formulas,
* keeping the mathml tag.

@ -51,7 +51,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[3];
$q = $questions[4];
$expectedq = new stdClass();
$expectedq->qtype = 'match';
@ -85,7 +85,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[1];
$q = $questions[2];
$expectedq = new stdClass();
$expectedq->qtype = 'multichoice';
@ -144,7 +144,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[2];
$q = $questions[3];
$expectedq = new stdClass();
$expectedq->qtype = 'multichoice';
@ -220,7 +220,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[0];
$q = $questions[1];
$expectedq = new stdClass();
$expectedq->qtype = 'truefalse';
@ -250,7 +250,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[4];
$q = $questions[5];
$expectedq = new stdClass();
$expectedq->qtype = 'shortanswer';
@ -284,7 +284,7 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[5];
$q = $questions[6];
$expectedq = new stdClass();
$expectedq->qtype = 'essay';
@ -305,4 +305,19 @@ class qformat_blackboard_six_qti_test extends question_testcase {
$this->assert(new question_check_specified_fields_expectation($expectedq), $q);
}
public function test_import_category() {
$xml = $this->make_test_xml();
$importer = new qformat_blackboard_six();
$questions = $importer->readquestions($xml);
$q = $questions[0];
$expectedq = new stdClass();
$expectedq->qtype = 'category';
$expectedq->category = 'sample_blackboard_six';
$this->assert(new question_check_specified_fields_expectation($expectedq), $q);
}
}