Merge branch 'MDL-39283' of git://github.com/jmvedrine/moodle

This commit is contained in:
Dan Poltawski 2013-04-24 14:33:00 +01:00
commit ba26ed9cac
2 changed files with 10 additions and 9 deletions

View file

@ -763,10 +763,6 @@ class qformat_gift extends qformat_default {
// Check for plugins // Check for plugins
if ($out = $this->try_exporting_using_qtypes($question->qtype, $question)) { if ($out = $this->try_exporting_using_qtypes($question->qtype, $question)) {
$expout .= $out; $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 file

@ -1099,6 +1099,7 @@ class qformat_xml extends qformat_default {
public function writequestion($question) { public function writequestion($question) {
global $CFG, $OUTPUT; global $CFG, $OUTPUT;
$invalidquestion = false;
$fs = get_file_storage(); $fs = get_file_storage();
$contextid = $question->contextid; $contextid = $question->contextid;
// Get files used by the questiontext. // Get files used by the questiontext.
@ -1410,12 +1411,13 @@ class qformat_xml extends qformat_default {
break; break;
default: default:
// try support by optional plugin // Try support by optional plugin.
if (!$data = $this->try_exporting_using_qtypes($question->qtype, $question)) { 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. // Output any hints.
$expout .= $this->write_hints($question); $expout .= $this->write_hints($question);
@ -1435,9 +1437,12 @@ class qformat_xml extends qformat_default {
// close the question tag // close the question tag
$expout .= " </question>\n"; $expout .= " </question>\n";
if ($invalidquestion) {
return '';
} else {
return $expout; return $expout;
} }
}
public function write_answers($answers) { public function write_answers($answers) {
if (empty($answers)) { if (empty($answers)) {