Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37329 Navigation: Enrolled courses in category should be added only.

  • Loading branch information...
commit 2225d0cfe6de61afe371c3197feb7e51d02095a2 1 parent d432ff9
@rajeshtaneja rajeshtaneja authored damyon committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/navigationlib.php
View
7 lib/navigationlib.php
@@ -2826,9 +2826,11 @@ protected function load_category($categoryid, $nodetype = self::TYPE_CATEGORY) {
ORDER BY cc.depth ASC, cc.sortorder ASC, cc.id ASC";
$params = array('categoryid1' => $categoryid, 'categoryid2' => $categoryid);
$categories = $DB->get_recordset_sql($sql, $params, 0, $limit);
+ $categorylist = array();
$subcategories = array();
$basecategory = null;
foreach ($categories as $category) {
+ $categorylist[] = $category->id;
context_helper::preload_from_record($category);
if ($category->id == $categoryid) {
$this->add_category($category, $this, $nodetype);
@@ -2849,7 +2851,10 @@ protected function load_category($categoryid, $nodetype = self::TYPE_CATEGORY) {
if ($nodetype === self::TYPE_MY_CATEGORY) {
$courses = enrol_get_my_courses();
foreach ($courses as $course) {
- $this->add_course($course, true, self::COURSE_MY);
+ // Add course if it's in category.
+ if (in_array($course->category, $categorylist)) {
+ $this->add_course($course, true, self::COURSE_MY);
+ }
}
} else {
$courses = $DB->get_recordset('course', array('category' => $categoryid), 'sortorder', '*' , 0, $limit);
Please sign in to comment.
Something went wrong with that request. Please try again.