function qformat_default::try_exporting_using_qtypes in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format.php \qformat_default::try_exporting_using_qtypes()
Provide export functionality for plugin questiontypes Do not override
Parameters
name questiontype name:
question object data to export:
extra mixed any addition format specific data needed:
Return value
string the data to append to export or false if error (or unhandled)
2 calls to qformat_default::try_exporting_using_qtypes()
- qformat_gift::writequestion in includes/
moodle/ question/ format/ gift/ format.php - convert a single question object into text output in the given format. This must be overriden
- qformat_xml::writequestion in includes/
moodle/ question/ format/ xml/ format.php - Turns question into an xml segment
File
- includes/
moodle/ question/ format.php, line 592
Class
- qformat_default
- Base class for question import and export formats.
Code
function try_exporting_using_qtypes($name, $question, $extra = null) {
global $QTYPES;
// work out the name of format in use
$formatname = substr(get_class($this), strlen('qformat_'));
$methodname = "export_to_{$formatname}";
if (array_key_exists($name, $QTYPES)) {
$qtype = $QTYPES[$name];
if (method_exists($qtype, $methodname)) {
if ($data = $qtype
->{$methodname}($question, $this, $extra)) {
return $data;
}
}
}
return false;
}