Fixed event listing box

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely POLONKAI (W00d5t0ck) 2012-09-01 18:45:06 +02:00
parent bf41a6f92f
commit 9069918dc4
2 changed files with 12 additions and 13 deletions

View File

@ -21,31 +21,30 @@
<tbody> <tbody>
<tr> <tr>
<td class="woy">{{ firstDay|date('W') }}</td> <td class="woy">{{ firstDay|date('W') }}</td>
{% set curDow = 0 %} {% set woy = firstDay|date('W') + 1 %}
{% if firstDayWeekday != 1 %} {% if firstDayWeekday != 1 %}
{% for i in 1..(firstDayWeekday - 1) %} {% for i in 1..firstDayWeekday - 1 %}
{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %}
<td></td> <td></td>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% set cur = firstDayWeekday - 1 %} {% set curDow = firstDayWeekday %}
{% for i in 1..numDays %} {% for i in 1..numDays %}
{% set cur = cur + 1 %}
{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %}
{% set eventCount = 0 %}
<td id="event-calendar-{{ i }}"{% if eventList[i].events|length > 0 %} class="program" rel="{{ path('KekRozsakFrontBundle_eventAjaxList', {date: eventList[i].date|date('Y-m-d'), _format: 'html'}) }}"{% endif %}> <td id="event-calendar-{{ i }}"{% if eventList[i].events|length > 0 %} class="program" rel="{{ path('KekRozsakFrontBundle_eventAjaxList', {date: eventList[i].date|date('Y-m-d'), _format: 'html'}) }}"{% endif %}>
<a href="{{ path('KekRozsakFrontBundle_eventList', { date: eventList[i].date|date('Y-m-d')}) }}">{{ eventList[i].date|date('d') }}</a> <a href="{{ path('KekRozsakFrontBundle_eventList', { date: eventList[i].date|date('Y-m-d')}) }}">{{ eventList[i].date|date('d') }}</a>
</td> </td>
{% if cur is divisibleby(7) %} {% if curDow is divisibleby(7) %}
{% set curDow = 0 %}
</tr> </tr>
{% if cur != numDays %}
<tr> <tr>
<td class="woy">{{ eventList[i + 1].date|date('W') }}</td> {% if i != numDays %}
<td class="woy">{{ woy }}</td>
{% set woy = woy + 1 %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% set curDow = curDow + 1 %}
{% endfor %} {% endfor %}
{% if curDow != 7 %} {% if curDow != 1 %}
{% for i in (curDow + 1)..7 %} {% for i in curDow..7 %}
<td></td> <td></td>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@ -69,7 +69,7 @@ class EventsExtension extends \Twig_Extension
'today' => $today, 'today' => $today,
'firstDay' => $firstDay, 'firstDay' => $firstDay,
'lastDay' => $lastDay, 'lastDay' => $lastDay,
'firstDayWeekday' => $firstDayWeekday, 'firstDayWeekday' => ($firstDayWeekday == 0) ? 7 : $firstDayWeekday,
'numDays' => $numDays, 'numDays' => $numDays,
); );
} }