From 2e9216dcf303917764d4af622dcd212ec1491889 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 6 May 2016 13:24:34 +0200 Subject: * event lists on calendar page --- app/php/controls/EventList.php | 56 ++++++++++++++++++++++++++++++++++++++++++ app/php/controls/EventList.tpl | 6 +++++ app/php/pages/Calendar.page | 14 +++++++++++ 3 files changed, 76 insertions(+) create mode 100644 app/php/controls/EventList.php create mode 100644 app/php/controls/EventList.tpl diff --git a/app/php/controls/EventList.php b/app/php/controls/EventList.php new file mode 100644 index 0000000..325641b --- /dev/null +++ b/app/php/controls/EventList.php @@ -0,0 +1,56 @@ +setViewState($key, $datetime); + } + + public function setDateFrom($date) { + $this->_setDate('DateFrom', $date); + } + + public function getDateFrom() { + return $this->getViewState('DateFrom'); + } + + public function setDateTo($date) { + $this->_setDate('DateTo', $date); + } + + public function getDateTo() { + return $this->getViewState('DateTo'); + } + + public function setHeaderText($text) { + $this->setViewState('HeaderText', TPropertyValue::ensureString($text)); + } + + public function getHeaderText() { + return $this->getViewState('HeaderText'); + } + + public function setReverse($value) { + $this->setViewState('Reverse', TPropertyValue::ensureBoolean($value)); + } + + public function getReverse() { + return $this->getViewState('Reverse'); + } + + public function getEvents() { + return $this->getFacade()->getEventsForTimeframe( + $this->getCalendar(), + $this->getDateFrom() ?: new DateTime('0000-00-00'), + $this->getDateTo() ?: new DateTime('9999-99-99'), + $this->getReverse() ? 'DESC' : 'ASC' + ); + } + +} + +?> diff --git a/app/php/controls/EventList.tpl b/app/php/controls/EventList.tpl new file mode 100644 index 0000000..5881ce7 --- /dev/null +++ b/app/php/controls/EventList.tpl @@ -0,0 +1,6 @@ + + <%= $this->getHeaderText() %> + + + <%= $this->getEvents() %> + diff --git a/app/php/pages/Calendar.page b/app/php/pages/Calendar.page index c77c2c5..bc80d1a 100644 --- a/app/php/pages/Calendar.page +++ b/app/php/pages/Calendar.page @@ -11,4 +11,18 @@ calendar visible in current filter selection + + <%= CalendarFacade::getInstance() %> + <%= $this->Request->itemAt('calendar') %> + + Upcoming events in the calendar: + + + + <%= CalendarFacade::getInstance() %> + <%= $this->Request->itemAt('calendar') %> + + Past events in the calendar: + + -- cgit v1.2.3