Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-38055 block_courseoverview: fixed formatting of course fullname

  • Loading branch information...
commit a9ff59979fbda8d26214013eb8da7440614d2bd5 1 parent 4e83302
Sam Hemelryk authored March 04, 2013

Showing 1 changed file with 8 additions and 5 deletions. Show diff stats Hide diff stats

  1. 13  blocks/course_overview/renderer.php
13  blocks/course_overview/renderer.php
@@ -87,13 +87,17 @@ public function course_overview($courses, $overviews) {
87 87
             if ($ismovingcourse && ($course->id == $movingcourseid)) {
88 88
                 continue;
89 89
             }
  90
+
  91
+            $context = context_course::instance($course->id);
  92
+            $fullname = format_string($course->fullname, true, array('context' => $context));
  93
+
90 94
             $html .= $this->output->box_start('coursebox', "course-{$course->id}");
91 95
             $html .= html_writer::start_tag('div', array('class' => 'course_title'));
92 96
             // If user is editing, then add move icons.
93 97
             if ($userediting && !$ismovingcourse) {
94 98
                 $moveicon = html_writer::empty_tag('img',
95 99
                         array('src' => $this->pix_url('t/move')->out(false),
96  
-                            'alt' => get_string('movecourse', 'block_course_overview', $course->fullname),
  100
+                            'alt' => get_string('movecourse', 'block_course_overview', $fullname),
97 101
                             'title' => get_string('move')));
98 102
                 $moveurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'movecourse' => 1, 'courseid' => $course->id));
99 103
                 $moveurl = html_writer::link($moveurl, $moveicon);
@@ -101,11 +105,10 @@ public function course_overview($courses, $overviews) {
101 105
 
102 106
             }
103 107
 
104  
-            $attributes = array('title' => s($course->fullname));
  108
+            $attributes = array('title' => str_replace('&', '&', $fullname));
105 109
             if ($course->id > 0) {
106 110
                 $courseurl = new moodle_url('/course/view.php', array('id' => $course->id));
107  
-                $coursefullname = format_string($course->fullname, true, $course->id);
108  
-                $link = html_writer::link($courseurl, $coursefullname, $attributes);
  111
+                $link = html_writer::link($courseurl, $fullname, $attributes);
109 112
                 $html .= $this->output->heading($link, 2, 'title');
110 113
             } else {
111 114
                 $html .= $this->output->heading(html_writer::link(
@@ -135,7 +138,7 @@ public function course_overview($courses, $overviews) {
135 138
                             array('sesskey' => sesskey(), 'moveto' => $courseordernumber, 'courseid' => $movingcourseid));
136 139
                 $a = new stdClass();
137 140
                 $a->movingcoursename = $courses[$movingcourseid]->fullname;
138  
-                $a->currentcoursename = $course->fullname;
  141
+                $a->currentcoursename = $fullname;
139 142
                 $movehereicon = html_writer::empty_tag('img',
140 143
                         array('src' => $this->output->pix_url('movehere'),
141 144
                             'alt' => get_string('moveafterhere', 'block_course_overview', $a),

0 notes on commit a9ff599

Please sign in to comment.
Something went wrong with that request. Please try again.