Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Generic abstract dependency class. More...
Public Member Functions | |
__construct (base_setting $setting, base_setting $dependentsetting, $defaultvalue=false) | |
Creates the dependency object. More... | |
destroy () | |
Destroy all circular references. More... | |
enforce () | |
This function enforces the dependency. | |
get_dependent_setting () | |
Gets the dependent setting. More... | |
get_moodleform_properties () | |
Returns an array of properties suitable to be used to define a moodleforms disabled command. More... | |
get_setting () | |
Gets the primary setting. More... | |
is_locked () | |
Returns true if the dependent setting is locked by this setting_dependency. More... | |
process_change ($changetype, $oldvalue) | |
Processes a change is setting called by the primary setting. More... | |
Public Attributes | |
const | DISABLED_CHECKED = 4 |
const | DISABLED_EMPTY = 6 |
const | DISABLED_FALSE = 3 |
const | DISABLED_NOT_CHECKED = 5 |
const | DISABLED_NOT_EMPTY = 7 |
const | DISABLED_NOT_VALUE = 1 |
const | DISABLED_TRUE = 2 |
const | DISABLED_VALUE = 0 |
Used to define the type of a dependency. More... | |
Protected Member Functions | |
process_status_change ($oldstatus) | |
All dependencies must define how they would like to deal with a status change. More... | |
process_value_change ($oldvalue) | |
All dependencies must define how they would like to process a value change. | |
process_visibility_change ($oldvisibility) | |
Processes a visibility change. More... | |
Protected Attributes | |
mixed | $defaultvalue |
The default setting. | |
base_setting | $dependentsetting |
The dependent setting (secondary) | |
mixed | $lastvalue |
The last value the dependent setting had. | |
base_setting | $setting |
The parent setting (primary) | |
Generic abstract dependency class.
setting_dependency::__construct | ( | base_setting | $setting, |
base_setting | $dependentsetting, | ||
$defaultvalue = false |
|||
) |
Creates the dependency object.
base_setting | $setting | The parent setting or the primary setting if you prefer |
base_setting | $dependentsetting | The dependent setting |
mixed | $defaultvalue | The default value to assign if the dependency is unmet |
Reimplemented in setting_dependency_disabledif_empty, setting_dependency_disabledif_not_empty, setting_dependency_disabledif_not_checked, and setting_dependency_disabledif_checked.
setting_dependency::destroy | ( | ) |
Destroy all circular references.
It helps PHP 5.2 a lot!
setting_dependency::get_dependent_setting | ( | ) |
Gets the dependent setting.
backup_setting |
|
abstract |
Returns an array of properties suitable to be used to define a moodleforms disabled command.
array |
Reimplemented in setting_dependency_disabledif_empty, setting_dependency_disabledif_not_empty, setting_dependency_disabledif_not_checked, setting_dependency_disabledif_checked, setting_dependency_disabledif_in_array, setting_dependency_disabledif_not_equals, and setting_dependency_disabledif_equals.
setting_dependency::get_setting | ( | ) |
Gets the primary setting.
backup_setting |
|
abstract |
Returns true if the dependent setting is locked by this setting_dependency.
bool |
Reimplemented in setting_dependency_disabledif_equals.
|
final |
Processes a change is setting called by the primary setting.
int | $changetype | |
mixed | $oldvalue |
bool |
|
abstractprotected |
All dependencies must define how they would like to deal with a status change.
int | $oldstatus |
Reimplemented in setting_dependency_disabledif_equals.
|
protected |
Processes a visibility change.
bool | $oldvisibility |
bool |
const setting_dependency::DISABLED_VALUE = 0 |
Used to define the type of a dependency.
Note with these that checked and true, and not checked and false are equal. This is because the terminology differs but the resulting action is the same. Reduces code!