templates/common/agendaContent.html.twig line 1

Open in your IDE?
  1. {# Pour format_date et les patterns de date,
  2.     cf. https://twig.symfony.com/doc/3.x/filters/format_datetime.html
  3.     cf. https://www.php.net/manual/en/intldateformatter.setpattern.php
  4.     cf. https://unicode-org.github.io/icu/
  5. #}
  6. {% if isAllEvents is not defined %}
  7.     {% set isAllEvents = false %}
  8. {% endif %}
  9. <div class="events-list{% if isAllEvents %} is-all-events{% endif %}">
  10.     {% for period in periods %}
  11.         {# {{ dump(thatDate) }}
  12.         {{ dump(period.periodStart|date('d/m/y')) }}
  13.         {{ dump(period.periodStart|date('d/m/y') != thatDate) }} #}
  14.         {# On redéfinit et on affiche thatDate si l'event ne commence pas le même jour que l'event précédent #}
  15.         {% if (thatDate is not defined) or (period.periodStart|date('d/m/y') != thatDate) %}
  16.             {% set thatDate = period.periodStart|date('d/m/y') %}
  17.             <p class="mt-3 mb-1 date">
  18.                 {% if isAllEvents %}
  19.                     {{ period.periodStart|format_date(pattern="EEEE d MMMM y")|capitalize }}
  20.                 {% else %}
  21.                     {{ period.periodStart|format_date(pattern="EEEE d MMMM")|capitalize }}
  22.                 {% endif %}
  23.             </p>
  24.             {# pattern="EEE d MMMM y" donne Dim. 6 décembre 2020 #}
  25.         {% endif %}
  26.         
  27.         <p class="mt-2 mb-2">
  28.             {% if period.event.important %}
  29.                 <span class="badge badge-pill badge-danger">!</span>
  30.             {% endif %}
  31.             {% if period.allDay %}
  32.                 ~
  33.             {% else %}
  34.                 {{ period.periodStart|date('H') }}h{{ period.periodStart|date('i') }}
  35.             {% endif %} : <a href="
  36.                 {% if period.event.slug %}
  37.                     {{ path('showEventBySlug', { slug : period.event.slug }) }}
  38.                 {% else %}
  39.                     {{ path('showEvent', { id : period.event.id }) }}
  40.                 {% endif %}
  41.                 ">{{ period.event.title }}</a>
  42.         </p>
  43.     {% endfor %}
  44. </div>