summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/php/facades/CalendarFacade.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/php/facades/CalendarFacade.php b/app/php/facades/CalendarFacade.php
index 71ddcb4..25dec5f 100644
--- a/app/php/facades/CalendarFacade.php
+++ b/app/php/facades/CalendarFacade.php
@@ -1,6 +1,7 @@
<?php
Prado::using('Application.facades.Facade');
+Prado::using('Application.facades.EventFacade');
Prado::using('Application.dto.CalendarDTO');
Prado::using('Application.dto.CalendarGroupDTO');
Prado::using('Application.model.Calendar');
@@ -51,6 +52,30 @@ class CalendarFacade extends Facade {
}
}
+ public function getEventsForTimeframe(CalendarDTO $calendar,
+ DateTime $dateFrom,
+ DateTime $dateTo,
+ $order = 'ASC') {
+ $calendar = Calendar::finder()->findAllByUID($calendar->ID);
+ if ($calendar) {
+ $events = EventFacade::getInstance()->getEventList(
+ $dateFrom->format('Y-m-d H:i:s'),
+ $dateTo->format('Y-m-d H:i:s'),
+ $calendar,
+ $order
+ );
+ return array_map(
+ function($event) use($calendar) {
+ $dto = new EventDTO();
+ $dto->loadRecord($event, $calendar);
+ return $dto;
+ },
+ $events
+ );
+ }
+ return [];
+ }
+
public function getAll() {
return Calendar::finder()->withCategory()->findAll('ORDER BY name ASC');
}