Permalink
Browse files

Merge branch 'wip-MDL-58594-v2' of https://github.com/marinaglancy/mo…

  • Loading branch information...
dmonllao committed May 4, 2017
2 parents 2e3c23b + 0302548 commit 175a51c47295db5d517b817cb64cb421725f2bba
Showing with 12 additions and 0 deletions.
  1. +7 −0 backup/util/settings/base_setting.class.php
  2. +5 −0 backup/util/settings/setting_dependency.class.php
@@ -70,6 +70,7 @@
protected $visibility; // visibility of the setting (setting_base::VISIBLE/setting_base::HIDDEN)
protected $status; // setting_base::NOT_LOCKED/setting_base::LOCKED_BY_PERMISSION...
/** @var setting_dependency[] */
protected $dependencies = array(); // array of dependent (observer) objects (usually setting_base ones)
protected $dependenton = array();
@@ -201,6 +202,12 @@ public function set_visibility($visibility) {
public function set_status($status) {
$status = $this->validate_status($status);
if (($this->status == base_setting::LOCKED_BY_PERMISSION || $this->status == base_setting::LOCKED_BY_CONFIG)
&& $status == base_setting::LOCKED_BY_HIERARCHY) {
// Lock by permission or config can not be overriden by lock by hierarchy.
return;
}
// If the setting is being unlocked first check whether an other settings
// this setting is dependent on are locked. If they are then we still don't
// want to lock this setting.
@@ -202,6 +202,11 @@ public function is_locked() {
* @return bool
*/
protected function process_value_change($oldvalue) {
if ($this->dependentsetting->get_status() == base_setting::LOCKED_BY_PERMISSION ||
$this->dependentsetting->get_status() == base_setting::LOCKED_BY_CONFIG) {
// When setting is locked by permission or config do not apply dependencies.
return false;
}
$prevalue = $this->dependentsetting->get_value();
// If the setting is the desired value enact the dependency
if ($this->setting->get_value() == $this->value) {

0 comments on commit 175a51c

Please sign in to comment.