summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/php/facades/EventFacade.php26
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(