grid_session.tpl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. {% set group_courses = 'view_grid_courses_grouped_categories_in_sessions'| api_get_configuration_value %}
  2. {% macro course_block(course, show_category) %}
  3. <div class="col-xs-12 col-sm-6 col-md-4">
  4. <div class="items items-sessions">
  5. <div class="image">
  6. <a title="{{ course.name }}" href="{{ course.link }}">
  7. <img src="{{ course.image }}" class="img-responsive">
  8. </a>
  9. {% if course.category != '' and show_category %}
  10. <span class="category">{{ course.category }}</span>
  11. <div class="cribbon"></div>
  12. {% endif %}
  13. {% if course.edit_actions %}
  14. <div class="admin-actions">
  15. {% if course.document == '' %}
  16. <a class="btn btn-default btn-sm" href="{{ course.edit_actions }}">
  17. <i class="fa fa-pencil" aria-hidden="true"></i>
  18. </a>
  19. {% else %}
  20. <div class="btn-group" role="group">
  21. <a class="btn btn-default btn-sm" href="{{ course.edit_actions }}">
  22. <i class="fa fa-pencil" aria-hidden="true"></i>
  23. </a>
  24. {{ course.document }}
  25. </div>
  26. {% endif %}
  27. </div>
  28. {% endif %}
  29. </div>
  30. <div class="description">
  31. <div class="block-title">
  32. <h4 class="title">
  33. {% if course.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
  34. {{ course.title }}
  35. <span class="code-title">{{ course.visual_code }}</span>
  36. {% else %}
  37. <a href="{{ course.link }}">{{ course.title }}</a>
  38. {% endif %}
  39. </h4>
  40. </div>
  41. <div class="block-author">
  42. {% if course.teachers | length > 2 %}
  43. <a
  44. id="plist"
  45. data-trigger="focus"
  46. tabindex="0" role="button"
  47. class="btn btn-default panel_popover"
  48. data-toggle="popover"
  49. title="{{ 'CourseTeachers' | get_lang }}"
  50. data-html="true"
  51. >
  52. <i class="fa fa-graduation-cap" aria-hidden="true"></i>
  53. </a>
  54. <div id="popover-content-plist" class="hide">
  55. {% endif %}
  56. {% for teacher in course.teachers %}
  57. {% if course.teachers | length > 2 %}
  58. <div class="popover-teacher">
  59. <a href="{{ teacher.url }}" class="ajax">
  60. <img src="{{ teacher.avatar }}"/>
  61. </a>
  62. <div class="teachers-details">
  63. <h5>
  64. {{ teacher.firstname }} {{ teacher.lastname }}
  65. </h5>
  66. </div>
  67. </div>
  68. {% else %}
  69. <a href="{{ teacher.url }}" class="ajax"
  70. data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
  71. <img src="{{ teacher.avatar }}"/>
  72. </a>
  73. <div class="teachers-details">
  74. <h5>
  75. <a href="{{ teacher.url }}" class="ajax"
  76. data-title="{{ teacher.firstname }} {{ teacher.lastname }}">
  77. {{ teacher.firstname }} {{ teacher.lastname }}
  78. </a>
  79. </h5>
  80. <p>{{ "Teacher"|get_lang }}</p>
  81. </div>
  82. {% endif %}
  83. {% endfor %}
  84. {% if course.teachers | length > 2 %}
  85. </div>
  86. {% endif %}
  87. </div>
  88. <div class="notifications">
  89. {{ course.notifications }}
  90. </div>
  91. {% if item.student_info %}
  92. <div class="black-student">
  93. {% if item.student_info.progress is not null or item.student_info.score is not null or item.student_info.certificate is not null %}
  94. <div class="course-student-info">
  95. <div class="student-info">
  96. {% if (item.student_info.progress is not null) %}
  97. {{ "StudentCourseProgressX" | get_lang | format(item.student_info.progress) }}
  98. {% endif %}
  99. {% if (item.student_info.score is not null) %}
  100. {{ "StudentCourseScoreX" | get_lang | format(item.student_info.score) }}
  101. {% endif %}
  102. {% if (item.student_info.certificate is not null) %}
  103. {{ "StudentCourseCertificateX" | get_lang | format(item.student_info.certificate) }}
  104. {% endif %}
  105. </div>
  106. </div>
  107. {% endif %}
  108. </div>
  109. {% endif %}
  110. </div>
  111. </div>
  112. </div>
  113. {% endmacro %}
  114. {% import _self as blocks %}
  115. {% set session_image = 'window_list.png'|img(32, row.title) %}
  116. {% for row in session %}
  117. {% set collapsable = '' %}
  118. <div id="session-{{ item.id }}" class="session panel panel-default">
  119. {% if row.course_list_session_style %}
  120. {# If not style then no show header #}
  121. <div class="panel-heading">
  122. {% if row.course_list_session_style == 1 or row.course_list_session_style == 2 %}
  123. {# Session link #}
  124. {% if remove_session_url == true %}
  125. {{ session_image }} {{ row.title }}
  126. {% else %}
  127. {# Default link #}
  128. {% set session_link = _p.web_main ~ 'session/index.php?session_id=' ~ row.id %}
  129. {% if row.course_list_session_style == 2 and row.courses|length == 1 %}
  130. {# Linkt to first course #}
  131. {% set session_link = row.courses.0.link %}
  132. {% endif %}
  133. <a href="{{ session_link }}">
  134. {{ session_image }} {{ row.title }}
  135. </a>
  136. {% endif %}
  137. {% elseif row.course_list_session_style == 4 %}
  138. {{ session_image }} {{ row.title }}
  139. {% elseif row.course_list_session_style == 3 %}
  140. {# Collapsible panel #}
  141. {# Foldable #}
  142. <a role="button" data-toggle="collapse" data-parent="#page-content" href="#collapse_{{ row.id }}"
  143. aria-expanded="false">
  144. {{ session_image }} {{ row.title }}
  145. </a>
  146. {% set collapsable = 'collapse' %}
  147. {% endif %}
  148. {% if row.show_actions %}
  149. <div class="pull-right">
  150. <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ row.id }}">
  151. <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}"
  152. title="{{ "Edit"|get_lang }}">
  153. </a>
  154. </div>
  155. {% endif %}
  156. {% if row.collapsable_link %}
  157. <div class="pull-right">
  158. {{ row.collapsable_link }}
  159. </div>
  160. {% endif %}
  161. </div>
  162. {% endif %}
  163. {% if row.collapsable_link %}
  164. {% if row.collapsed == 1 %}
  165. {% set collapsable = 'collapse' %}
  166. {% endif %}
  167. {% endif %}
  168. <div class="session panel-body {{ collapsable }}" id="collapse_{{ row.id }}">
  169. {% if row.show_description %}
  170. {{ row.description }}
  171. {% endif %}
  172. <ul class="info-session list-inline">
  173. {% if row.coach_name %}
  174. <li>
  175. <i class="fa fa-user" aria-hidden="true"></i>
  176. {{ row.coach_name }}
  177. </li>
  178. {% endif %}
  179. <li>
  180. <i class="fa fa-calendar" aria-hidden="true"></i>
  181. {{ row.date ? row.date : row.duration }}
  182. </li>
  183. </ul>
  184. <div class="grid-courses">
  185. {% if not group_courses %}
  186. <div class="row">
  187. {% for item in row.courses %}
  188. {{ blocks.course_block(item, true) }}
  189. {% endfor %}
  190. </div>
  191. {% else %}
  192. {% for category_code in row.course_categories %}
  193. <div class="row">
  194. <div class="col-xs-12">
  195. <h4>{{ category_code }}</h4>
  196. </div>
  197. {% for course in row.courses %}
  198. {% if course.category == category_code %}
  199. {{ blocks.course_block(course, false) }}
  200. {% endif %}
  201. {% endfor %}
  202. </div>
  203. {% endfor %}
  204. {% endif %}
  205. </div>
  206. </div>
  207. </div>
  208. {% endfor %}