templates/Front/Scholar/Chapter/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block back_to_dashboard %}
  3. {% include 'Front/Scholar/Partial/_back_to_dashboard.html.twig' %}
  4. {% endblock back_to_dashboard %}
  5. {% if canSeeMessages is not defined %}
  6. {% set canSeeMessages = true %}
  7. {% endif %}
  8. {% block title %}{{ chapter.lesson.name }} - {{ parent() }}{% endblock %}
  9. {% set currentRoute = app.request.attributes.get('_route') %}
  10. {% set enableChatBot = chapter is chat_bot_enabled and currentRoute == 'front_channel_chapter_show' %}
  11. {% block stylesheets %}
  12. {{ parent() }}
  13. {{ encore_entry_link_tags('styles', 'core', 'core') }}
  14. {% endblock %}
  15. {% block before_navbar %}
  16. {% include 'Front/Scholar/Partial/_preview_manager_heager.html.twig' with {
  17. 'channel': channel,
  18. 'currentRoute': currentRoute,
  19. } %}
  20. {% endblock before_navbar %}
  21. {% block body_markup %}
  22. <body class="progression chapter-view {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}logged-in{% endif %}"
  23. style="font-family: 'Poppins';"
  24. id="page-training-lesson"
  25. {% if currentRoute == 'front_channel_chapter_show' %}
  26. data-training_id={{ training.id }}
  27. data-module_id={{ module.id }}
  28. data-lesson_id={{ lesson.id }}
  29. data-chapter_id="{{ chapter.id }}"
  30. {% endif %}
  31. >
  32. {% endblock body_markup %}
  33. {% block content %}
  34. {% if currentRoute in ['front_channel_chapter_show', 'manager_channel_module_chapter_show', 'manager_channel_training_module_chapter_show'] %}
  35. {% set trainingModuleLessons = module | get_lessons %}
  36. {% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
  37. {% set trainingModuleLessons = [lesson] %}
  38. {% endif %}
  39. {% if app.user %}
  40. <twig:ChannelUserData:CursusLockout
  41. :cursus="cursus ?? null"
  42. ></twig:ChannelUserData:CursusLockout>
  43. {% endif %}
  44. {% include 'Front/Scholar/Partial/_menu_lessons_mobile.html.twig' with {
  45. 'current_chapter': chapter
  46. } %}
  47. <div class="container pt-md-5 pb-md-5 pt-3 pb-3 summary-lesson font-size-14">
  48. <div class="row">
  49. <div class="col-md-9 col-12">
  50. <div>
  51. {% for key, messageType in app.flashes() %}
  52. <div>
  53. {% for message in messageType %}
  54. <div class="alert alert-{{ key|replace({'error': 'danger'}) }}">
  55. {{ message | trans }}
  56. </div>
  57. {% endfor %}
  58. </div>
  59. {% endfor %}
  60. </div>
  61. <h2 class="font-weight-bold font-size-16px">{{- 'front.scholar.lesson.show.title.label'|trans({'%name%': chapter.lesson.name}) -}}</h2>
  62. <h1 class="v2-title-big">{{- chapter.name -}}</h1>
  63. {% include 'Front/Scholar/Partial/_content_alert.html.twig' %}
  64. <div class="col-12 col-lg-6 d-flex justify-content-between p-0"> {# align-items-baseline #}
  65. <div class="d-flex align-items-center"> {# align-items-baseline #}
  66. <img class="star-space chapter-comment-logo"
  67. src="{{- asset('build/common/icon-chat.svg', 'common') -}}" alt="Count comments"/>
  68. <div class="marks d-flex justify-content-center align-items-center">{{ chapter | getMessageCount }}</div>
  69. </div>
  70. <div class="d-flex justify-content-center align-items-center">
  71. {%- if lesson.updatedAt is not null -%}
  72. {{- 'front.scholar.training.show.createdAt.label'|trans({
  73. '%date%': lesson.updatedAt|format_date('long', locale=app.request.locale),
  74. })|raw -}}
  75. {%- else -%}
  76. {{- 'front.scholar.training.show.createdAt.label'|trans({
  77. '%date%': lesson.createdAt|format_date('long', locale=app.request.locale),
  78. })|raw -}}
  79. {%- endif -%}
  80. </div>
  81. </div>
  82. {% if chapter.description is not null %}
  83. <div class="description-lesson mt-4">
  84. <p class="text-subcateg description-style">{{- chapter.description -}}</p>
  85. </div>
  86. {% endif %}
  87. <div class="mt-4 lesson-content">{{- chapter.body|raw -}}</div>
  88. {% if currentRoute == 'front_channel_chapter_show' %}
  89. {% include 'Front/Scholar/Partial/_scholar_navigation_previous_after.html.twig' with {
  90. next_informations: get_next_informations_chapter(training, module, lesson, chapter),
  91. previous_informations: get_previous_informations_chapter(training, module, lesson, chapter),
  92. } %}
  93. {% endif %}
  94. {% if canSeeMessages is same as true %}
  95. <div class="mt-5 chapter-questions-separator"></div>
  96. <div class="mt-5" id="forum-messages">
  97. <div class="font-weight-bold font-size-16px mb-4">{{- 'front.scholar.lesson.show.message.title.label'|trans({'%count%': chapter|getMessageCount}) -}}</div>
  98. {% if messages|length == 0 %}
  99. <div>{{- 'front.scholar.lesson.show.message.no_message.label'|trans -}}</div>
  100. {% endif %}
  101. {% for message in messages %}
  102. {% if loop.index0 != 0 %}
  103. <div class="mt-3 mb-3 ml-5 mr-5 chapter-questions-separator"></div>
  104. {% endif %}
  105. {% set messageToAnswer = null %}
  106. {% set children = message|getMessageChildren %}
  107. {% if children|length is same as 0 %}
  108. {% set messageToAnswer = message %}
  109. {% endif %}
  110. {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  111. 'message': message,
  112. 'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(message),
  113. 'messageToAnswer': messageToAnswer
  114. } %}
  115. {% set messageToAnswer = null %}
  116. {% for child in children %}
  117. {% if loop.last is same as true %}
  118. {% set messageToAnswer = message %}
  119. {% endif %}
  120. {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  121. 'message': child,
  122. 'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(child),
  123. 'messageToAnswer': messageToAnswer
  124. } %}
  125. {% endfor %}
  126. {% endfor %}
  127. {% if form is defined %}
  128. <div id="form-message-anchor" class="row{% if not app.user %} justify-content-center align-items-center{% endif %} mt-5">
  129. {% if app.user %}
  130. <div class="col-1 d-none d-md-block">
  131. {% if app.user.avatarPath is null %}
  132. <span class="user-account">
  133. <i class="fas fa-user"></i>
  134. </span>
  135. {% else %}
  136. <img class="user-account" src="{{ get_user_avatar_thumbnail(app.user) }}"
  137. alt="User avatar">
  138. {% endif %}
  139. </div>
  140. <div class="col-md-11 col-12 pr-0 pl-0">
  141. {% if enableChatBot is same as false %}
  142. {{ form_start(form, {'attr': {'class': 'm-0 d-flex flex-column flex-md-row'}}) }}
  143. <div class="col-md-10 col-12">
  144. <div>{{ form_row(form.content) }}</div>
  145. <div>{{ form_errors(form) }}</div>
  146. </div>
  147. <div class="col-md-2 col-12 mt-send-mobile">
  148. <button
  149. class="btn-nellapp-v2"
  150. style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
  151. type="submit"
  152. >
  153. <span>{{ "Envoyer" }}</span>
  154. <i class="ml-2 fas fa-paper-plane"></i>
  155. </button>
  156. </div>
  157. {{ form_end(form) }}
  158. {% else %}
  159. <button
  160. class="btn-nellapp-v2"
  161. style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
  162. type="button"
  163. data-toggle="modal"
  164. data-target="#chat-bot-modal"
  165. id="chat-bot-modal-label"
  166. >
  167. <span>Posez votre question</span>
  168. <i class="ml-2 fas fa-paper-plane"></i>
  169. </button>
  170. {% endif %}
  171. </div>
  172. {% else %}
  173. <div class="col-1">
  174. <span class="user-account" style="border: 1px solid #dee2e6;">
  175. <i class="fas fa-user"></i>
  176. </span>
  177. </div>
  178. <div class="col-9">
  179. {{- 'front.scholar.lesson.show.message.modal.please_connect.label'|trans -}}
  180. </div>
  181. <div class="col-2">
  182. <a href="{{ path('nellapp_sdk_connect_nellapp') }}" class="btn-nellapp-v2">
  183. {{- 'front.scholar.lesson.show.message.modal.login.label'|trans -}}
  184. </a>
  185. </div>
  186. {% endif %}
  187. </div>
  188. {% endif %}
  189. </div>
  190. {% endif %}
  191. </div>
  192. <div class="col-3 d-none d-md-block">
  193. {% include 'Front/Scholar/Partial/menu_lessons.html.twig' with {
  194. 'current_chapter': chapter
  195. } %}
  196. </div>
  197. </div>
  198. </div>
  199. {{ parent() }}
  200. {% endblock content %}
  201. {% block body %}
  202. {{ parent() }}
  203. {% if app.user %}
  204. <!-- Modal -->
  205. <div class="modal fade" id="modalMessage" tabindex="-1" role="dialog" aria-hidden="true"
  206. style="font-family: 'Poppins'">
  207. <div class="modal-dialog modal-dialog-centered forum-message-modal" role="document">
  208. <div class="modal-content border-8">
  209. <div class="modal-header">
  210. <h5 class="modal-title title-main-modal-message question-title"
  211. style="font-size: 0.875rem;font-weight: bold;">
  212. {{ 'front.scholar.lesson.show.message.modal.title.label'|trans }}
  213. </h5>
  214. <h5 class="modal-title title-main-modal-message response-title"
  215. style="display:none; font-size: 0.875rem; font-weight: bold">
  216. {{ 'front.scholar.lesson.show.message.modal.title_response.label'|trans }}
  217. <span class="span-response-title"></span>
  218. </h5>
  219. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  220. <span aria-hidden="true">&times;</span>
  221. </button>
  222. </div>
  223. <div class="modal-body" style="padding: 20px 24px 0px 24px;">
  224. <div id="modal-response-message"></div>
  225. {{ form_start(formAnswer) }}
  226. {{ form_row(formAnswer.content) }}
  227. </div>
  228. <div class="modal-footer" style="padding:8px 24px 16px 24px;">
  229. <button type="button" class="btn-close-modale"
  230. data-dismiss="modal">{{ 'front.scholar.lesson.show.message.modal.close.label'|trans }}</button>
  231. <button type="submit"
  232. class="btn-valid-modale">{{ button_label|default('message.entity.save.label'|trans) }}</button>
  233. </div>
  234. {{ form_end(formAnswer) }}
  235. </div>
  236. </div>
  237. </div>
  238. {% if enableChatBot is same as true %}
  239. {% include 'Front/Scholar/Chapter/_chat_bot_modal.html.twig' %}
  240. {% endif %}
  241. {% endif %}
  242. {% endblock %}
  243. {% block javascripts %}
  244. {% if app.user and currentRoute == 'front_channel_chapter_show' %}
  245. <script>
  246. var attendanceUrl = '{{ url('async_channel_scholar_attendance_chapter', {
  247. 'channelId': channel.id
  248. }) }}';
  249. </script>
  250. {% endif %}
  251. {{ parent() }}
  252. {% endblock %}