Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
moodle1_plugin_handler Class Reference

Shared base class for activity modules, blocks and qtype handlers. More...

Inheritance diagram for moodle1_plugin_handler:
moodle1_xml_handler moodle1_handler loggable moodle1_block_handler moodle1_mod_handler moodle1_qtype_handler moodle1_submod_handler moodle1_block_generic_handler moodle1_block_html_handler moodle1_block_rss_client_handler moodle1_mod_assignment_handler moodle1_mod_book_handler moodle1_mod_chat_handler moodle1_mod_choice_handler moodle1_mod_data_handler moodle1_mod_feedback_handler moodle1_mod_forum_handler moodle1_mod_glossary_handler moodle1_mod_label_handler moodle1_mod_lesson_handler moodle1_mod_lti_handler moodle1_mod_quiz_handler moodle1_mod_resource_handler moodle1_mod_scorm_handler moodle1_mod_survey_handler moodle1_mod_wiki_handler moodle1_mod_workshop_handler moodle1_resource_successor_handler moodle1_qtype_calculated_handler moodle1_qtype_essay_handler moodle1_qtype_match_handler moodle1_qtype_multianswer_handler moodle1_qtype_multichoice_handler moodle1_qtype_numerical_handler moodle1_qtype_randomsamatch_handler moodle1_qtype_shortanswer_handler moodle1_qtype_truefalse_handler moodle1_assignment_subplugin_handler moodle1_workshopform_handler

Public Member Functions

 __construct (moodle1_converter $converter, $plugintype, $pluginname)
 
 get_component_name ()
 Returns the normalized name of the plugin, eg mod_workshop. More...
 
 get_converter ()
 
 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...
 

Protected Member Functions

 close_xml_writer ()
 Close the XML writer. 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...
 
 open_xml_writer ($filename)
 Opens the XML writer - after calling, one is free to use $xmlwriter. More...
 
 write_xml ($element, array $data, array $attribs=array(), $parent='/')
 Writes the given XML tree data into the currently opened file. More...
 

Protected Attributes

moodle1_converter $converter
 
string $pluginname
 
string $plugintype
 
null string $xmlfilename
 the name of file we are writing to
 
null xml_writer $xmlwriter
 

Detailed Description

Shared base class for activity modules, blocks and qtype handlers.

Constructor & Destructor Documentation

◆ __construct()

moodle1_plugin_handler::__construct ( moodle1_converter  $converter,
  $plugintype,
  $pluginname 
)
Parameters
moodle1_converter$converterthe converter that requires us
string$plugintype
string$pluginname

Member Function Documentation

◆ 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
void

Reimplemented in moodle1_qtype_handler.

◆ get_component_name()

moodle1_plugin_handler::get_component_name ( )

Returns the normalized name of the plugin, eg mod_workshop.

Return values
string

◆ get_converter()

moodle1_handler::get_converter ( )
inherited
Return values
moodle1_converterthe converter that required this handler

◆ has_xml_writer()

moodle1_xml_handler::has_xml_writer ( )
protectedinherited

Checks if the XML writer has been opened by self::open_xml_writer().

Return values
bool

◆ 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$filenamerelative file name like 'course/course.xml'
string | bool$rootelementroot element to use, false to not create the file
array$contentcontent of the root element
Return values
booltrue 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$filenameXML file name to write into
Return values
void

Reimplemented in moodle1_qtype_handler.

◆ 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$elementthe name of the root element of the tree
array$datathe associative array of data to write
array$attribslist of additional fields written as attributes instead of nested elements
string$parentused internally during the recursion, do not set yourself

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