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.

(no description)

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: 573 lines (21 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 2 classes


Class: base_setting  - X-Ref

This abstract class defines one basic setting

Each setting will be able to control its name, value (from a list), ui
representation (check box, drop down, text field...), visibility, status
(editable/locked...) and its hierarchy with other settings (using one
like-observer pattern.

TODO: Finish phpdocs
__construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED)   X-Ref
Instantiates a setting object

param: string $name Name of the setting
param: string $vtype Type of the setting, eg {@link self::IS_TEXT}
param: mixed $value Value of the setting
param: bool $visibility Is the setting visible in the UI, eg {@link self::VISIBLE}
param: int $status Status of the setting with regards to the locking, eg {@link self::NOT_LOCKED}

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


get_name()   X-Ref
No description

get_value()   X-Ref
No description

get_visibility()   X-Ref
No description

get_status()   X-Ref
No description

set_value($value)   X-Ref
No description

set_visibility($visibility)   X-Ref
No description

set_status($status)   X-Ref
No description

get_my_dependency_properties($settingname=null)   X-Ref
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.

param: string|null $settingname
return: array

get_settings_depended_on()   X-Ref
Returns all of the dependencies that affect this setting.
e.g. settings this setting depends on.

return: array Array of setting_dependency's

has_dependent_settings()   X-Ref
Checks if there are other settings that are dependent on this setting

return: bool True if there are other settings that are dependent on this setting

has_dependencies_on_settings()   X-Ref
Checks if this setting is dependent on any other settings

return: bool True if this setting is dependent on any other settings

set_ui(backup_setting_ui $ui)   X-Ref
Sets the user interface for this setting

param: base_setting_ui $ui

get_ui()   X-Ref
Gets the user interface for this setting

return: base_setting_ui

register_dependency(setting_dependency $dependency)   X-Ref
Adds a dependency where another setting depends on this setting.

param: setting_dependency $dependency

register_dependent_dependency(setting_dependency $dependency)   X-Ref
Adds a dependency where this setting is dependent on another.

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

param: setting_dependency $dependency

add_dependency(base_setting $dependentsetting, $type=null, $options=array()   X-Ref
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.

param: base_setting $dependentsetting
param: int $type One of setting_dependency::*
param: array $options

get_param_validation()   X-Ref
Get 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

validate_value($vtype, $value)   X-Ref
No description

validate_visibility($visibility)   X-Ref
No description

validate_status($status)   X-Ref
No description

inform_dependencies($ctype, $oldv)   X-Ref
No description

is_circular_reference($obj)   X-Ref
No description

get_dependencies()   X-Ref
No description

get_ui_name()   X-Ref
No description

get_ui_type()   X-Ref
No description

set_help($identifier, $component='moodle')   X-Ref
Sets a help string for this setting

param: string $identifier
param: string $component

get_help()   X-Ref
Gets the help string params for this setting if it has been set

return: array|false An array (identifier, component) or false if not set

has_help()   X-Ref
Returns true if help has been set for this setting

return: cool

Class: base_setting_exception  - X-Ref

__construct($errorcode, $a=NULL, $debuginfo=null)   X-Ref
No description