mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-29187 multilang Reviewed the uses of category name and ensured things are being formatted correctly
This commit is contained in:
parent
5d2db8acc8
commit
63390481c4
@ -629,7 +629,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$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;
|
||||
|
@ -56,8 +56,9 @@ class block_course_list extends block_list {
|
||||
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)) {
|
||||
@ -75,7 +76,7 @@ class block_course_list extends block_list {
|
||||
$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)) {
|
||||
|
@ -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) {
|
||||
|
@ -30,10 +30,11 @@
|
||||
}
|
||||
|
||||
$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");
|
||||
|
@ -78,11 +78,11 @@ class delete_category_form extends moodleform {
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
@ -125,7 +125,7 @@ if (!empty($delete) and confirm_sesskey()) {
|
||||
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 @@ if (!empty($delete) and confirm_sesskey()) {
|
||||
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.'&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>';
|
||||
|
@ -1997,11 +1997,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.
|
||||
@ -2009,9 +2012,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;
|
||||
}
|
||||
}
|
||||
@ -2184,11 +2186,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 = '';
|
||||
@ -2246,7 +2251,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) {
|
||||
|
@ -107,9 +107,11 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
$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'));
|
||||
|
@ -3584,7 +3584,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;
|
||||
|
||||
|
@ -1510,7 +1510,9 @@ class global_navigation extends navigation_node {
|
||||
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;
|
||||
|
@ -187,7 +187,7 @@ class feedback_item_info extends feedback_item_base {
|
||||
$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;
|
||||
}
|
||||
@ -243,7 +243,7 @@ class feedback_item_info extends feedback_item_base {
|
||||
$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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user