Multianswer (aka embedded, cloze) question type conversion handler.
More...
|
| close_xml_writer () |
| Question type handlers cannot close the xml_writer. More...
|
|
| get_default_numerical_options ($oldquestiontextformat, $units) |
| Returns default numerical_option structure. More...
|
|
| has_xml_writer () |
| Checks if the XML writer has been opened by self::open_xml_writer(). More...
|
|
| make_sure_xml_exists ($filename, $rootelement=false, $content=array()) |
| Makes sure that a new XML file exists, or creates it itself. More...
|
|
| migrate_files ($text, $component, $filearea, $itemid) |
| Migrate files belonging to one qtype plugin text field. More...
|
|
| open_xml_writer ($filename) |
| Question type handlers cannot open the xml_writer. More...
|
|
| write_answers (array $answers, $qtype) |
| Converts the answers and writes them into the questions.xml. More...
|
|
| write_dataset_definitions (array $datasetdefinitions) |
| Writes the dataset_definitions structure. More...
|
|
| write_numerical_options (array $numericaloption) |
| Writes the numerical_options structure. More...
|
|
| write_numerical_units (array $numericalunits) |
| Writes the grouped numerical_units structure. More...
|
|
| write_xml ($element, array $data, array $attribs=array(), $parent='/') |
| Writes the given XML tree data into the currently opened file. More...
|
|
Multianswer (aka embedded, cloze) question type conversion handler.
◆ close_xml_writer()
moodle1_qtype_handler::close_xml_writer |
( |
| ) |
|
|
finalprotectedinherited |
◆ get_component_name()
moodle1_plugin_handler::get_component_name |
( |
| ) |
|
|
inherited |
Returns the normalized name of the plugin, eg mod_workshop.
- Return values
-
◆ get_converter()
moodle1_handler::get_converter |
( |
| ) |
|
|
inherited |
◆ get_default_numerical_options()
moodle1_qtype_handler::get_default_numerical_options |
( |
|
$oldquestiontextformat, |
|
|
|
$units |
|
) |
| |
|
protectedinherited |
Returns default numerical_option structure.
This structure is not present in moodle.xml, we create a new artificial one here.
- See also
- write_numerical_options()
- Parameters
-
int | $oldquestiontextformat | |
- Return values
-
◆ get_paths()
moodle1_qtype_handler::get_paths |
( |
| ) |
|
|
finalinherited |
- See also
- self::get_question_subpaths()
◆ get_question_subpaths()
moodle1_qtype_multianswer_handler::get_question_subpaths |
( |
| ) |
|
◆ has_xml_writer()
moodle1_xml_handler::has_xml_writer |
( |
| ) |
|
|
protectedinherited |
◆ log()
moodle1_handler::log |
( |
|
$message, |
|
|
|
$level, |
|
|
|
$a = null , |
|
|
|
$depth = null , |
|
|
|
$display = false |
|
) |
| |
|
inherited |
This function will be responsible for handling the params, and to call to the corresponding logger->process() once all modifications in params have been performed.
Implements loggable.
◆ make_sure_xml_exists()
moodle1_xml_handler::make_sure_xml_exists |
( |
|
$filename, |
|
|
|
$rootelement = false , |
|
|
|
$content = array() |
|
) |
| |
|
protectedinherited |
Makes sure that a new XML file exists, or creates it itself.
This is here so we can check that all XML files that the restore process relies on have been created by an executed handler. If the file is not found, this method can create it using the given $rootelement as an empty root container in the file.
- Parameters
-
string | $filename | relative file name like 'course/course.xml' |
string | bool | $rootelement | root element to use, false to not create the file |
array | $content | content of the root element |
- Return values
-
bool | true is the file existed, false if it did not |
◆ migrate_files()
moodle1_qtype_handler::migrate_files |
( |
|
$text, |
|
|
|
$component, |
|
|
|
$filearea, |
|
|
|
$itemid |
|
) |
| |
|
protectedinherited |
Migrate files belonging to one qtype plugin text field.
- Parameters
-
array | $text | the html fragment containing references to files |
string | $component | the component for restored files |
string | $filearea | the file area for restored files |
int | $itemid | the itemid for restored files |
- Return values
-
string | the text for this field, after files references have been processed |
◆ open_xml_writer()
moodle1_qtype_handler::open_xml_writer |
( |
|
$filename | ) |
|
|
finalprotectedinherited |
◆ process_question()
moodle1_qtype_multianswer_handler::process_question |
( |
array |
$data, |
|
|
array |
$raw |
|
) |
| |
Appends the multianswer specific information to the question.
Note that there is an upgrade step 2008050800 that is not replayed here as I suppose there was an error on restore and the backup file contains correct data. If I'm wrong on this assumption then the parent of the embedded questions could be fixed on conversion in theory (by using a temporary stash that keeps multianswer's id and its sequence) but the category fix would be tricky in XML.
Reimplemented from moodle1_qtype_handler.
◆ use_xml_writer()
moodle1_qtype_handler::use_xml_writer |
( |
xml_writer |
$xmlwriter | ) |
|
|
inherited |
Provides a xml_writer instance to this qtype converter.
- Parameters
-
◆ write_answers()
moodle1_qtype_handler::write_answers |
( |
array |
$answers, |
|
|
|
$qtype |
|
) |
| |
|
protectedinherited |
Converts the answers and writes them into the questions.xml.
The structure "answers" is used by several qtypes. It contains data from {question_answers} table.
- Parameters
-
array | $answers | as parsed by the grouped parser in moodle.xml |
string | $qtype | containing the answers |
◆ write_dataset_definitions()
moodle1_qtype_handler::write_dataset_definitions |
( |
array |
$datasetdefinitions | ) |
|
|
protectedinherited |
Writes the dataset_definitions structure.
- Parameters
-
array | $datasetdefinitions | array of dataset_definition structures |
◆ write_numerical_options()
moodle1_qtype_handler::write_numerical_options |
( |
array |
$numericaloption | ) |
|
|
protectedinherited |
◆ write_numerical_units()
moodle1_qtype_handler::write_numerical_units |
( |
array |
$numericalunits | ) |
|
|
protectedinherited |
Writes the grouped numerical_units structure.
- Parameters
-
◆ write_xml()
moodle1_xml_handler::write_xml |
( |
|
$element, |
|
|
array |
$data, |
|
|
array |
$attribs = array() , |
|
|
|
$parent = '/' |
|
) |
| |
|
protectedinherited |
Writes the given XML tree data into the currently opened file.
- Parameters
-
string | $element | the name of the root element of the tree |
array | $data | the associative array of data to write |
array | $attribs | list of additional fields written as attributes instead of nested elements |
string | $parent | used internally during the recursion, do not set yourself |
The documentation for this class was generated from the following file:
- question/type/multianswer/backup/moodle1/lib.php