}
$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;
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)) {
$this->content->items[]="<a $linkcss title=\""
. format_string($course->shortname)."\" ".
"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)) {
}
$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) {
}
$category = $DB->get_record("course_categories", array("id"=>$course->category));
+ $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", "", $course->shortname);
$strdeletecoursecheck = get_string("deletecoursecheck");
}
/// 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.
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));
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);
$linkcss = $category->visible ? '' : ' class="dimmed" ';
echo '<a '.$linkcss.' title="'.$str->edit.'" '.
' href="category.php?id='.$category->id.'&categoryedit=on&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>';
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.
$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;
}
}
}
$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 = '';
} 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) {
$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'));
if ($withprefix){
$name = get_string('category').': ';
}
- $name .=format_string($category->name);
+ $name .= format_string($category->name, true, array('context' => $context));
}
break;
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;
$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;
}
$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;
}