Merge branch 'MDL-30742_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE

This commit is contained in:
Sam Hemelryk
2011-12-19 11:30:42 +13:00
2 changed files with 20 additions and 1 deletions
@@ -50,6 +50,21 @@ class moodle1_qtype_multichoice_handler extends moodle1_qtype_handler {
}
// convert and write the multichoice
if (!isset($data['multichoice'])) {
// This should never happen, but it can do if the 1.9 site contained
// corrupt data/
$data['multichoice'] = array(array(
'single' => 1,
'shuffleanswers' => 1,
'correctfeedback' => '',
'correctfeedbackformat' => FORMAT_HTML,
'partiallycorrectfeedback' => '',
'partiallycorrectfeedbackformat' => FORMAT_HTML,
'incorrectfeedback' => '',
'incorrectfeedbackformat' => FORMAT_HTML,
'answernumbering' => 'abc',
));
}
$this->write_multichoice($data['multichoice'], $data['oldquestiontextformat']);
}
@@ -73,7 +73,11 @@ class restore_qtype_multichoice_plugin extends restore_qtype_plugin {
// Adjust some columns
$data->question = $newquestionid;
// Map sequence of question_answer ids
$answersarr = explode(',', $data->answers);
if ($data->answers) {
$answersarr = explode(',', $data->answers);
} else {
$answersarr = array();
}
foreach ($answersarr as $key => $answer) {
$answersarr[$key] = $this->get_mappingid('question_answer', $answer);
}