Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit b31d6664e6f4a824bd8460cc45c25a7a7f7e0cad 1 parent 3a8c438
Jean-Michel Vedrine authored
Showing with 10 additions and 9 deletions.
  1. +0 −4 question/format/gift/format.php
  2. +10 −5 question/format/xml/format.php
View
4 question/format/gift/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)));
}
}
View
15 question/format/xml/format.php
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.