|
Moodle
2.2.1
http://www.collinsharper.com
|


Importer for Moodle XML question format.
See http://docs.moodle.org/en/Moodle_XML_format for a description of the format.
Definition at line 48 of file format.php.
Reimplemented from qformat_default.
Definition at line 958 of file format.php.
| format | ( | $ | format | ) |
| int | $format | a FORMAT_... constant. |
Definition at line 1474 of file format.php.


| get_format | ( | $ | id | ) |
Convert internal Moodle text format code into human readable form
| int | id internal code |
Definition at line 987 of file format.php.

| get_qtype | ( | $ | qtype | ) | [protected] |
Turn the internal question type name into a human readable form. (In the past, the code used to use integers internally. Now, it uses strings, so there is less need for this, but to maintain backwards-compatibility we change two of the type names.)
| string | $qtype | question type plugin name. |
Definition at line 970 of file format.php.

| get_single | ( | $ | id | ) |
Convert internal single question code into human readable form
| int | id single question code |
Definition at line 1010 of file format.php.

| getpath | ( | $ | xml, |
| $ | path, | ||
| $ | default, | ||
| $ | istext = false, |
||
| $ | error = '' |
||
| ) |
return the value of a node, given a path to the node if it doesn't exist return the default value
| array | xml data to read |
| array | path path to node expressed as array |
| mixed | default |
| bool | istext process as text |
| string | error if set value must exist, return false and issue message if not |
Definition at line 128 of file format.php.


| import_answer | ( | $ | answer, |
| $ | withanswerfiles = false, |
||
| $ | defaultformat = 'html' |
||
| ) |
Import the common parts of a single answer
| array | answer xml tree for single answer | |
| bool | $withanswerfiles | if true, the answers are HTML (or $defaultformat) and so may contain files, otherwise the answers are plain text. |
| array | Default text format for the feedback, and the answers if $withanswerfiles is true. |
Definition at line 234 of file format.php.


| import_calculated | ( | $ | question | ) |
Import a calculated question
| object | $question | the imported XML data. |
Definition at line 731 of file format.php.


| import_category | ( | $ | question | ) | [protected] |
This is not a real question type. It's a dummy type used to specify the import category. The format is: <question type="category"> <category>tom/dick/harry</category> </question>
Definition at line 877 of file format.php.


| import_combined_feedback | ( | $ | qo, |
| $ | questionxml, | ||
| $ | withshownumpartscorrect = false |
||
| ) |
Import the common overall feedback fields.
| object | $question | the part of the XML relating to this question. |
| object | $qo | the question data to add the fields to. |
| bool | $withshownumpartscorrect | include the shownumcorrect field. |
Definition at line 267 of file format.php.


| import_description | ( | $ | question | ) |
Import description type question
| array | question question array from xml tree |
Definition at line 577 of file format.php.


| import_essay | ( | $ | question | ) |
Import essay type question
| array | question question array from xml tree |
Definition at line 704 of file format.php.


| import_files | ( | $ | xml | ) |
Import files from a node in the XML.
| array | $xml | an array of <file> nodes from the the parsed XML. |
Definition at line 368 of file format.php.

| import_headers | ( | $ | question | ) |
import parts of question common to all types
| $question | array question question array from xml tree |
Definition at line 158 of file format.php.


| import_hint | ( | $ | hintxml, |
| $ | defaultformat | ||
| ) |
Import a question hint
| array | $hintxml | hint xml fragment. |
| string | $defaultformat | the text format to assume for hints that do not specify. |
Definition at line 298 of file format.php.


| import_hints | ( | $ | qo, |
| $ | questionxml, | ||
| $ | withparts = false, |
||
| $ | withoptions = false, |
||
| $ | defaultformat = 'html' |
||
| ) |
Import all the question hints
| object | $qo | the question data that is being constructed. |
| array | $questionxml | The xml representing the question. |
| bool | $withparts | whether the extra fields relating to parts should be imported. |
| bool | $withoptions | whether the extra options field should be imported. |
| string | $defaultformat | the text format to assume for hints that do not specify. |
Definition at line 342 of file format.php.


