1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <tbody>
<tr></tr>
{% for media in medias %}
<tr>
<th scope="row" title="{{ media.sequences.first ? media.sequences.first.name : "" }} / {{ media.file }}">{{ media.file | length > 20 ? media.file | slice(0, 20)~'...' : media.file }}
{% set difference = date(media.getValidityDateEnd()).diff(date(media.getValidityDateStart())) %}
</th>
{% for day in daysOfTheWeek %}
{% set difference = date(media.getValidityDateEnd()).diff(date(media.getValidityDateStart())) %}
{% if media.getValidityDateStart()|date('Y-m-d') == day|date('Y-m-d') %}
<td class="bg-selected">{{ dump(day|date('Y-m-d')) }}</td>
{% if media.getValidityDateStart()|date('W') != media.getValidityDateEnd()|date('W') %}
{% set lastDayOfTheWeek = media.getValidityDateStart()|date_modify('sunday this week') %}
{% set difference = date(lastDayOfTheWeek).diff(date(media.getValidityDateStart())) %}
{% for i in range(0, difference.d) %}
<td class="bg-selected"></td>
{% endfor %}
{% endif %}
{% elseif media.getValidityDateEnd()|date('Y-m-d') == day|date('Y-m-d') %}
<td class="bg-selected">{{ dump(day|date('Y-m-d')) }}</td>
{% else %}
<td></td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody> |
Partager