MDL-56993 boost: Fix navigation for singleactivity format

The single activity course format has no course front page, so we need
to make a special case for it so it's possible to get to the course
admin menu and put the course nodes in the flat navigation.
This commit is contained in:
Damyon Wiese
2016-11-23 15:31:27 +08:00
parent 0fbe41f4cd
commit ea5084f7f1
2 changed files with 92 additions and 43 deletions
+9 -1
View File
@@ -3724,8 +3724,16 @@ class flat_navigation extends navigation_node_collection {
$flat = new flat_navigation_node(navigation_node::create($course->shortname, $url), 0);
$flat->key = 'coursehome';
$courseformat = course_get_format($course);
$coursenode = $PAGE->navigation->find_active_node();
while (!empty($coursenode) && ($coursenode->type != navigation_node::TYPE_COURSE)) {
$targettype = navigation_node::TYPE_COURSE;
// Single activity format has no course node - the course node is swapped for the activity node.
if (!$courseformat->has_view_page()) {
$targettype = navigation_node::TYPE_ACTIVITY;
}
while (!empty($coursenode) && ($coursenode->type != $targettype)) {
$coursenode = $coursenode->parent;
}
// There is one very strange page in mod/feedback/view.php which thinks it is both site and course