Skip to content

Commit

Permalink
Merge branch 'MDL-63960-33' of git://github.com/andrewnicols/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_33_STABLE
  • Loading branch information
stronk7 committed Nov 10, 2018
2 parents 51894a8 + 97e8c0a commit 2582943
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 8 deletions.
16 changes: 8 additions & 8 deletions admin/tool/dataprivacy/classes/data_registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public static function get_defaults($contextlevel, $pluginname = '') {
if (!empty($pluginname)) {
list($purposevar, $categoryvar) = self::var_names_from_context($classname);
// If the plugin-level doesn't have a default purpose set, try the context level.
if ($purposeid === false) {
if ($purposeid == false) {
$purposeid = get_config('tool_dataprivacy', $purposevar);
}

// If the plugin-level doesn't have a default category set, try the context level.
if ($categoryid === false) {
if ($categoryid == false) {
$categoryid = get_config('tool_dataprivacy', $categoryvar);
}
}
Expand Down Expand Up @@ -186,11 +186,11 @@ public static function get_effective_context_value(\context $context, $element,
}
$fieldname = $element . 'id';

if (!empty($forcedvalue) && ($forcedvalue === context_instance::INHERIT)) {
if (!empty($forcedvalue) && ($forcedvalue == context_instance::INHERIT)) {
// Do not include the current context when calculating the value.
// This has the effect that an inheritted value is calculated.
$parentcontextids = $context->get_parent_context_ids(false);
} else if (!empty($forcedvalue) && ($forcedvalue !== context_instance::NOTSET)) {
} else if (!empty($forcedvalue) && ($forcedvalue != context_instance::NOTSET)) {
return self::get_element_instance($element, $forcedvalue);
} else {
// Fetch all parent contexts, including self.
Expand Down Expand Up @@ -239,7 +239,7 @@ public static function get_effective_context_value(\context $context, $element,
$checkcontextlevel = true;
}

if (!empty($forcedvalue) && context_instance::NOTSET === $forcedvalue) {
if (!empty($forcedvalue) && context_instance::NOTSET == $forcedvalue) {
$checkcontextlevel = true;
}

Expand All @@ -251,7 +251,7 @@ public static function get_effective_context_value(\context $context, $element,

$instancevalue = $$fieldname;

if (context_instance::NOTSET !== $instancevalue && context_instance::INHERIT !== $instancevalue) {
if (context_instance::NOTSET != $instancevalue && context_instance::INHERIT != $instancevalue) {
// There is an actual value. Return it.
return self::get_element_instance($element, $instancevalue);
}
Expand Down Expand Up @@ -292,7 +292,7 @@ public static function get_effective_contextlevel_value($contextlevel, $element)
list($purposeid, $categoryid) = self::get_effective_default_contextlevel_purpose_and_category($contextlevel);

// Note: The $$fieldname points to either $purposeid, or $categoryid.
if (context_instance::NOTSET !== $$fieldname && context_instance::INHERIT !== $$fieldname) {
if (context_instance::NOTSET != $$fieldname && context_instance::INHERIT != $$fieldname) {
// There is a specific value set.
return self::get_element_instance($element, $$fieldname);
}
Expand Down Expand Up @@ -327,7 +327,7 @@ public static function get_effective_default_contextlevel_purpose_and_category($
list($parentpurposeid, $parentcategoryid) = self::get_defaults(CONTEXT_SYSTEM);

if (context_instance::INHERIT == $purposeid || context_instance::NOTSET == $purposeid) {
$purposeid = $parentpurposeid;
$purposeid = (int)$parentpurposeid;
}

if (context_instance::INHERIT == $categoryid || context_instance::NOTSET == $categoryid) {
Expand Down
Loading

0 comments on commit 2582943

Please sign in to comment.