Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-27818 question bank: multilang category names don't work.

  • Loading branch information...
commit 5d22b222747f7037b3a4ebb3b21a2286756e05e0 1 parent fd126f9
@timhunt timhunt authored
Showing with 12 additions and 7 deletions.
  1. +7 −5 lib/questionlib.php
  2. +5 −2 question/category_class.php
View
12 lib/questionlib.php
@@ -1117,16 +1117,18 @@ function question_category_options($contexts, $top = false, $currentcat = 0,
// sort cats out into different contexts
$categoriesarray = array();
- foreach ($pcontexts as $pcontext) {
- $contextstring = print_context_name(
- get_context_instance_by_id($pcontext), true, true);
+ foreach ($pcontexts as $contextid) {
+ $context = context::instance_by_id($contextid);
+ $contextstring = $context->get_context_name(true, true);
foreach ($categories as $category) {
- if ($category->contextid == $pcontext) {
+ if ($category->contextid == $contextid) {
$cid = $category->id;
if ($currentcat != $cid || $currentcat == 0) {
$countstring = !empty($category->questioncount) ?
" ($category->questioncount)" : '';
- $categoriesarray[$contextstring][$cid] = $category->indentedname.$countstring;
+ $categoriesarray[$contextstring][$cid] =
+ format_string($category->indentedname, true,
+ array('context' => $context)) . $countstring;
}
}
}
View
7 question/category_class.php
@@ -102,9 +102,12 @@ public function item_html($extraargs = array()){
/// Each section adds html to be displayed as part of this list item
$questionbankurl = new moodle_url("/question/edit.php", ($this->parentlist->pageurl->params() + array('category'=>"$category->id,$category->contextid")));
$catediturl = $this->parentlist->pageurl->out(true, array('edit' => $this->id));
- $item = "<b><a title=\"{$str->edit}\" href=\"$catediturl\">".$category->name ."</a></b> <a title=\"$editqestions\" href=\"$questionbankurl\">".'('.$category->questioncount.')</a>';
+ $item = "<b><a title=\"{$str->edit}\" href=\"$catediturl\">" .
+ format_string($category->name, true, array('context' => $this->parentlist->context)) .
+ "</a></b> <a title=\"$editqestions\" href=\"$questionbankurl\">".'('.$category->questioncount.')</a>';
- $item .= '&nbsp;'. $category->info;
+ $item .= '&nbsp;' . format_text($category->info, $category->infoformat,
+ array('context' => $this->parentlist->context, 'noclean' => true));
// don't allow delete if this is the last category in this context.
if (count($this->parentlist->records) != 1) {
Please sign in to comment.
Something went wrong with that request. Please try again.