Merge pull request #3992 from christianbeeznest/ofaj19044-forum

Forum: Fix filter by language - refs BT#19044
pull/3994/head^2
Yannick Warnier 3 years ago committed by GitHub
commit 852264246f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      public/main/forum/index.php
  2. 4
      public/main/template/default/forum/list.html.twig

@ -245,9 +245,10 @@ if (!empty($allCourseForums)) {
$actions = Display::toolbarAction('toolbar-forum', [$actionLeft]);
$languages = api_get_language_list_for_flag();
$defaultUserLanguage = 'en';
$defaultUserLanguage = 'english';
if (null !== $user) {
$defaultUserLanguage = $user->getLocale();
$langInfo = api_get_language_from_iso($user->getLocale());
$defaultUserLanguage = $langInfo->getEnglishName();
}
$extraFieldValues = new ExtraFieldValue('user');
@ -259,7 +260,7 @@ if ($value && isset($value['value']) && !empty($value['value'])) {
// Create a search-box
$searchFilter = '';
$translate = api_get_configuration_value('translate_html');
$translate = 'true' === api_get_setting('editor.translate_html');
if ($translate) {
$form = new FormValidator('search_simple', 'get', api_get_self().'?'.api_get_cidreq(), null, null, 'inline');
$form->addHidden('cid', api_get_course_int_id());
@ -281,7 +282,7 @@ if ($translate) {
[],
true //$addEmptyOptionSelects = false,
);
$form->setDefaults(['extra_language' => $defaultUserLanguage]);
$form->setDefault('extra_language', $defaultUserLanguage);
$searchFilter = $form->returnForm();
}
@ -596,6 +597,9 @@ if (is_array($forumCategories)) {
$forumCategoryInfo['forums'] = $forumsDetailsList;
}
// It set the languages by category
$extraFieldValue = new ExtraFieldValue('forum_category');
$forumCategoryInfo['extra_fields'] = $extraFieldValue->getAllValuesByItem($categoryId);
// Don't show empty categories (for students)
if (!api_is_allowed_to_edit()) {
if (empty($forumCategoryInfo['forums'])) {

@ -58,7 +58,9 @@
{% set panel_title %}
{{ item.title }}{{ item.icon_session }}
{% for category_language_item in category_language_array %}
{% if languages[category_language_item | lower] is defined %}
<span class="flag-icon flag-icon-{{ languages[category_language_item | lower] }}"></span>
{% endif %}
{% endfor %}
{% endset %}
{% else %}
@ -68,7 +70,9 @@
{{ item.title }}{{ item.icon_session }}
</a>
{% for category_language_item in category_language_array %}
{% if languages[category_language_item | lower] is defined %}
<span class="flag-icon flag-icon-{{ languages[category_language_item | lower] }}"></span>
{% endif %}
{% endfor %}
<div class="pull-right">
{{ item.tools }}

Loading…
Cancel
Save