Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
Defines backup_activity_task 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: | 364 lines (16 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
backup_activity_task:: (12 methods):
__construct()
get_moduleid()
get_sectionid()
get_modulename()
get_activityid()
get_contextid()
get_taskbasepath()
build()
execute()
get_setting()
define_settings()
encode_content_links()
Class: backup_activity_task - X-Ref
Provides all the settings and steps to perform one complete backup of the activity__construct($name, $moduleid, $plan = null) X-Ref |
Constructor - instantiates one object of this class param: string $name the task identifier param: int $moduleid course module id (id in course_modules table) param: backup_plan|null $plan the backup plan instance this task is part of |
get_moduleid() X-Ref |
return: int the course module id (id in the course_modules table) |
get_sectionid() X-Ref |
return: int the course section id (id in the course_sections table) |
get_modulename() X-Ref |
return: string the name of the module, eg 'workshop' (from the modules table) |
get_activityid() X-Ref |
return: int the id of the activity instance (id in the activity's instances table) |
get_contextid() X-Ref |
return: int the id of the associated CONTEXT_MODULE instance |
get_taskbasepath() X-Ref |
return: string full path to the directory where this task writes its files |
build() X-Ref |
Create all the steps that will be part of this task |
execute() X-Ref |
Exceptionally override the execute method, so, based in the activity_included setting, we are able to skip the execution of one task completely |
get_setting($name) X-Ref |
Tries to look for the instance specific setting value, task specific setting value or the common plan setting value - in that order param: string $name the name of the setting return: mixed|null the value of the setting or null if not found |
define_settings() X-Ref |
Defines the common setting that any backup activity will have |
encode_content_links($content) X-Ref |
Encodes URLs to the activity instance's scripts into a site-independent form The current instance of the activity may be referenced from other places in the course by URLs like http://my.moodle.site/mod/workshop/view.php?id=42 Obvisouly, such URLs are not valid any more once the course is restored elsewhere. For this reason the backup file does not store the original URLs but encodes them into a transportable form. During the restore, the reverse process is applied and the encoded URLs are replaced with the new ones valid for the target site. Every plugin must override this method in its subclass. param: string $content some HTML text that eventually contains URLs to the activity instance scripts return: string the content with the URLs encoded |