summaryrefslogtreecommitdiff
path: root/app/php/facades
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-03-15 23:59:33 +0100
committeremkael <emkael@tlen.pl>2016-03-15 23:59:33 +0100
commite509fc24d904831759071134361bef1503d4ff87 (patch)
treefe56ad530be0f4270a43f8c5715a326b67bdd249 /app/php/facades
parent0c5ca745975b1929787ea55a2d936b8fbef4a38f (diff)
* facade for event list fetch
Diffstat (limited to 'app/php/facades')
-rw-r--r--app/php/facades/EventFacade.php35
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
+ )
+ );
+ }
+
+}
+
+?>