session_catalog.html.twig 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. {% import "@ChamiloTheme/Macros/box.html.twig" as macro %}
  2. {% block content %}
  3. {% autoescape false %}
  4. <script>
  5. $(function() {
  6. $('#date').datepicker({
  7. dateFormat: 'yy-mm-dd'
  8. });
  9. });
  10. </script>
  11. <div class="catalog" style="width: 100%;">
  12. <h2>{{ 'Catalog Sessions'|get_lang }}</h2>
  13. <div class="search">
  14. <div class="row">
  15. <div class="col-md-6">
  16. <form method="post" action="{{ _p.web_self }}?action=display_sessions">
  17. <div class="form-group">
  18. <label>{{ "ByDate"|get_lang }}</label>
  19. <div class="input-group">
  20. <input type="date" name="date" id="date" title="{{ 'Date'|get_lang }}"
  21. class="form-control" value="{{ search_date }}" readonly>
  22. <span class="input-group-btn">
  23. <button class="btn btn-default" type="submit">
  24. <em class="fa fa-search"></em> {{ 'Search'|get_lang }}
  25. </button>
  26. </span>
  27. </div>
  28. </div>
  29. </form>
  30. </div>
  31. <div class="col-md-6">
  32. <form method="post" action="{{ _p.web_self }}?action=search_tag">
  33. <label>{{ "ByTag"|get_lang }}</label>
  34. <div class="input-group">
  35. <input type="text" name="search_tag" title="{{ 'ByTag'|get_lang }}" class="form-control"
  36. value="{{ search_tag }}"/>
  37. <span class="input-group-btn">
  38. <button class="btn btn-default" type="submit">
  39. <em class="fa fa-search"></em> {{ 'Search'|get_lang }}
  40. </button>
  41. </span>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. <div class="list-course">
  47. {% for item in sessions %}
  48. <div class="item-course">
  49. {% set image %}
  50. {% if item.category != '' %}
  51. <div class="category">
  52. {{ item.category }}
  53. </div>
  54. {% endif %}
  55. <a href="{{ _p.web ~ 'session/' ~ item.id ~ '/about/' }}" title="{{ item.name }}">
  56. <img class="img-fluid" src="{{ item.image ? _p.web_upload ~ item.image : 'session_default.png'|icon() }}">
  57. </a>
  58. {% endset %}
  59. {% set content %}
  60. <div class="card-title">
  61. <h5 class="title">
  62. <a href="{{ _p.web ~ 'session/' ~ item.id ~ '/about/' }}" title="{{ item.name }}">
  63. {{ item.name }}
  64. </a>
  65. </h5>
  66. </div>
  67. {% if show_tutor and item.coach_id %}
  68. <div class="card-author mb-2">
  69. <i class="fa fa-graduation-cap" aria-hidden="true"></i>
  70. <a href="{{ item.coach_url }}" class="ajax" data-title="{{ item.coach_name }}">
  71. {{ item.coach_name }}
  72. </a>
  73. <p>{{ 'SessionGeneralCoach'|get_lang }}</p>
  74. </div>
  75. {% endif %}
  76. <div class="card-info">
  77. <ul class="info list-inline">
  78. <li>
  79. <i class="fa fa-book" aria-hidden="true"></i>
  80. {{ item.nbr_courses ~ ' ' ~ 'Courses'|get_lang }}
  81. </li>
  82. <li>
  83. <i class="fa fa-user" aria-hidden="true"></i>
  84. {{ item.nbr_users ~ ' ' ~ 'NbUsers'|get_lang }}
  85. </li>
  86. </ul>
  87. </div>
  88. <div class="card-date">
  89. {{ item.duration ? 'SessionDurationXDaysLeft'|get_lang|format(item.duration) : item.date }}
  90. </div>
  91. <div class="card-sequence">
  92. {% if item.price %}
  93. <div class="col-sm-4">
  94. {{ item.price }}
  95. </div>
  96. {% endif %}
  97. {% if _u.logged %}
  98. <div class="col-sm-8">
  99. <div class="btn-group btn-group-sm" role="group">
  100. {% if not item.sequences is empty %}
  101. <a class="btn btn-primary btn-sm" role="button"
  102. title="{{ 'SeeSequences'|get_lang }}" data-toggle="popover"
  103. id="session-{{ item.id }}-sequences">
  104. <i class="fas fa-sitemap"></i>
  105. </a>
  106. {% endif %}
  107. {% if item.is_subscribed == false %}
  108. {{ item.subscribe_button }}
  109. {% endif %}
  110. </div>
  111. </div>
  112. {% endif %}
  113. {% if _u.logged %}
  114. <script>
  115. $('#session-{{ item.id }}-sequences').popover({
  116. placement: 'bottom',
  117. html: true,
  118. trigger: 'click',
  119. content: function () {
  120. var content = '';
  121. {% if item.sequences %}
  122. {% for sequence in item.sequences %}
  123. content += '<p class="lead">{{ sequence.name }}</p>';
  124. {% if sequence.requirements %}
  125. content += '<p><em class="fa fa-sort-amount-desc"></em> {{ 'RequiredSessions'|get_lang }}</p>';
  126. content += '<ul>';
  127. {% for requirement in sequence.requirements %}
  128. content += '<li>';
  129. content += '<a href="{{ _p.web ~ 'session/' ~ requirement.id ~ '/about/' }}">{{ requirement.name }}</a>';
  130. content += '</li>';
  131. {% endfor %}
  132. content += '</ul>';
  133. {% endif %}
  134. {% if sequence.dependencies %}
  135. content += '<p><em class="fa fa-sort-amount-desc"></em> {{ 'DependentSessions'|get_lang }}</p>';
  136. content += '<ul>';
  137. {% for dependency in sequence.dependencies %}
  138. content += '<li>';
  139. content += '<a href="{{ _p.web ~ 'session/' ~ dependency.id ~ '/about/' }}">{{ dependency.name }}</a>';
  140. content += '</li>';
  141. {% endfor %}
  142. content += '</ul>';
  143. {% endif %}
  144. {% if item.sequences|length > 1 %}
  145. content += '<hr>';
  146. {% endif %}
  147. {% endfor %}
  148. {% else %}
  149. content = "{{ 'NoDependencies'|get_lang }}";
  150. {% endif %}
  151. return content;
  152. }
  153. });
  154. </script>
  155. {% endif %}
  156. </div>
  157. {% endset %}
  158. {{ macro.panel_course(item.id, '', content, '', '', '', image) }}
  159. </div>
  160. {% else %}
  161. <div class="alert alert-warning" role="alert">
  162. {{ 'No registered courses were found'|get_lang }}
  163. </div>
  164. {% endfor %}
  165. </div>
  166. </div>
  167. {{ catalog_pagination }}
  168. {% endautoescape %}
  169. {% endblock %}