| import_match | ( | $ | question | ) |
Import matching type question
| array | question question array from xml tree |
Definition at line 667 of file format.php.


| import_multianswer | ( | $ | question | ) |
Import cloze type question
| array | question question array from xml tree |
Definition at line 427 of file format.php.


| import_multichoice | ( | $ | question | ) |
import multiple choice question
| array | question question array from xml tree |
Definition at line 385 of file format.php.


| import_numerical | ( | $ | question | ) |
Import numerical type question
| array | question question array from xml tree |
Definition at line 592 of file format.php.


| import_shortanswer | ( | $ | question | ) |
Import short answer type question
| array | question question array from xml tree |
Definition at line 546 of file format.php.


| import_text | ( | $ | text | ) |
process text string from xml file
| array | $text | bit of xml tree after ['text'] |
Definition at line 109 of file format.php.

| import_truefalse | ( | $ | question | ) |
Import true/false type question
| array | question question array from xml tree |
Definition at line 470 of file format.php.


| mime_type | ( | ) |
The string mime-type of the files that this plugin reads or writes.
Reimplemented from qformat_default.
Definition at line 58 of file format.php.
| presave_process | ( | $ | content | ) | [protected] |
Enable any processing to be done on the content just prior to the file being saved default is to do nothing
| string | output text |
| string | processed output text |
Reimplemented from qformat_default.
Definition at line 1076 of file format.php.
| provide_export | ( | ) |
Reimplemented from qformat_default.
Definition at line 54 of file format.php.
| provide_import | ( | ) |
Reimplemented from qformat_default.
Definition at line 50 of file format.php.
| readquestions | ( | $ | lines | ) | [protected] |
Parse the array of lines into an array of questions this *could* burn memory - but it won't happen that much so fingers crossed!
| array | of lines from the input file. |
Reimplemented from qformat_default.
Definition at line 891 of file format.php.

| trans_format | ( | $ | name | ) |
Translate human readable format name into internal Moodle code number
| string | name format name from xml file |
Definition at line 70 of file format.php.


| trans_single | ( | $ | name | ) |
Translate human readable single answer option to internal code number
| string | name true/false |
Definition at line 95 of file format.php.

| write_answer | ( | $ | answer, |
| $ | extra = '' |
||
| ) |
Definition at line 1438 of file format.php.


| write_answers | ( | $ | answers | ) |
Definition at line 1427 of file format.php.


| write_combined_feedback | ( | $ | questionoptions, |
| $ | questionid, | ||
| $ | contextid | ||
| ) |
Output the combined feedback fields.
| object | $questionoptions | the question definition data. |
| int | $questionid | the question id. |
| int | $contextid | the question context id. |
Definition at line 1508 of file format.php.


| write_files | ( | $ | files | ) |
Generte the XML to represent some files.
| array | of store array of stored_file objects. |
Definition at line 1060 of file format.php.

| write_hint | ( | $ | hint, |
| $ | contextid | ||
| ) |
Definition at line 1478 of file format.php.


| write_hints | ( | $ | question | ) |
Write out the hints.
| object | $question | the question definition data. |
Definition at line 1458 of file format.php.


| writequestion | ( | $ | question | ) |
Turns question into an xml segment
| object | $question | the question data. |
Reimplemented from qformat_default.
Definition at line 1088 of file format.php.

Generates <text></text> tags, processing raw text therein
| string | $raw | the content to output. |
| int | $indent | the current indent level. |
| bool | $short | stick it on one line. |
Definition at line 1042 of file format.php.


| xml_escape | ( | $ | string | ) |
Take a string, and wrap it in a CDATA secion, if that is required to make the output XML valid.
| string | $string | a string |
Definition at line 1027 of file format.php.
