Merge branch 'MDL-71084-master' of git://github.com/peterRd/moodle

This commit is contained in:
Travis CI 2021-03-23 13:57:13 +08:00
commit fa7c534032
4 changed files with 33 additions and 13 deletions

View file

@ -30,6 +30,8 @@ use navigation_node;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class secondary extends view {
/** @var string $headertitle The header for this particular menu*/
public $headertitle;
/**
* Defines the default structure for the secondary nav in a course context.
*
@ -116,14 +118,17 @@ class secondary extends view {
}
$this->id = 'secondary_navigation';
$context = $this->context;
$this->headertitle = get_string('menu');
switch ($context->contextlevel) {
case CONTEXT_COURSE:
if ($this->page->course->id != $SITE->id) {
$this->headertitle = get_string('courseheader');
$this->load_course_navigation();
}
break;
case CONTEXT_MODULE:
$this->headertitle = get_string('activityheader');
$this->load_module_navigation();
break;
case CONTEXT_SYSTEM:

View file

@ -36,6 +36,8 @@ abstract class view extends navigation_node {
protected $page;
/** @var bool $initialised A switch to see if the navigation node is initialised */
protected $initialised = false;
/** @var navigation_node $activenode A string identifier for the active node*/
public $activenode;
/**
* Function to initialise the respective view
@ -116,7 +118,9 @@ abstract class view extends navigation_node {
$child->make_inactive();
} else {
$child->make_active();
$this->activenode = $child;
}
return $node; // We have found the active node, set the parent status, no need to continue.
}
}