Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
setting_dependency_disabledif_not_checked Class Reference

A dependency that disables the secondary element if the primary element is false or not checked. More...

Inheritance diagram for setting_dependency_disabledif_not_checked:
setting_dependency_disabledif_equals setting_dependency

Public Member Functions

 __construct (base_setting $setting, base_setting $dependentsetting, $defaultvalue=false)
 Creates the dependency object.
 
 destroy ()
 Destroy all circular references.
 
 enforce ()
 Enforces the dependency if required.
 
 get_dependent_setting ()
 Gets the dependent setting.
 
 get_moodleform_properties ()
 Returns an array of properties suitable to be used to define a moodleforms disabled command.
 
 get_setting ()
 Gets the primary setting.
 
 is_locked ()
 Returns true if the dependent setting is locked by this setting_dependency.
 
 process_change ($changetype, $oldvalue)
 Processes a change is setting called by the primary setting.
 

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.
 

Protected Member Functions

 evaluate_disabled_condition ($value)
 Evaluate the current value of the setting and return true if the dependent setting should be locked or false.
 
 process_status_change ($oldstatus)
 Processes a status change in the primary setting.
 
 process_value_change ($oldvalue)
 Processes a value change in the primary setting.
 
 process_visibility_change ($oldvisibility)
 Processes a visibility change.
 

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)
 
mixed $value
 The value to compare to.
 

Detailed Description

A dependency that disables the secondary element if the primary element is false or not checked.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

setting_dependency_disabledif_not_checked::__construct ( base_setting $setting,
base_setting $dependentsetting,
$defaultvalue = false )

Creates the dependency object.

Parameters
base_setting$settingThe parent setting or the primary setting if you prefer
base_setting$dependentsettingThe dependent setting
mixed$defaultvalueThe default value to assign if the dependency is unmet

Reimplemented from setting_dependency.

Member Function Documentation

◆ destroy()

setting_dependency::destroy ( )
inherited

Destroy all circular references.

It helps PHP 5.2 a lot!

◆ enforce()

setting_dependency_disabledif_equals::enforce ( )
inherited

Enforces the dependency if required.

Return values
boolTrue if there were changes

Reimplemented from setting_dependency.

◆ evaluate_disabled_condition()

setting_dependency_disabledif_equals::evaluate_disabled_condition ( $value)
protectedinherited

Evaluate the current value of the setting and return true if the dependent setting should be locked or false.

This function should be abstract, but there will probably be existing sub-classes so we must provide a default implementation.

Parameters
mixed$valueThe value of the parent setting.
Return values
bool

Reimplemented in setting_dependency_disabledif_empty, setting_dependency_disabledif_in_array, setting_dependency_disabledif_not_empty, and setting_dependency_disabledif_not_equals.

◆ get_dependent_setting()

setting_dependency::get_dependent_setting ( )
inherited

Gets the dependent setting.

Return values
backup_setting

◆ get_moodleform_properties()

setting_dependency_disabledif_not_checked::get_moodleform_properties ( )

Returns an array of properties suitable to be used to define a moodleforms disabled command.

Return values
array

Reimplemented from setting_dependency_disabledif_equals.

◆ get_setting()

setting_dependency::get_setting ( )
inherited

Gets the primary setting.

Return values
backup_setting

◆ is_locked()

setting_dependency_disabledif_equals::is_locked ( )
inherited

Returns true if the dependent setting is locked by this setting_dependency.

Return values
bool

Reimplemented from setting_dependency.

◆ process_change()

setting_dependency::process_change ( $changetype,
$oldvalue )
finalinherited

Processes a change is setting called by the primary setting.

Parameters
int$changetype
mixed$oldvalue
Return values
bool

◆ process_status_change()

setting_dependency_disabledif_equals::process_status_change ( $oldstatus)
protectedinherited

Processes a status change in the primary setting.

Parameters
mixed$oldstatus
Return values
bool

Reimplemented from setting_dependency.

◆ process_value_change()

setting_dependency_disabledif_equals::process_value_change ( $oldvalue)
protectedinherited

Processes a value change in the primary setting.

Parameters
mixed$oldvalue
Return values
bool

Reimplemented from setting_dependency.

◆ process_visibility_change()

setting_dependency::process_visibility_change ( $oldvisibility)
protectedinherited

Processes a visibility change.

Parameters
bool$oldvisibility
Return values
bool

Member Data Documentation

◆ DISABLED_VALUE

const setting_dependency::DISABLED_VALUE = 0
inherited

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!


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