grid_session.tpl 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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) and (item.student_info.score 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. <div id="session-{{ item.id }}" class="session panel panel-default">
  118. {% if row.course_list_session_style %} {# If not style then no show header #}
  119. <div class="panel-heading">
  120. {% if row.course_list_session_style == 1 or row.course_list_session_style == 2 %}
  121. {# Session link #}
  122. {% if remove_session_url == true %}
  123. {{ session_image }} {{ row.title }}
  124. {% else %}
  125. {# Default link #}
  126. {% set session_link = _p.web_main ~ 'session/index.php?session_id=' ~ row.id %}
  127. {% if row.course_list_session_style == 2 and row.courses|length == 1 %}
  128. {# Linkt to first course #}
  129. {% set session_link = row.courses.0.link %}
  130. {% endif %}
  131. <a href="{{ session_link }}">
  132. {{ session_image }} {{ row.title }}
  133. </a>
  134. {% endif %}
  135. {% elseif row.course_list_session_style == 3 %}
  136. {# Collapsible panel #}
  137. {# Foldable #}
  138. <a role="button" data-toggle="collapse" data-parent="#page-content" href="#collapse_{{ row.id }}"
  139. aria-expanded="false">
  140. {{ session_image }} {{ row.title }}
  141. </a>
  142. {% set collapsable = 'collapse' %}
  143. {% endif %}
  144. {% if row.show_actions %}
  145. <div class="pull-right">
  146. <a href="{{ _p.web_main ~ "session/resume_session.php?id_session=" ~ row.id }}">
  147. <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}"
  148. title="{{ "Edit"|get_lang }}">
  149. </a>
  150. </div>
  151. {% endif %}
  152. </div>
  153. {% endif %}
  154. <div class="session panel-body {{ collapsable }}" id="collapse_{{ row.id }}">
  155. {% if row.show_description %}
  156. {{ row.description }}
  157. {% endif %}
  158. <ul class="info-session list-inline">
  159. {% if row.coach_name %}
  160. <li>
  161. <i class="fa fa-user" aria-hidden="true"></i>
  162. {{ row.coach_name }}
  163. </li>
  164. {% endif %}
  165. <li>
  166. <i class="fa fa-calendar" aria-hidden="true"></i>
  167. {{ row.date ? row.date : row.duration }}
  168. </li>
  169. </ul>
  170. <div class="grid-courses">
  171. {% if not group_courses %}
  172. <div class="row">
  173. {% for item in row.courses %}
  174. {{ blocks.course_block(item, true) }}
  175. {% endfor %}
  176. </div>
  177. {% else %}
  178. {% for category_code in row.course_categories %}
  179. <div class="row">
  180. <div class="col-xs-12">
  181. <h4>{{ category_code }}</h4>
  182. </div>
  183. {% for course in row.courses %}
  184. {% if course.category == category_code %}
  185. {{ blocks.course_block(course, false) }}
  186. {% endif %}
  187. {% endfor %}
  188. </div>
  189. {% endfor %}
  190. {% endif %}
  191. </div>
  192. </div>
  193. </div>
  194. {% endfor %}