Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 39 and 402]

This file contains the setting user interface classes that all backup/restore settings use to represent the UI they have.

Copyright: 2010 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 787 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 10 classes

base_setting_ui:: (13 methods):
  __construct()
  destroy()
  get_name()
  get_label()
  get_type()
  get_attributes()
  get_value()
  get_static_value()
  get_param_validation()
  set_label()
  disable()
  set_icon()
  get_icon()

backup_setting_ui:: (5 methods):
  __construct()
  make()
  apply_options()
  get_label()
  is_changeable()

backup_setting_ui_text:: (1 method):
  get_element_properties()

backup_setting_ui_checkbox:: (6 methods):
  __construct()
  get_element_properties()
  set_text()
  get_static_value()
  is_changeable()
  set_changeable()

backup_setting_ui_radio:: (5 methods):
  __construct()
  get_element_properties()
  set_text()
  set_value()
  get_static_value()

backup_setting_ui_select:: (6 methods):
  __construct()
  get_element_properties()
  set_values()
  get_static_value()
  is_changeable()
  get_values()

backup_setting_ui_dateselector:: (2 methods):
  get_element_properties()
  get_static_value()

backup_setting_ui_defaultcustom:: (3 methods):
  __construct()
  get_element_properties()
  get_static_value()

base_setting_ui_exception:: (0 methods):

backup_setting_ui_exception:: (0 methods):


Class: base_setting_ui  - X-Ref

Abstract class used to represent the user interface that a setting has.

__construct(base_setting $setting)   X-Ref
Constructors are sooooo cool

param: base_setting $setting

destroy()   X-Ref
Destroy all circular references. It helps PHP 5.2 a lot!


get_name()   X-Ref
Gets the name of this item including its prefix

return: string

get_label()   X-Ref
Gets the name of this item including its prefix

return: string

get_type()   X-Ref
Gets the type of this element

return: int

get_attributes()   X-Ref
Gets the HTML attributes for this item

return: array

get_value()   X-Ref
Gets the value of this setting

return: mixed

get_static_value()   X-Ref
Gets the value to display in a static quickforms element

return: mixed

get_param_validation()   X-Ref
Gets the the PARAM_XXXX validation to be applied to the setting

return string The PARAM_XXXX constant of null if the setting type is not defined

set_label(string $label)   X-Ref
Sets the label.

param: string $label

disable()   X-Ref
Disables the UI for this element


set_icon(pix_icon $icon)   X-Ref
Sets the icon to display next to this item

param: pix_icon $icon

get_icon()   X-Ref
Returns the icon to display next to this item, or false if there isn't one.

return: pix_icon|false

Class: backup_setting_ui  - X-Ref

Abstract class to represent the user interface backup settings have

__construct(backup_setting $setting, $label = null, array $attributes = null, array $options = null)   X-Ref
JAC... Just Another Constructor

param: backup_setting $setting
param: string $label The label to display with the setting ui
param: array $attributes Array of HTML attributes to apply to the element
param: array $options Array of options to apply to the setting ui object

make(backup_setting $setting, $type, $label, array $attributes = null, array $options = null)   X-Ref
Creates a new backup setting ui based on the setting it is given

param: backup_setting $setting
param: int $type The backup_setting UI type. One of backup_setting::UI_*;
param: string $label The label to display with the setting ui
param: array $attributes Array of HTML attributes to apply to the element
param: array $options Array of options to apply to the setting ui object
return: backup_setting_ui_text|backup_setting_ui_checkbox|backup_setting_ui_select|backup_setting_ui_radio

apply_options(array $properties)   X-Ref
Applies config options to a given properties array and then returns it

param: array $properties
return: array

get_label(base_task $task = null)   X-Ref
Gets the label for this item

param: base_task $task Optional, if provided and the setting is an include
return: string

is_changeable($level = null)   X-Ref
Returns true if the setting is changeable.

A setting is changeable if it meets either of the two following conditions.

1. The setting is not locked
2. The setting is locked but only by settings that are of the same level (same page)

Condition 2 is really why we have this function
param: int $level Optional, if provided only depedency_settings below or equal to this level are considered,
return: bool

Class: backup_setting_ui_text  - X-Ref

A text input user interface element for backup settings

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, attributes)

Class: backup_setting_ui_checkbox  - X-Ref

A checkbox user interface element for backup settings (default)

__construct(backup_setting $setting, $label = null, $text = null, array $attributes = array()   X-Ref
Overridden constructor so we can take text argument

param: backup_setting $setting
param: string $label
param: string $text
param: array $attributes
param: array $options

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, text, attributes);

set_text($text)   X-Ref
Sets the text for the element

param: string $text

get_static_value()   X-Ref
Gets the static value for the element

return: string

is_changeable($level = null)   X-Ref
Returns true if the setting is changeable

param: int $level Optional, if provided only depedency_settings below or equal to this level are considered,
return: bool

set_changeable($newvalue)   X-Ref
Sets whether the setting is changeable,
Note dependencies can still mark this setting changeable or not

param: bool $newvalue

Class: backup_setting_ui_radio  - X-Ref

Radio button user interface element for backup settings

__construct(backup_setting $setting, $label = null, $text = null, $value = null, array $attributes = array()   X-Ref
Constructor

param: backup_setting $setting
param: string $label
param: string $text
param: string $value
param: array $attributes
param: array $options

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, text, value, attributes)

set_text($text)   X-Ref
Sets the text next to this input

param: text $text

set_value($value)   X-Ref
Sets the value for the input

param: string $value

get_static_value()   X-Ref
Gets the static value to show for the element


Class: backup_setting_ui_select  - X-Ref

A select box, drop down user interface for backup settings

__construct(backup_setting $setting, $label = null, $values = null, array $attributes = array()   X-Ref
Constructor

param: backup_setting $setting
param: string $label
param: array $values
param: array $attributes
param: array $options

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, options, attributes)

set_values(array $values)   X-Ref
Sets the options for the select box

param: array $values Associative array of value => text options

get_static_value()   X-Ref
Gets the static value for this select element

return: string

is_changeable($level = null)   X-Ref
Returns true if the setting is changeable, false otherwise

param: int $level Optional, if provided only depedency_settings below or equal to this level are considered,
return: bool

get_values()   X-Ref
Returns the list of available values

return: array

Class: backup_setting_ui_dateselector  - X-Ref

A date selector user interface widget for backup settings.

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, options, attributes)

get_static_value()   X-Ref
Gets the static value for this select element

return: string

Class: backup_setting_ui_defaultcustom  - X-Ref

A wrapper for defaultcustom form element - can have either text or date_selector type

__construct(backup_setting $setting, $label = null, array $attributes = null, array $options = null)   X-Ref
Constructor

param: backup_setting $setting
param: string $label The label to display with the setting ui
param: array $attributes Array of HTML attributes to apply to the element
param: array $options Array of options to apply to the setting ui object

get_element_properties(base_task $task = null, renderer_base $output = null)   X-Ref
Returns an array of properties suitable for generating a quickforms element

param: base_task $task
param: renderer_base $output
return: array (element, name, label, options, attributes)

get_static_value()   X-Ref
Gets the static value for this select element

return: string

Class: base_setting_ui_exception  - X-Ref

Base setting UI exception class.

Class: backup_setting_ui_exception  - X-Ref

Backup setting UI exception class.