diff options
author | emkael <emkael@tlen.pl> | 2016-03-15 23:59:33 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-03-15 23:59:33 +0100 |
commit | e509fc24d904831759071134361bef1503d4ff87 (patch) | |
tree | fe56ad530be0f4270a43f8c5715a326b67bdd249 /app/php/facades | |
parent | 0c5ca745975b1929787ea55a2d936b8fbef4a38f (diff) |
* facade for event list fetch
Diffstat (limited to 'app/php/facades')
-rw-r--r-- | app/php/facades/EventFacade.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/app/php/facades/EventFacade.php b/app/php/facades/EventFacade.php new file mode 100644 index 0000000..6ed739f --- /dev/null +++ b/app/php/facades/EventFacade.php @@ -0,0 +1,35 @@ +<?php + +Prado::using('Application.facades.Facade'); + +class EventFacade extends Facade { + + public function getEventList($dateFrom=NULL, $dateTo=NULL, $calendars=NULL) { + $calendarClause = '1=1'; + if ($calendars) { + $calendarClause = sprintf( + '_calendar IN (%s)', + implode( + ',', + array_map( + function($calendar) { + return $this->quoteString($calendar->UID); + }, + $calendars + ) + ) + ); + } + return $this->fetchList( + 'getEvents', + array( + 'date_from' => $dateFrom ?: '0000-00-00 00:00:00', + 'date_to' => $dateTo ?: '9999-99-99', + 'calendar_clause' => $calendarClause + ) + ); + } + +} + +?> |