Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch MDL-29187-m21 of git://github.com/samhemelryk/moodle

  - resolved conflict.
  • Loading branch information...
commit 6519a7769d8d3035fbac8af4056853879c6eebcb 2 parents 995b4d1 + 5da6f4e
@nebgor nebgor authored
View
2  backup/util/ui/renderer.php
@@ -629,7 +629,7 @@ public function render_restore_category_search(restore_category_search $componen
}
$row->cells = array(
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'targetid', 'value'=>$category->id)),
- $category->name,
+ format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id))),
format_text($category->description, $category->descriptionformat, array('overflowdiv'=>true))
);
$table->data[] = $row;
View
5 blocks/course_list/block_course_list.php
@@ -57,8 +57,9 @@ function get_content() {
if ($categories) { //Check we have categories
if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links
foreach ($categories as $category) {
+ $categoryname = format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id)));
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
- $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">".$icon . format_string($category->name) . "</a>";
+ $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">".$icon . $categoryname . "</a>";
}
/// If we can update any course of the view all isn't hidden, show the view all courses link
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
@@ -77,7 +78,7 @@ function get_content() {
$this->content->items[]="<a $linkcss title=\""
. format_string($course->shortname, true, array('context' => $coursecontext))."\" ".
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">"
- .$icon. format_string($course->fullname) . "</a>";
+ .$icon. format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . "</a>";
}
/// If we can update any course of the view all isn't hidden, show the view all courses link
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
View
2  course/category.php
@@ -232,7 +232,7 @@
}
$catlinkcss = $subcategory->visible ? '' : ' class="dimmed" ';
echo '<a '.$catlinkcss.' href="category.php?id='.$subcategory->id.'">'.
- format_string($subcategory->name).'</a><br />';
+ format_string($subcategory->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $subcategory->id))).'</a><br />';
}
}
if (!$firstentry) {
View
3  course/delete.php
@@ -31,10 +31,11 @@
$category = $DB->get_record("course_categories", array("id"=>$course->category));
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+ $categoryname = format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id)));
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php/'));
$PAGE->navbar->add($strcategories, new moodle_url('/course/index.php'));
- $PAGE->navbar->add($category->name, new moodle_url('/course/category.php', array('id'=>$course->category)));
+ $PAGE->navbar->add($categoryname, new moodle_url('/course/category.php', array('id'=>$course->category)));
if (! $delete) {
$strdeletecheck = get_string("deletecheck", "", $courseshortname);
$strdeletecoursecheck = get_string("deletecoursecheck");
View
4 course/delete_category_form.php
@@ -78,11 +78,11 @@ function definition() {
}
/// Now build the form.
- $mform->addElement('header','general', get_string('categorycurrentcontents', '', format_string($category->name)));
+ $mform->addElement('header','general', get_string('categorycurrentcontents', '', format_string($category->name, true, array('context' => $categorycontext))));
if ($containscourses || $containscategories || $containsquestions) {
if (empty($options)) {
- print_error('youcannotdeletecategory', 'error', 'index.php', format_string($category->name));
+ print_error('youcannotdeletecategory', 'error', 'index.php', format_string($category->name, true, array('context' => $categorycontext)));
}
/// Describe the contents of this category.
View
6 course/index.php
@@ -125,7 +125,7 @@
require_capability('moodle/category:manage', $context);
require_capability('moodle/category:manage', get_category_or_system_context($deletecat->parent));
- $heading = get_string('deletecategory', 'moodle', format_string($deletecat->name));
+ $heading = get_string('deletecategory', 'moodle', format_string($deletecat->name, true, array('context' => $context)));
require_once('delete_category_form.php');
$mform = new delete_category_form(null, $deletecat);
$mform->set_data(array('delete'=>$delete));
@@ -151,7 +151,7 @@
foreach($deletedcourses as $course) {
echo $OUTPUT->notification(get_string('coursedeleted', '', $course->shortname), 'notifysuccess');
}
- echo $OUTPUT->notification(get_string('coursecategorydeleted', '', format_string($deletecat->name)), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('coursecategorydeleted', '', format_string($deletecat->name, true, array('context' => $context))), 'notifysuccess');
} else {
category_delete_move($deletecat, $data->newparent, true);
@@ -315,7 +315,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
$linkcss = $category->visible ? '' : ' class="dimmed" ';
echo '<a '.$linkcss.' title="'.$str->edit.'" '.
' href="category.php?id='.$category->id.'&amp;categoryedit=on&amp;sesskey='.sesskey().'">'.
- format_string($category->name).'</a>';
+ format_string($category->name, true, array('context' => $category->context)).'</a>';
echo '</td>';
echo '<td class="count">'.$category->coursecount.'</td>';
View
17 course/lib.php
@@ -1986,11 +1986,14 @@ function make_categories_list(&$list, &$parents, $requiredcapability = '',
return;
}
+ $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
+ $categoryname = format_string($category->name, true, array('context' => $context));
+
// Update $path.
if ($path) {
- $path = $path.' / '.format_string($category->name);
+ $path = $path.' / '.$categoryname;
} else {
- $path = format_string($category->name);
+ $path = $categoryname;
}
// Add this category to $list, if the permissions check out.
@@ -1998,9 +2001,8 @@ function make_categories_list(&$list, &$parents, $requiredcapability = '',
$list[$category->id] = $path;
} else {
- ensure_context_subobj_present($category, CONTEXT_COURSECAT);
$requiredcapability = (array)$requiredcapability;
- if (has_all_capabilities($requiredcapability, $category->context)) {
+ if (has_all_capabilities($requiredcapability, $context)) {
$list[$category->id] = $path;
}
}
@@ -2173,11 +2175,14 @@ function print_category_info($category, $depth=0, $showcourses = false) {
}
$courses = get_courses($category->id, 'c.sortorder ASC', 'c.id,c.sortorder,c.visible,c.fullname,c.shortname,c.summary');
+ $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
+ $fullname = format_string($category->name, true, array('context' => $context));
+
if ($showcourses and $coursecount) {
echo '<div class="categorylist clearfix">';
$cat = '';
$cat .= html_writer::tag('div', $catimage, array('class'=>'image'));
- $catlink = html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), format_string($category->name), $catlinkcss);
+ $catlink = html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $fullname, $catlinkcss);
$cat .= html_writer::tag('div', $catlink, array('class'=>'name'));
$html = '';
@@ -2235,7 +2240,7 @@ function print_category_info($category, $depth=0, $showcourses = false) {
} else {
echo '<div class="categorylist">';
$html = '';
- $cat = html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), format_string($category->name), $catlinkcss);
+ $cat = html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $fullname, $catlinkcss);
$cat .= html_writer::tag('span', ' ('.count($courses).')', array('title'=>get_string('numberofcourses'), 'class'=>'numberofcourse'));
if ($depth > 0) {
View
4 course/renderer.php
@@ -107,9 +107,11 @@ protected function course_category_tree_category(stdClass $category, $depth=1) {
$classes[] = 'collapsed';
}
}
+ $categoryname = format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id)));
+
$content .= html_writer::start_tag('div', array('class'=>join(' ', $classes)));
$content .= html_writer::start_tag('div', array('class'=>'category_label'));
- $content .= html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $category->name, array('class'=>'category_link'));
+ $content .= html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $categoryname, array('class'=>'category_link'));
$content .= html_writer::end_tag('div');
if ($hassubcategories) {
$content .= html_writer::start_tag('div', array('class'=>'subcategories'));
View
2  lib/accesslib.php
@@ -3578,7 +3578,7 @@ function print_context_name($context, $withprefix = true, $short = false) {
if ($withprefix){
$name = get_string('category').': ';
}
- $name .=format_string($category->name);
+ $name .= format_string($category->name, true, array('context' => $context));
}
break;
View
4 lib/navigationlib.php
@@ -1510,7 +1510,9 @@ protected function add_category(stdClass $category, navigation_node $parent) {
continue;
}
$url = new moodle_url('/course/category.php', array('id' => $category->id));
- $categorynode = $parent->add($category->name, $url, self::TYPE_CATEGORY, $category->name, $category->id);
+ $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
+ $categoryname = format_string($category->name, true, array('context' => $context));
+ $categorynode = $parent->add($categoryname, $url, self::TYPE_CATEGORY, $categoryname, $category->id);
if (empty($category->visible)) {
if (has_capability('moodle/category:viewhiddencategories', get_system_context())) {
$categorynode->hidden = true;
View
4 mod/feedback/item/info/lib.php
@@ -188,7 +188,7 @@ function print_item_preview($item) {
$itemshowvalue = $itemvalue;
break;
case 3:
- $itemvalue = $coursecategory->name;
+ $itemvalue = format_string($coursecategory->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $coursecategory->id)));
$itemshowvalue = $itemvalue;
break;
}
@@ -245,7 +245,7 @@ function print_item_complete($item, $value = '', $highlightrequire = false) {
$itemshowvalue = $itemvalue;
break;
case 3:
- $itemvalue = $coursecategory->name;
+ $itemvalue = format_string($coursecategory->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $coursecategory->id)));
$itemshowvalue = $itemvalue;
break;
}
Please sign in to comment.
Something went wrong with that request. Please try again.