mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-39283 GIFT and XML question export broken for unsupported qtypes
Do no write any data to the export for unsupported qtypes
This commit is contained in:
parent
3a8c4380c0
commit
b31d6664e6
2 changed files with 10 additions and 9 deletions
|
@ -761,10 +761,6 @@ class qformat_gift extends qformat_default {
|
|||
// Check for plugins
|
||||
if ($out = $this->try_exporting_using_qtypes($question->qtype, $question)) {
|
||||
$expout .= $out;
|
||||
} else {
|
||||
$expout .= "Question type $question->qtype is not supported\n";
|
||||
echo $OUTPUT->notification(get_string('nohandler', 'qformat_gift',
|
||||
question_bank::get_qtype_name($question->qtype)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1099,6 +1099,7 @@ class qformat_xml extends qformat_default {
|
|||
public function writequestion($question) {
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
$invalidquestion = false;
|
||||
$fs = get_file_storage();
|
||||
$contextid = $question->contextid;
|
||||
// Get files used by the questiontext.
|
||||
|
@ -1410,11 +1411,12 @@ class qformat_xml extends qformat_default {
|
|||
break;
|
||||
|
||||
default:
|
||||
// try support by optional plugin
|
||||
// Try support by optional plugin.
|
||||
if (!$data = $this->try_exporting_using_qtypes($question->qtype, $question)) {
|
||||
notify(get_string('unsupportedexport', 'qformat_xml', $question->qtype));
|
||||
$invalidquestion = true;
|
||||
} else {
|
||||
$expout .= $data;
|
||||
}
|
||||
$expout .= $data;
|
||||
}
|
||||
|
||||
// Output any hints.
|
||||
|
@ -1435,8 +1437,11 @@ class qformat_xml extends qformat_default {
|
|||
|
||||
// close the question tag
|
||||
$expout .= " </question>\n";
|
||||
|
||||
return $expout;
|
||||
if ($invalidquestion) {
|
||||
return '';
|
||||
} else {
|
||||
return $expout;
|
||||
}
|
||||
}
|
||||
|
||||
public function write_answers($answers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue