Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

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

Defines 9 classes

setting_dependency:: (6 methods):
  __construct()
  destroy()
  process_change()
  process_visibility_change()
  get_setting()
  get_dependent_setting()

setting_dependency_disabledif_equals:: (7 methods):
  __construct()
  is_locked()
  process_value_change()
  process_status_change()
  enforce()
  get_moodleform_properties()
  evaluate_disabled_condition()

setting_dependency_disabledif_not_equals:: (2 methods):
  evaluate_disabled_condition()
  get_moodleform_properties()

setting_dependency_disabledif_in_array:: (2 methods):
  evaluate_disabled_condition()
  get_moodleform_properties()

setting_dependency_disabledif_equals2:: (0 methods):

setting_dependency_disabledif_checked:: (2 methods):
  __construct()
  get_moodleform_properties()

setting_dependency_disabledif_not_checked:: (2 methods):
  __construct()
  get_moodleform_properties()

setting_dependency_disabledif_not_empty:: (3 methods):
  __construct()
  evaluate_disabled_condition()
  get_moodleform_properties()

setting_dependency_disabledif_empty:: (3 methods):
  __construct()
  evaluate_disabled_condition()
  get_moodleform_properties()


Class: setting_dependency  - X-Ref

Generic abstract dependency class

__construct(base_setting $setting, base_setting $dependentsetting, $defaultvalue = false)   X-Ref
Creates the dependency object

param: base_setting $setting The parent setting or the primary setting if you prefer
param: base_setting $dependentsetting The dependent setting
param: mixed $defaultvalue The default value to assign if the dependency is unmet

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


process_change($changetype, $oldvalue)   X-Ref
Processes a change is setting called by the primary setting

param: int $changetype
param: mixed $oldvalue
return: bool

process_visibility_change($oldvisibility)   X-Ref
Processes a visibility change

param: bool $oldvisibility
return: bool

get_setting()   X-Ref
Gets the primary setting

return: backup_setting

get_dependent_setting()   X-Ref
Gets the dependent setting

return: backup_setting

Class: setting_dependency_disabledif_equals  - X-Ref

A dependency that disables the secondary setting if the primary setting is
equal to the provided value

__construct(base_setting $setting, base_setting $dependentsetting, $value, $defaultvalue = false)   X-Ref
Creates the dependency

param: base_setting $setting
param: base_setting $dependentsetting
param: mixed $value
param: mixed $defaultvalue

is_locked()   X-Ref
Returns true if the dependent setting is locked by this setting_dependency.

return: bool

process_value_change($oldvalue)   X-Ref
Processes a value change in the primary setting

param: mixed $oldvalue
return: bool

process_status_change($oldstatus)   X-Ref
Processes a status change in the primary setting

param: mixed $oldstatus
return: bool

enforce()   X-Ref
Enforces the dependency if required.

return: bool True if there were changes

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

evaluate_disabled_condition($value)   X-Ref
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.

param: mixed $value The value of the parent setting.
return: bool

Class: setting_dependency_disabledif_not_equals  - X-Ref

A dependency that disables the secondary setting if the primary setting is
not equal to the provided value

evaluate_disabled_condition($value)   X-Ref
Evaluate the current value of the setting and return true if the dependent setting should be locked or false.

param: mixed $value The value of the parent setting.
return: bool

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

Class: setting_dependency_disabledif_in_array  - X-Ref

Disable if a value is in a list.

evaluate_disabled_condition($value)   X-Ref
Evaluate the current value of the setting and return true if the dependent setting should be locked or false.

param: mixed $value The value of the parent setting.
return: bool

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

Class: setting_dependency_disabledif_equals2  - X-Ref

This class is here for backwards compatibility (terrible name).

Class: setting_dependency_disabledif_checked  - X-Ref

A dependency that disables the secondary element if the primary element is
true or checked

__construct(base_setting $setting, base_setting $dependentsetting, $defaultvalue = false)   X-Ref
No description

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

Class: setting_dependency_disabledif_not_checked  - X-Ref

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

__construct(base_setting $setting, base_setting $dependentsetting, $defaultvalue = false)   X-Ref
No description

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

Class: setting_dependency_disabledif_not_empty  - X-Ref

A dependency that disables the secondary setting if the value of the primary setting
is not empty.

__construct(base_setting $setting, base_setting $dependentsetting, $defaultvalue = false)   X-Ref
No description

evaluate_disabled_condition($value)   X-Ref
Evaluate the current value of the setting and return true if the dependent setting should be locked or false.

param: mixed $value The value of the parent setting.
return: bool

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array

Class: setting_dependency_disabledif_empty  - X-Ref

A dependency that disables the secondary setting if the value of the primary setting
is empty.

__construct(base_setting $setting, base_setting $dependentsetting, $defaultvalue = false)   X-Ref
No description

evaluate_disabled_condition($value)   X-Ref
Evaluate the current value of the setting and return true if the dependent setting should be locked or false.

param: mixed $value The value of the parent setting.
return: bool

get_moodleform_properties()   X-Ref
Returns an array of properties suitable to be used to define a moodleforms
disabled command

return: array