Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Defines restore_qtype_plugin class

Copyright: 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 396 lines (17 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class


Class: restore_qtype_plugin  - X-Ref

Class extending standard restore_plugin in order to implement some
helper methods related with the questions (qtype plugin)

TODO: Finish phpdocs
add_question_question_answers(&$paths)   X-Ref
Add to $paths the restore_path_elements needed
to handle question_answers for a given question
Used by various qtypes (calculated, essay, multianswer,
multichoice, numerical, shortanswer, truefalse)


add_question_numerical_units(&$paths)   X-Ref
Add to $paths the restore_path_elements needed
to handle question_numerical_units for a given question
Used by various qtypes (calculated, numerical)


add_question_numerical_options(&$paths)   X-Ref
Add to $paths the restore_path_elements needed
to handle question_numerical_options for a given question
Used by various qtypes (calculated, numerical)


add_question_datasets(&$paths)   X-Ref
Add to $paths the restore_path_elements needed
to handle question_datasets (defs and items) for a given question
Used by various qtypes (calculated, numerical)


process_question_answer($data)   X-Ref
Processes the answer element (question answers). Common for various qtypes.
It handles both creation (if the question is being created) and mapping
(if the question already existed and is being reused)


process_question_numerical_unit($data)   X-Ref
Processes the numerical_unit element (question numerical units). Common for various qtypes.
It handles both creation (if the question is being created) and mapping
(if the question already existed and is being reused)


process_question_numerical_option($data)   X-Ref
Processes the numerical_option element (question numerical options). Common for various qtypes.
It handles both creation (if the question is being created) and mapping
(if the question already existed and is being reused)


process_question_dataset_definition($data)   X-Ref
Processes the dataset_definition element (question dataset definitions). Common for various qtypes.
It handles both creation (if the question is being created) and mapping
(if the question already existed and is being reused)


process_question_dataset_item($data)   X-Ref
Processes the dataset_item element (question dataset items). Common for various qtypes.
It handles both creation (if the question is being created) and mapping
(if the question already existed and is being reused)


recode_response($questionid, $sequencenumber, array $response)   X-Ref
Do any re-coding necessary in the student response.

param: int $questionid the new id of the question
param: int $sequencenumber of the step within the qusetion attempt.
param: array the response data from the backup.
return: array the recoded response.

recode_legacy_state_answer($state)   X-Ref
Decode legacy question_states.answer for this qtype. Used when restoring
2.0 attempt data.


define_plugin_decode_contents()   X-Ref
Return the contents of the questions stuff that must be processed by the links decoder

Only common stuff to all plugins, in this case:
- question: text and feedback
- question_answers: text and feedbak

Note each qtype will have, if needed, its own define_decode_contents method