Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
section_backup_setting Class Reference

Abstract class containing all the common stuff for section backup settings. More...

Inheritance diagram for section_backup_setting:
backup_setting base_setting checksumable backup_section_generic_setting backup_section_included_setting backup_section_userinfo_setting restore_section_generic_setting restore_section_included_setting restore_section_userinfo_setting

Public Member Functions

 __construct ($name, $vtype, $value=null, $visibility=self::VISIBLE, $status=self::NOT_LOCKED)
 {{Instantiates a setting object.
Parameters
string$nameName of the setting
string$vtypeType of the setting, eg self::IS_TEXT
mixed$valueValue of the setting
bool$visibilityIs the setting visible in the UI, eg } * int $status Status of the setting with regards to the locking, eg self::NOT_LOCKED
}}
 
 add_dependency (base_setting $dependentsetting, $type=setting_dependency::DISABLED_VALUE, $options=array())
 Quick method to add a dependency to this setting. More...
 
 calculate_checksum ()
 This function will return one unique and stable checksum for one instance of the class implementing it. More...
 
 destroy ()
 Destroy all circular references. More...
 
 get_dependencies ()
 
 get_help ()
 Gets the help string params for this setting if it has been set. More...
 
 get_level ()
 
 get_my_dependency_properties ($settingname=null)
 Gets an array of properties for all of the dependencies that will affect this setting. More...
 
 get_name ()
 
 get_param_validation ()
 Get the PARAM_XXXX validation to be applied to the setting. More...
 
 get_settings_depended_on ()
 Returns all of the dependencies that affect this setting. More...
 
 get_status ()
 
 get_ui ()
 Gets the user interface for this setting. More...
 
 get_ui_name ()
 
 get_ui_type ()
 
 get_value ()
 
 get_visibility ()
 
 has_dependencies_on_settings ()
 Checks if this setting is dependent on any other settings. More...
 
 has_dependent_settings ()
 Checks if there are other settings that are dependent on this setting. More...
 
 has_help ()
 Returns true if help has been set for this setting. More...
 
 is_checksum_correct ($checksum)
 Given one checksum, returns if matches object's checksum (true) or no (false)
 
 make_ui ($type, $label, array $attributes=null, array $options=null)
 Creates and sets a user interface for this setting given appropriate arguments. More...
 
 register_dependency (setting_dependency $dependency)
 Adds a dependency where another setting depends on this setting. More...
 
 set_help ($identifier, $component='moodle')
 Sets a help string for this setting. More...
 
 set_status ($status)
 
 set_ui (backup_setting_ui $ui)
 Sets the user interface for this setting. More...
 
 set_value ($value)
 
 set_visibility ($visibility)
 

Public Attributes

const ACTIVITY_LEVEL = 13
 
const CHANGED_STATUS = 3
 
const CHANGED_VALUE = 1
 
const CHANGED_VISIBILITY = 2
 
const COURSE_LEVEL = 5
 
const HIDDEN = 0
 
const IS_BOOLEAN = 'bool'
 
const IS_FILENAME = 'file'
 
const IS_INTEGER = 'int'
 
const IS_PATH = 'path'
 
const IS_TEXT = 'text'
 
const LOCKED_BY_CONFIG = 5
 
const LOCKED_BY_HIERARCHY = 7
 
const LOCKED_BY_PERMISSION = 9
 
const NOT_LOCKED = 3
 
const ROOT_LEVEL = 1
 
const SECTION_LEVEL = 9
 
const UI_HTML_CHECKBOX = 10
 
const UI_HTML_DROPDOWN = 30
 
const UI_HTML_RADIOBUTTON = 20
 
const UI_HTML_TEXTFIELD = 40
 
const UI_NONE = 0
 
const VISIBLE = 1
 

Protected Member Functions

 inform_dependencies ($ctype, $oldv)
 
 is_circular_reference ($obj)
 
 register_dependent_dependency (setting_dependency $dependency)
 Adds a dependency where this setting is dependent on another. More...
 
 validate_status ($status)
 
 validate_value ($vtype, $value)
 
 validate_visibility ($visibility)
 

Protected Attributes

setting_dependency[] $dependencies = array()
 
 $dependenton = array()
 
array $help = array()
 An array that contains the identifier and component of a help string if one has been set.
 
