summaryrefslogtreecommitdiff
path: root/app/frontend/controls/UpcomingEvents.php
blob: 27fc7235352367d8bec1c5323f59d0132406f1f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
        );
    }

}

?>