mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
navigation MDL-14632 Fixed issue when administration settings block is unable to locate the active page
This commit is contained in:
parent
7081714dc4
commit
25b550d2db
@ -2093,6 +2093,8 @@ class settings_navigation extends navigation_node {
|
||||
if ($currentnode) {
|
||||
$currentnode->make_active();
|
||||
}
|
||||
} else {
|
||||
$this->scan_for_active_node($referencebranch);
|
||||
}
|
||||
return $referencebranch;
|
||||
} else if ($adminbranch->check_access()) {
|
||||
@ -2133,6 +2135,19 @@ class settings_navigation extends navigation_node {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function recursivily scans nodes until it finds the active node or there
|
||||
* are no more nodes.
|
||||
* @param navigation_node $node
|
||||
*/
|
||||
protected function scan_for_active_node(navigation_node $node) {
|
||||
if (!$node->check_if_active() && $node->children->count()>0) {
|
||||
foreach ($node->children as &$child) {
|
||||
$this->scan_for_active_node($child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a navigation node given an array of keys that represent the path to
|
||||
* the desired node.
|
||||
@ -2705,7 +2720,7 @@ class settings_navigation extends navigation_node {
|
||||
$fullname = fullname($user, has_capability('moodle/site:viewfullnames', $this->page->context));
|
||||
|
||||
// Add a user setting branch
|
||||
$usersetting = $this->add(get_string($gstitle, 'moodle', $fullname));
|
||||
$usersetting = $this->add(get_string($gstitle, 'moodle', $fullname), null, self::TYPE_CONTAINER, null, $gstitle);
|
||||
$usersetting->id = 'usersettings';
|
||||
|
||||
// Check if the user has been deleted
|
||||
|
Loading…
x
Reference in New Issue
Block a user