diff options
author | emkael <emkael@tlen.pl> | 2016-05-13 16:15:49 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-13 16:15:49 +0200 |
commit | 3ed90e8e054c4ad73017de3b2e23a79726487661 (patch) | |
tree | 17d3ab68b330f1d91f591712c42316efa94f64ba /app/php | |
parent | 2f45854db2d5aa59c042ea840eaeb6aef182f531 (diff) |
* user calendar grid for specific month returned from Event facade
Diffstat (limited to 'app/php')
-rw-r--r-- | app/php/facades/EventFacade.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/php/facades/EventFacade.php b/app/php/facades/EventFacade.php index 32dab88..14f809d 100644 --- a/app/php/facades/EventFacade.php +++ b/app/php/facades/EventFacade.php @@ -3,6 +3,8 @@ Prado::using('Application.facades.Facade'); Prado::using('Application.dto.EventDTO'); Prado::using('Application.dto.TimezoneDTO'); +Prado::using('Application.dto.GridEventDTO'); +Prado::using('Application.dto.CalendarGridDTO'); Prado::using('Application.model.Calendar'); Prado::using('Application.facades.CalendarFacade'); Prado::using('Application.user.DbUser'); @@ -70,6 +72,30 @@ class EventFacade extends Facade { return []; } + public function getCalendarListForUser(DbUser $user, + $month, $year) { + if (!$year) { + $year = intval(date('Y')); + } + if (!$month) { + $month = intval(date('m')); + } + $timezone = $user + ? UserFacade::getInstance()->getTimezonePreference($user) + : new TimezoneDTO(date_default_timezone_get()); + $timeframe = CalendarFacade::getInstance()->getCalendarBoundaries( + $year, $month, $timezone + ); + return new CalendarGridDTO( + $this->getTimeframeListForUser( + $user, + $timeframe[0], $timeframe[1], + 'Application.dto.GridEventDTO' + ), + ...$timeframe + ); + } + private function _getCalendarsForEvents(array $events) { if ($events) { return Calendar::finder()->findAllByPks( |