Permalink
Browse files

MDL-39825 badges: Remove badges from course navigation when course ba…

…dges are disabled
  • Loading branch information...
1 parent 1430866 commit 8b7c33ae7744436181e591f2b52559827a54161e @ybozhko ybozhko committed Jun 10, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/navigationlib.php
View
@@ -2448,9 +2448,9 @@ public function add_course_essentials($coursenode, stdClass $course) {
}
// Badges.
- if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
- $url = new moodle_url($CFG->wwwroot . '/badges/view.php',
- array('type' => 2, 'id' => $course->id));
+ if (!empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) &&
+ has_capability('moodle/badges:viewbadges', $this->page->context)) {
+ $url = new moodle_url('/badges/view.php', array('type' => 2, 'id' => $course->id));
$coursenode->add(get_string('coursebadges', 'badges'), null,
navigation_node::TYPE_CONTAINER, null, 'coursebadges');
@@ -2499,7 +2499,7 @@ public function add_front_page_course_essentials(navigation_node $coursenode, st
}
//Badges
- if (!empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
+ if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
$coursenode->add(get_string('sitebadges', 'badges'), $url, navigation_node::TYPE_CUSTOM);
}

0 comments on commit 8b7c33a

Please sign in to comment.