From fe17293d24f7a7a31f2e1236da5af201e42ba4df Mon Sep 17 00:00:00 2001 From: Pavel Sokolov Date: Wed, 26 Jul 2017 13:28:36 +0300 Subject: [PATCH] Reverting back Current Course --- lib/navigationlib.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 79981cc37a..b485e49c05 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1238,6 +1238,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; @@ -1248,7 +1249,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; @@ -2540,7 +2541,7 @@ class global_navigation extends navigation_node { $fullname = format_string($course->fullname, true, array('context' => $coursecontext)); // 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; @@ -2548,7 +2549,7 @@ class global_navigation extends navigation_node { $coursetype = self::COURSE_OTHER; } } - + */ // Can the user expand the course to see its content. $canexpandcourse = true; if ($issite) { @@ -2995,7 +2996,11 @@ class global_navigation extends navigation_node { // Go through each course now and add it to the nav block, and the flatnav if applicable. foreach ($courses as $course) { - $node = $this->add_course($course, false, self::COURSE_MY); + if ($this->page->course->id == $course->id) { + $node = $this->add_course($course, false, self::COURSE_CURRENT); + } else { + $node = $this->add_course($course, false, self::COURSE_MY); + } if ($node) { $node->showinflatnavigation = false; // Check if we should also add this to the flat nav as well. -- 2.11.0 (Apple Git-81)