From 0acc8728f2b83a386b70be910649d7f5952eb4b5 Mon Sep 17 00:00:00 2001 From: Pavel Sokolov Date: Thu, 18 May 2017 16:32:23 +0200 Subject: [PATCH] Reverting back Current Course --- lib/navigationlib.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 13c5ae77f7..bfe2036f21 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1236,6 +1236,7 @@ class global_navigation extends navigation_node { $enrolledinanycourse = enrol_user_sees_own_courses(); $this->rootnodes['currentcourse']->mainnavonly = true; + $this->rootnodes['currentcourse']->forceopen = true; if ($enrolledinanycourse) { $this->rootnodes['mycourses']->isexpandable = true; $this->rootnodes['mycourses']->showinflatnavigation = true; @@ -1246,7 +1247,7 @@ class global_navigation extends navigation_node { } else { $this->rootnodes['courses']->isexpandable = true; } - $this->rootnodes['mycourses']->forceopen = true; + $this->rootnodes['mycourses']->forceopen = false; $canviewcourseprofile = true; @@ -2519,6 +2520,7 @@ class global_navigation extends navigation_node { // This is the name that will be shown for the course. $coursename = empty($CFG->navshowfullcoursenames) ? $shortname : $fullname; + /* if ($coursetype == self::COURSE_CURRENT) { if ($coursenode = $this->rootnodes['mycourses']->find($course->id, self::TYPE_COURSE)) { return $coursenode; @@ -2526,6 +2528,7 @@ class global_navigation extends navigation_node { $coursetype = self::COURSE_OTHER; } } + */ // Can the user expand the course to see its content. $canexpandcourse = true; @@ -2945,7 +2948,11 @@ class global_navigation extends navigation_node { } } foreach ($courses as $course) { - $this->add_course($course, false, self::COURSE_MY); + if ($this->page->course->id == $course->id) { + $this->add_course($course, false, self::COURSE_CURRENT); + } else { + $this->add_course($course, false, self::COURSE_MY); + } } } } -- 2.11.0 (Apple Git-81)