From 3ed90e8e054c4ad73017de3b2e23a79726487661 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 May 2016 16:15:49 +0200 Subject: * user calendar grid for specific month returned from Event facade --- app/php/facades/EventFacade.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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( -- cgit v1.2.3