Moodle  2.2.1
http://www.collinsharper.com
restore_structure_step Class Reference
Inheritance diagram for restore_structure_step:
Collaboration diagram for restore_structure_step:

Public Member Functions

 __construct ($name, $filename, $task=null)
 execute ()
 process ($data)
 set_mapping ($itemname, $oldid, $newid, $restorefiles=false, $filesctxid=null, $parentid=null)
 get_old_parentid ($itemname)
 get_new_parentid ($itemname)
 get_mappingid ($itemname, $oldid, $ifnotfound=false)
 get_mapping ($itemname, $oldid)
 add_related_files ($component, $filearea, $mappingitemname, $filesctxid=null, $olditemid=null)
 apply_date_offset ($value)
 get_task ()
 launch_after_restore_methods ()

Data Fields

const SKIP_ALL_CHILDREN = -991399

Protected Member Functions

 add_plugin_structure ($plugintype, $element)
 launch_after_execute_methods ()
 after_execute ()
 prepare_pathelements ($elementsarr)
 grouped_parent_exists ($pelement, $elements)
 execute_condition ()
 define_structure ()

Protected Attributes

 $filename
 $contentprocessor
 $pathelements
 $elementsoldid
 $elementsnewid
 $pathlock

Detailed Description

Abstract class defining the needed stuff to restore one xml file

TODO: Finish phpdocs

Definition at line 30 of file restore_structure_step.class.php.


Constructor & Destructor Documentation

__construct ( name,
filename,
task = null 
)

Constructor - instantiates one object of this class

Definition at line 49 of file restore_structure_step.class.php.


Member Function Documentation

add_plugin_structure ( plugintype,
element 
) [protected]

Add plugin structure to any element in the structure restore tree

Parameters:
string$plugintypetype of plugin as defined by get_plugin_types()
restore_path_element$elementelement in the structure restore tree that we are going to add plugin information to

Definition at line 289 of file restore_structure_step.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_related_files ( component,
filearea,
mappingitemname,
filesctxid = null,
olditemid = null 
)

Add all the existing file, given their component and filearea and one backup_ids itemname to match with

Definition at line 219 of file restore_structure_step.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

after_execute ( ) [protected]

This method will be executed after the whole structure step have been processed

After execution method for code needed to be executed after the whole structure has been processed. Useful for cleaning tasks, files process and others. Simply overwrite in in your steps if needed

Reimplemented in restore_questions_activity_structure_step, restore_create_categories_and_questions, restore_activity_grading_structure_step, restore_course_structure_step, restore_section_structure_step, restore_outcomes_structure_step, restore_scales_structure_step, restore_groups_structure_step, restore_quiz_activity_structure_step, restore_gradebook_structure_step, restore_workshop_activity_structure_step, restore_scorm_activity_structure_step, restore_forum_activity_structure_step, restore_lesson_activity_structure_step, restore_glossary_activity_structure_step, restore_data_activity_structure_step, restore_wiki_activity_structure_step, restore_feedback_activity_structure_step, restore_assignment_activity_structure_step, restore_choice_activity_structure_step, restore_survey_activity_structure_step, restore_lti_activity_structure_step, restore_chat_activity_structure_step, restore_folder_activity_structure_step, restore_imscp_activity_structure_step, restore_resource_activity_structure_step, restore_label_activity_structure_step, restore_page_activity_structure_step, and restore_url_activity_structure_step.

Definition at line 407 of file restore_structure_step.class.php.

Here is the caller graph for this function:

apply_date_offset ( value)

Apply course startdate offset based in original course startdate and course_offset_startdate setting Note we are using one static cache here, but *by restoreid*, so it's ok for concurrence/multiple executions in the same request

Definition at line 230 of file restore_structure_step.class.php.

Here is the call graph for this function:

define_structure ( ) [abstract, protected]

Function that will return the structure to be processed by this restore_step. Must return one array of elements

Reimplemented in restore_create_categories_and_questions, restore_userscompletion_structure_step, restore_module_structure_step, restore_block_instance_structure_step, restore_activity_grades_structure_step, restore_activity_grading_structure_step, restore_course_logs_structure_step, restore_course_completion_structure_step, restore_comments_structure_step, restore_filters_structure_step, restore_enrolments_structure_step, restore_ras_and_caps_structure_step, restore_course_structure_step, restore_section_structure_step, restore_outcomes_structure_step, restore_scales_structure_step, restore_groups_structure_step, restore_load_included_files, restore_gradebook_structure_step, restore_lti_activity_structure_step, restore_lesson_activity_structure_step, restore_quiz_activity_structure_step, restore_rss_client_block_structure_step, restore_assignment_activity_structure_step, restore_chat_activity_structure_step, restore_choice_activity_structure_step, restore_data_activity_structure_step, restore_folder_activity_structure_step, restore_forum_activity_structure_step, restore_glossary_activity_structure_step, restore_imscp_activity_structure_step, restore_label_activity_structure_step, restore_page_activity_structure_step, restore_resource_activity_structure_step, restore_survey_activity_structure_step, restore_url_activity_structure_step, restore_wiki_activity_structure_step, restore_workshop_activity_structure_step, restore_feedback_activity_structure_step, and restore_scorm_activity_structure_step.

