Handles the conversion of the question bank included in the moodle.xml file.
More...
|
| get_converter () |
|
| get_current_category_context () |
| Returns the information about the question category context being currently parsed. More...
|
|
| get_file_manager () |
| Return the file manager instance used. More...
|
|
| get_paths () |
| Registers path that are not qtype-specific.
|
|
| log ($message, $level, $a=null, $depth=null, $display=false) |
| 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. More...
|
|
| on_question_categories_end () |
| Stops writing questions.xml.
|
|
| on_question_categories_start () |
| Starts writing questions.xml and prepares the file manager instance.
|
|
| on_question_category_end () |
| Closes the question_category and annotates the category id so that it can be dumped into course/inforef.xml.
|
|
| on_question_category_start () |
| Initializes the current category cache.
|
|
| on_questions_end () |
| Closes the questions wrapper.
|
|
| process_question (array $data, array $raw) |
| Writes the common <question> data and re-dispateches the whole grouped <QUESTION> data to the qtype for appending its qtype specific data processing. More...
|
|
| process_question_category ($data, $raw) |
| Populates the current question category data. More...
|
|
| process_question_category_context ($data) |
| Inject the context related information into the current category.
|
|
|
moodle1_converter | $converter |
|
array | $currentcategory = null |
| the current question category being parsed
|
|
array | $currentcategoryraw = null |
| of the raw data for the current category
|
|
moodle1_file_manager | $fileman = null |
| instance used to convert question images
|
|
null string | $xmlfilename |
| the name of file we are writing to
|
|
null xml_writer | $xmlwriter |
|
Handles the conversion of the question bank included in the moodle.xml file.
◆ close_xml_writer()
moodle1_xml_handler::close_xml_writer |
( |
| ) |
|
|
protectedinherited |
Close the XML writer.
At the moment, the caller must close all tags before calling
- Return values
-
Reimplemented in moodle1_qtype_handler.
◆ get_converter()
moodle1_handler::get_converter |
( |
| ) |
|
|
inherited |
◆ get_current_category_context()
moodle1_question_bank_handler::get_current_category_context |
( |
| ) |
|
Returns the information about the question category context being currently parsed.
- Return values
-
array | with keys contextid, contextlevel and contextinstanceid |
◆ get_file_manager()
moodle1_question_bank_handler::get_file_manager |
( |
| ) |
|
Return the file manager instance used.
- Return values
-
◆ get_qtype_handler()
moodle1_question_bank_handler::get_qtype_handler |
( |
|
$qtype | ) |
|
|
protected |
Provides access to the qtype handlers.
Returns either list of all qtype handler instances (if passed '*') or a particular handler for the given qtype or false if the qtype is not supported.
- Exceptions
-
- Parameters
-
string | $qtype | the name of the question type or '*' for returning all |
- Return values
-
array|moodle1_qtype_handler|bool | |
◆ 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 |
◆ open_xml_writer()
moodle1_xml_handler::open_xml_writer |
( |
|
$filename | ) |
|
|
protectedinherited |
Opens the XML writer - after calling, one is free to use $xmlwriter.
- Parameters
-
string | $filename | XML file name to write into |
- Return values
-
Reimplemented in moodle1_qtype_handler.
◆ process_question()
moodle1_question_bank_handler::process_question |
( |
array |
$data, |
|
|
array |
$raw |
|
) |
| |
Writes the common <question> data and re-dispateches the whole grouped <QUESTION> data to the qtype for appending its qtype specific data processing.
- Parameters
-
- Return values
-
◆ process_question_category()
moodle1_question_bank_handler::process_question_category |
( |
|
$data, |
|
|
|
$raw |
|
) |
| |
Populates the current question category data.
Bacuse of the known subpath-in-the-middle problem (CONTEXT in this case), this is actually called twice for both halves of the data. We merge them here into the currentcategory array.
◆ 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: