Permalink
Browse files

MDL-39283 GIFT and XML question export broken for unsupported qtypes

Do no write any data to the export for unsupported qtypes
  • Loading branch information...
Jean-Michel Vedrine
Jean-Michel Vedrine committed Apr 22, 2013
1 parent 3a8c438 commit b31d6664e6f4a824bd8460cc45c25a7a7f7e0cad
Showing with 10 additions and 9 deletions.
  1. +0 −4 question/format/gift/format.php
  2. +10 −5 question/format/xml/format.php
@@ -761,10 +761,6 @@ public function writequestion($question) {
// 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 @@ protected function presave_process($content) {
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 @@ public function writequestion($question) {
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 @@ public function writequestion($question) {
// close the question tag
$expout .= " </question>\n";
return $expout;
if ($invalidquestion) {
return '';
} else {
return $expout;
}
}
public function write_answers($answers) {

0 comments on commit b31d666

Please sign in to comment.