Here is the caller graph for this function:

execute ( ) [final]

This function will perform all the actions necessary to achieve the execution of the plan/part/task

Implements executable.

Definition at line 62 of file restore_structure_step.class.php.

Here is the call graph for this function:

execute_condition ( ) [protected]

To conditionally decide if one step will be executed or no

For steps needing to be executed conditionally, based in dynamic conditions (at execution time vs at declaration time) you must override this function. It will return true if the step must be executed and false if not

Reimplemented in restore_userscompletion_structure_step, restore_activity_grading_structure_step, restore_course_logs_structure_step, restore_course_completion_structure_step, restore_enrolments_structure_step, and restore_gradebook_structure_step.

Definition at line 473 of file restore_structure_step.class.php.

Here is the caller graph for this function:

get_mapping ( itemname,
oldid 
)

Return the complete mapping from the given itemname, itemid

Definition at line 212 of file restore_structure_step.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_mappingid ( itemname,
oldid,
ifnotfound = false 
)

Return the new id of a mapping for the given itemname

Parameters:
string$itemnamethe type of item
int$oldidthe item ID from the backup
mixed$ifnotfoundwhat to return if $oldid wasnt found. Defaults to false

Definition at line 204 of file restore_structure_step.class.php.

Here is the call graph for this function:

get_new_parentid ( itemname)

Returns the latest (parent) new id mapped by one pathelement

Definition at line 193 of file restore_structure_step.class.php.

get_old_parentid ( itemname)

Returns the latest (parent) old id mapped by one pathelement

Definition at line 186 of file restore_structure_step.class.php.

Here is the caller graph for this function:

get_task ( )

As far as restore structure steps are implementing restore_plugin stuff, they need to have the parent task available for wrapping purposes (get course/context....)

Reimplemented in restore_activity_structure_step.

Definition at line 276 of file restore_structure_step.class.php.

Here is the caller graph for this function:

grouped_parent_exists ( pelement,
elements 
) [protected]

Given one pathelement, return true if grouped parent was found

Definition at line 452 of file restore_structure_step.class.php.

Here is the caller graph for this function:

Launch all the after_execute methods present in all the processing objects

This method will launch all the after_execute methods that can be defined both in restore_plugin and restore_structure_step classes

For restore_plugin classes the name of the method to be executed will be "after_execute_" + connection point (as far as can be multiple connection points in the same class)

For restore_structure_step classes is will be, simply, "after_execute". Note that this is executed *after* the plugin ones

Definition at line 333 of file restore_structure_step.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Launch all the after_restore methods present in all the processing objects

This method will launch all the after_restore methods that can be defined both in restore_plugin class

For restore_plugin classes the name of the method to be executed will be "after_restore_" + connection point (as far as can be multiple connection points in the same class)

Definition at line 373 of file restore_structure_step.class.php.

prepare_pathelements ( elementsarr) [protected]

Prepare the pathelements for processing, looking for duplicates, applying processing objects and other adjustments

Definition at line 415 of file restore_structure_step.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process ( data) [final]

Receive one chunk of information form the xml parser processor and dispatch it, following the naming rules

Definition at line 115 of file restore_structure_step.class.php.

set_mapping ( itemname,
oldid,
newid,
restorefiles = false,
filesctxid = null,
parentid = null 
)

To send ids pairs to backup_ids_table and to store them into paths

This method will send the given itemname and old/new ids to the backup_ids_temp table, and, at the same time, will save the new id into the corresponding restore_path_element for easier access by children. Also will inject the known old context id for the task in case it's going to be used for restoring files later

Definition at line 161 of file restore_structure_step.class.php.

Here is the call graph for this function:


Field Documentation

$contentprocessor [protected]

Definition at line 33 of file restore_structure_step.class.php.

$elementsnewid [protected]

Definition at line 39 of file restore_structure_step.class.php.

$elementsoldid [protected]

Definition at line 38 of file restore_structure_step.class.php.

$filename [protected]

Definition at line 32 of file restore_structure_step.class.php.

$pathelements [protected]

Definition at line 37 of file restore_structure_step.class.php.

$pathlock [protected]

Definition at line 41 of file restore_structure_step.class.php.

const SKIP_ALL_CHILDREN = -991399

Definition at line 43 of file restore_structure_step.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations