diff options
author | emkael <emkael@tlen.pl> | 2016-06-07 15:17:49 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-10 11:46:41 +0200 |
commit | 823d71ced9b4947b1a5a5ade7245d521ed490061 (patch) | |
tree | a9a6c7cb0de74ff705e8320c284de423a698f5b5 /app/frontend/controls/EventList.php | |
parent | df401552aac363655ab8f056a6c910a7611954d6 (diff) |
* renaming php directory
Diffstat (limited to 'app/frontend/controls/EventList.php')
-rw-r--r-- | app/frontend/controls/EventList.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/app/frontend/controls/EventList.php b/app/frontend/controls/EventList.php new file mode 100644 index 0000000..d40e000 --- /dev/null +++ b/app/frontend/controls/EventList.php @@ -0,0 +1,59 @@ +<?php + +class EventList extends UrlBasedCalendarControl { + + private function _setDate($key, $date) { + $datetime = new DateTime($date, new DateTimeZone('UTC')); + if (!$datetime) { + throw new TInvalidDataValueException( + Prado::localize('Invalid date string: {date}', + ['date' => $date]) + ); + } + $this->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' + ); + } + +} + +?> |