Permalink
Browse files

MDL-41659 badges: Display course/site names through format_string()

  • Loading branch information...
1 parent c777836 commit 320376f0b700d9631c10bc214cc118f6c4e89160 @ybozhko ybozhko committed Sep 20, 2013
Showing with 14 additions and 9 deletions.
  1. +2 −1 badges/criteria/award_criteria_courseset.php
  2. +3 −2 badges/index.php
  3. +5 −3 badges/newbadge.php
  4. +2 −2 badges/renderer.php
  5. +2 −1 badges/view.php
@@ -160,10 +160,11 @@ public function get_options(&$mform) {
// In courseset, print out only the ones that were already selected.
foreach ($this->params as $p) {
if ($course = $DB->get_record('course', array('id' => $p['course']))) {
+ $coursecontext = context_course::instance($course->id);
$param = array(
'id' => $course->id,
'checked' => true,
- 'name' => ucfirst($course->fullname),
+ 'name' => ucfirst(format_string($course->fullname, true, array('context' => $coursecontext))),
'error' => false
);
View
@@ -82,10 +82,11 @@
navigation_node::override_active_url(new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_SITE)));
} else {
require_login($course);
+ $coursecontext = context_course::instance($course->id);
$title = get_string('coursebadges', 'badges');
- $PAGE->set_context(context_course::instance($course->id));
+ $PAGE->set_context($coursecontext);
$PAGE->set_pagelayout('course');
- $PAGE->set_heading($course->fullname . ': ' . $hdr);
+ $PAGE->set_heading(format_string($course->fullname, true, array('context' => $coursecontext)) . ': ' . $hdr);
navigation_node::override_active_url(
new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_COURSE, 'id' => $course->id))
);
View
@@ -45,11 +45,13 @@
if (($type == BADGE_TYPE_COURSE) && ($course = $DB->get_record('course', array('id' => $courseid)))) {
require_login($course);
- $PAGE->set_context(context_course::instance($course->id));
+ $coursecontext = context_course::instance($course->id);
+ $PAGE->set_context($coursecontext);
$PAGE->set_pagelayout('course');
$PAGE->set_url('/badges/newbadge.php', array('type' => $type, 'id' => $course->id));
- $PAGE->set_heading($course->fullname . ": " . $title);
- $PAGE->set_title($course->fullname . ": " . $title);
+ $heading = format_string($course->fullname, true, array('context' => $coursecontext)) . ": " . $title;
+ $PAGE->set_heading($heading);
+ $PAGE->set_title($heading);
} else {
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('admin');
View
@@ -494,8 +494,8 @@ protected function render_badge_user_collection(badge_user_collection $badges) {
// Local badges.
$localhtml = html_writer::start_tag('fieldset', array('id' => 'issued-badge-table', 'class' => 'generalbox'));
- $localhtml .= html_writer::tag('legend',
- $this->output->heading_with_help(get_string('localbadges', 'badges', $SITE->fullname), 'localbadgesh', 'badges'));
+ $heading = get_string('localbadges', 'badges', format_string($SITE->fullname, true, array('context' => context_system::instance())));
+ $localhtml .= html_writer::tag('legend', $this->output->heading_with_help($heading, 'localbadgesh', 'badges'));
if ($badges->badges) {
$table = new html_table();
$table->attributes['class'] = 'statustable';
View
@@ -68,7 +68,8 @@
$PAGE->set_heading($title);
} else {
require_login($course);
- $title = $course->fullname . ': ' . get_string('coursebadges', 'badges');
+ $coursename = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
+ $title = $coursename . ': ' . get_string('coursebadges', 'badges');
$PAGE->set_context(context_course::instance($course->id));
$PAGE->set_pagelayout('course');
$PAGE->set_heading($title);

0 comments on commit 320376f

Please sign in to comment.