int $level
 Level of the setting, eg self::ROOT_LEVEL.
 
 $name
 
 $status
 
backup_setting_ui backup_setting_ui_checkbox backup_setting_ui_radio backup_setting_ui_select backup_setting_ui_text $uisetting
 The user interface for this setting.
 
 $unlockedvalue
 
 $value
 
 $visibility
 
 $vtype
 

Detailed Description

Abstract class containing all the common stuff for section backup settings.

TODO: Finish phpdocs

Member Function Documentation

◆ add_dependency()

backup_setting::add_dependency ( base_setting  $dependentsetting,
  $type = setting_dependency::DISABLED_VALUE,
  $options = array() 
)
inherited

Quick method to add a dependency to this setting.

The dependency created is done so by inspecting this setting and the setting that is passed in as the dependent setting.

Parameters
base_setting$dependentsetting
int$typeOne of setting_dependency::*
array$options

Reimplemented from base_setting.

◆ calculate_checksum()

backup_setting::calculate_checksum ( )
inherited

This function will return one unique and stable checksum for one instance of the class implementing it.

It's each implementation responsibility to do it recursively if needed and use optional store (caching) of the checksum if necessary/possible

Implements checksumable.

◆ destroy()

base_setting::destroy ( )
inherited

Destroy all circular references.

It helps PHP 5.2 a lot!

◆ get_help()

base_setting::get_help ( )
inherited

Gets the help string params for this setting if it has been set.

Return values
array|falseAn array (identifier, component) or false if not set

◆ get_level()

backup_setting::get_level ( )
inherited
Return values
intLevel of the setting, eg self::ROOT_LEVEL

◆ get_my_dependency_properties()

base_setting::get_my_dependency_properties (   $settingname = null)
inherited

Gets an array of properties for all of the dependencies that will affect this setting.

This method returns an array rather than the dependencies in order to minimise the memory footprint of for the potentially huge recursive dependency structure that we may be dealing with.

This method also ensures that all dependencies are transmuted to affect the setting in question and that we don't provide any duplicates.

Parameters
string | null$settingname
Return values
array

◆ get_param_validation()

base_setting::get_param_validation ( )
inherited

Get the PARAM_XXXX validation to be applied to the setting.

Return values
stringThe PARAM_XXXX constant of null if the setting type is not defined

◆ get_settings_depended_on()

base_setting::get_settings_depended_on ( )
inherited

Returns all of the dependencies that affect this setting.

e.g. settings this setting depends on.

Return values
arrayArray of setting_dependency's

◆ get_ui()

base_setting::get_ui ( )
inherited

Gets the user interface for this setting.

Return values
base_setting_ui

◆ has_dependencies_on_settings()

base_setting::has_dependencies_on_settings ( )
inherited

Checks if this setting is dependent on any other settings.

Return values
boolTrue if this setting is dependent on any other settings

◆ has_dependent_settings()

base_setting::has_dependent_settings ( )
inherited

Checks if there are other settings that are dependent on this setting.

Return values
boolTrue if there are other settings that are dependent on this setting

◆ has_help()

base_setting::has_help ( )
inherited

Returns true if help has been set for this setting.

Return values
cool

◆ make_ui()

backup_setting::make_ui (   $type,
  $label,
array  $attributes = null,
array  $options = null 
)
inherited

Creates and sets a user interface for this setting given appropriate arguments.

Parameters
int$type
string$label
array$attributes
array$options

◆ register_dependency()

base_setting::register_dependency ( setting_dependency  $dependency)
inherited

Adds a dependency where another setting depends on this setting.

Parameters
setting_dependency$dependency

◆ register_dependent_dependency()

base_setting::register_dependent_dependency ( setting_dependency  $dependency)
protectedinherited

Adds a dependency where this setting is dependent on another.

This should only be called internally once we are sure it is not cicrular.

Parameters
setting_dependency$dependency

◆ set_help()

base_setting::set_help (   $identifier,
  $component = 'moodle' 
)
inherited

Sets a help string for this setting.

Parameters
string$identifier
string$component

◆ set_ui()

base_setting::set_ui ( backup_setting_ui  $ui)
inherited

Sets the user interface for this setting.

Parameters
base_setting_ui$ui

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