From 9069918dc48733e26c3fa8cbdf048dc662d919c2 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Sat, 1 Sep 2012 18:45:06 +0200 Subject: [PATCH] Fixed event listing box Signed-off-by: Gergely POLONKAI (W00d5t0ck) --- .../Resources/views/Box/Events.html.twig | 23 +++++++++---------- .../FrontBundle/Twig/EventsExtension.php | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/KekRozsak/FrontBundle/Resources/views/Box/Events.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Box/Events.html.twig index d3bb8c9..4456d13 100644 --- a/src/KekRozsak/FrontBundle/Resources/views/Box/Events.html.twig +++ b/src/KekRozsak/FrontBundle/Resources/views/Box/Events.html.twig @@ -21,31 +21,30 @@ {{ firstDay|date('W') }} -{% set curDow = 0 %} +{% set woy = firstDay|date('W') + 1 %} {% if firstDayWeekday != 1 %} -{% for i in 1..(firstDayWeekday - 1) %} -{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %} +{% for i in 1..firstDayWeekday - 1 %} {% endfor %} {% endif %} -{% set cur = firstDayWeekday - 1 %} +{% set curDow = firstDayWeekday %} {% for i in 1..numDays %} -{% set cur = cur + 1 %} -{% set curDow = curDow + 1 %}{% if curDow == 8 %}{% set curDow = 1 %}{% endif %} -{% set eventCount = 0 %} 0 %} class="program" rel="{{ path('KekRozsakFrontBundle_eventAjaxList', {date: eventList[i].date|date('Y-m-d'), _format: 'html'}) }}"{% endif %}> {{ eventList[i].date|date('d') }} -{% if cur is divisibleby(7) %} +{% if curDow is divisibleby(7) %} +{% set curDow = 0 %} -{% if cur != numDays %} - {{ eventList[i + 1].date|date('W') }} +{% if i != numDays %} + {{ woy }} +{% set woy = woy + 1 %} {% endif %} {% endif %} +{% set curDow = curDow + 1 %} {% endfor %} -{% if curDow != 7 %} -{% for i in (curDow + 1)..7 %} +{% if curDow != 1 %} +{% for i in curDow..7 %} {% endfor %} {% endif %} diff --git a/src/KekRozsak/FrontBundle/Twig/EventsExtension.php b/src/KekRozsak/FrontBundle/Twig/EventsExtension.php index d5db8c9..5bb32c5 100644 --- a/src/KekRozsak/FrontBundle/Twig/EventsExtension.php +++ b/src/KekRozsak/FrontBundle/Twig/EventsExtension.php @@ -69,7 +69,7 @@ class EventsExtension extends \Twig_Extension 'today' => $today, 'firstDay' => $firstDay, 'lastDay' => $lastDay, - 'firstDayWeekday' => $firstDayWeekday, + 'firstDayWeekday' => ($firstDayWeekday == 0) ? 7 : $firstDayWeekday, 'numDays' => $numDays, ); }