Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
backup_qtype_plugin Class Reference

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

Inheritance diagram for backup_qtype_plugin:
backup_plugin backup_qtype_calculated_plugin backup_qtype_ddimageortext_plugin backup_qtype_ddmarker_plugin backup_qtype_ddwtos_plugin backup_qtype_essay_plugin backup_qtype_extrafields_plugin backup_qtype_gapselect_plugin backup_qtype_match_plugin backup_qtype_multianswer_plugin backup_qtype_multichoice_plugin backup_qtype_numerical_plugin backup_qtype_ordering_plugin backup_qtype_randomsamatch_plugin backup_qtype_truefalse_plugin

Public Member Functions

 define_plugin_structure ($connectionpoint)
 

Static Public Member Functions

static get_components_and_fileareas ($filter=null)
 Returns all the components and fileareas used by all the installed qtypes.
 
static get_qtype_fileareas ()
 Returns one array with filearea => mappingname elements for the qtype.
 

Protected Member Functions

 add_question_datasets ($element)
 Attach to $element (usually questions) the needed backup structures for question_datasets for a given question Used by calculated qtypes.
 
 add_question_numerical_options ($element)
 Attach to $element (usually questions) the needed backup structures for question_numerical_options for a given question Used both by calculated and numerical qtypes.
 
 add_question_numerical_units ($element)
 Attach to $element (usually questions) the needed backup structures for question_numerical_units for a given question Used both by calculated and numerical qtypes.
 
 add_question_question_answers ($element)
 Attach to $element (usually questions) the needed backup structures for question_answers for a given question Used by various qtypes (calculated, essay, multianswer, multichoice, numerical, shortanswer, truefalse)
 
 get_plugin_element ($final_elements=null, $conditionparam=null, $conditionvalue=null)
 Factory method that will return one backup_plugin_element (backup_optigroup_element) with its name automatically calculated, based one the plugin being handled (type, name)
 
 get_recommended_name ()
 Simple helper function that suggests one name for the main nested element in plugins It's not mandatory to use it but recommended ;-)
 
 get_setting_value ($name)
 Returns the value of one (task/plan) setting.
 

Protected Attributes

string $connectionpoint
 
backup_optigroup_element $optigroup
 
string $pluginname
 
string $plugintype
 
backup_structure_step $step
 
backup_course_task backup_activity_task $task
 

Detailed Description

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

TODO: Finish phpdocs

Member Function Documentation

◆ get_components_and_fileareas()

static backup_qtype_plugin::get_components_and_fileareas ( $filter = null)
static

Returns all the components and fileareas used by all the installed qtypes.

The method introspects each qtype, asking it about fileareas used. Then, one 2-level array is returned. 1st level is the component name (qtype_xxxx) and 2nd level is one array of filearea => mappings to look

Note that this function is used both in backup and restore, so it is important to use the same mapping names (usually, name of the table in singular) always

TODO: Surely this can be promoted to backup_plugin easily and make it to work for ANY plugin, not only qtypes (but we don't need it for now)

◆ get_qtype_fileareas()

static backup_qtype_plugin::get_qtype_fileareas ( )
static

Returns one array with filearea => mappingname elements for the qtype.

Used by get_components_and_fileareas to know about all the qtype files to be processed both in backup and restore.

Reimplemented in backup_qtype_calculated_plugin, backup_qtype_ddimageortext_plugin, backup_qtype_ddmarker_plugin, backup_qtype_ddwtos_plugin, backup_qtype_essay_plugin, and backup_qtype_match_plugin.


The documentation for this class was generated from the following file: