Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-39790_master' of git://github.com/totara/openbadges…

… into MOODLE_25_STABLE
  • Loading branch information...
commit ef8a1c4908995aa9b224f7efd52c817db4b1acf8 2 parents 0f51a82 + 626c84b
@stronk7 stronk7 authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 blocks/badges/block_badges.php
View
14 blocks/badges/block_badges.php
@@ -52,7 +52,7 @@ public function applicable_formats() {
return array(
'admin' => false,
'site-index' => true,
- 'course-view' => false,
+ 'course-view' => true,
'mod' => false,
'my' => true
);
@@ -88,8 +88,16 @@ public function get_content() {
if (empty($CFG->enablebadges)) {
$this->content->text .= get_string('badgesdisabled', 'badges');
- } else if ($badges = badges_get_user_badges($USER->id, null, 0, $this->config->numberofbadges)) {
- $output = $PAGE->get_renderer('core', 'badges');
+ return $this->content;
+ }
+
+ $courseid = $this->page->course->id;
+ if ($courseid == SITEID) {
+ $courseid = null;
+ }
+
+ if ($badges = badges_get_user_badges($USER->id, $courseid, 0, $this->config->numberofbadges)) {
+ $output = $this->page->get_renderer('core', 'badges');
$this->content->text = $output->print_badges_list($badges, $USER->id, true);
} else {
$this->content->text .= get_string('nothingtodisplay', 'block_badges');
Please sign in to comment.
Something went wrong with that request. Please try again.