list.html.twig 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {% extends "@ChamiloTheme/Layout/layout_one_col.html.twig" %}
  2. {% import '@ChamiloTheme/Macros/box.html.twig' as display %}
  3. {% block content %}
  4. {% autoescape false %}
  5. {% if 'translate_html'|api_get_configuration_value %}
  6. <script>
  7. $(function () {
  8. // default
  9. $('.category-forum ').hide();
  10. {% if default_user_language %}
  11. $('.{{ default_user_language }}').show();
  12. {% endif %}
  13. $('#extra_language').attr('data-width', '200px');
  14. $('#extra_language option[value=""]').text('{{ 'Any' | get_lang | escape('js') }}');
  15. $('#extra_language').on('change', function() {
  16. var selectedLanguageArray = $(this).val();
  17. $('.category-forum ').hide();
  18. $.each(selectedLanguageArray, function(index, selectedLanguage) {
  19. if (selectedLanguage == '') {
  20. $('.category-forum ').show();
  21. } else {
  22. $('.'+ selectedLanguage).show();
  23. }
  24. });
  25. });
  26. });
  27. </script>
  28. {% endif %}
  29. {{ form_content }}
  30. {{ search_filter }}
  31. {% set fold_forum_categories = 'forum_fold_categories'|api_get_configuration_value %}
  32. {% if data is not empty %}
  33. <div class="accordion forum" id="accordion-forum">
  34. {% for item in data %}
  35. {% set category_language_array = [] %}
  36. {% set category_language = '' %}
  37. {% for extra_field in item.extra_fields %}
  38. {% if extra_field.variable == 'language' %}
  39. {% set category_language_array = extra_field.value | split(';') %}
  40. {% set category_language = extra_field.value | replace({';': ' ' }) %}
  41. {% endif %}
  42. {% endfor %}
  43. {{ display.card_collapse('accordion-forum', item) }}
  44. {% endfor %}
  45. </div>
  46. {% else %}
  47. <div class="alert alert-info">
  48. {{ 'There is no forum in this category'|get_lang }}
  49. </div>
  50. {% if is_allowed_to_edit %}
  51. <div id="no-data-view" class="tool-view">
  52. <h2>{{ "Forum"|trans }}</h2>
  53. <img src="{{ "forum.png"|icon(64) }}" width="64" height="64">
  54. <div class="controls">
  55. <a href="{{ _p.web_self }}?{{ _p.web_cid_query ~ "&action=addglossary" }}" class="btn btn-outline-primary">
  56. {{ "Add forum category"|trans }}
  57. </a>
  58. </div>
  59. </div>
  60. {% endif %}
  61. {% endif %}
  62. {% endautoescape %}
  63. {% endblock %}