summaryrefslogtreecommitdiff
path: root/app/frontend/controls/UpcomingEvents.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/frontend/controls/UpcomingEvents.php')
-rw-r--r--app/frontend/controls/UpcomingEvents.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/frontend/controls/UpcomingEvents.php b/app/frontend/controls/UpcomingEvents.php
new file mode 100644
index 0000000..27fc723
--- /dev/null
+++ b/app/frontend/controls/UpcomingEvents.php
@@ -0,0 +1,33 @@
+<?php
+
+Prado::using('Application.web.FacadeTemplateControl');
+Prado::using('Application.user.DbUser');
+Prado::using('Application.facades.EventFacade');
+
+class UpcomingEvents extends FacadeTemplateControl {
+
+ public function getUserToDisplay() {
+ return $this->getControlState('user');
+ }
+
+ public function setUserToDisplay(DbUser $user) {
+ $this->setControlState('user', $user);
+ }
+
+ public function getEvents() {
+ return $this->_getEventsForUser($this->UserToDisplay);
+ }
+
+ private function _getEventsForUser(DbUser $user) {
+ $utc = new DateTimeZone('UTC');
+ $dateFrom = new DateTime('now', $utc);
+ $dateTo = new DateTime('+7 days', $utc);
+ return $this->getFacade()->getTimeframeListForUser(
+ $user,
+ $dateFrom, $dateTo
+ );
+ }
+
+}
+
+?>