Permalink
Browse files

MDL-39480 core_badge: prevented a php notice

  • Loading branch information...
1 parent 95190fd commit 36388ba832828d28f79349498827dd1a142c5eed @andyjdavis andyjdavis committed May 4, 2013
Showing with 12 additions and 8 deletions.
  1. +12 −8 badges/renderer.php
View
@@ -637,12 +637,15 @@ public function print_badge_tabs($badgeid, $context, $current = 'overview') {
echo $this->tabtree($row, $current);
}
- // Prints badge status box.
+ /**
+ * Prints badge status box.
+ * @return Either the status box html as a string or null
+ */
public function print_badge_status_box(badge $badge) {
- $table = new html_table();
- $table->attributes['class'] = 'boxaligncenter statustable';
-
if (has_capability('moodle/badges:configurecriteria', $badge->get_context())) {
+ $table = new html_table();
+ $table->attributes['class'] = 'boxaligncenter statustable';
+
if (!$badge->has_criteria()) {
$criteriaurl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
$status = get_string('nocriteria', 'badges');
@@ -669,12 +672,13 @@ public function print_badge_status_box(badge $badge) {
}
$row = array($status . $this->output->help_icon('status', 'badges'), $action);
}
- }
+ $table->data[] = $row;
- $table->data[] = $row;
+ $style = $badge->is_active() ? 'generalbox statusbox active' : 'generalbox statusbox inactive';
+ return $this->output->box(html_writer::table($table), $style);
+ }
- $style = $badge->is_active() ? 'generalbox statusbox active' : 'generalbox statusbox inactive';
- return $this->output->box(html_writer::table($table), $style);
+ return null;
}
// Prints badge criteria.

0 comments on commit 36388ba

Please sign in to comment.