summaryrefslogtreecommitdiff
path: root/app/php/controls/UrlBasedCalendarControl.php
blob: 89d05a1000e74297c9bcdb11a79df954913dad53 (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.TemplateControl');
Prado::using('Application.facades.CalendarFacade');

class UrlBasedCalendarControl extends TemplateControl {

    public function setFacade(Facade $facade) {
        $this->setViewState('Facade', $facade);
    }

    public function getFacade() {
        return $this->getViewState('Facade');
    }

    public function setCalendarUrl($url) {
        if ($url) {
            $calendar = $this->getFacade()->resolveUrl($url);
            if ($calendar) {
                $this->setViewState('Calendar', $calendar);
                return;
            }
        }
        throw new THttpException(404, 'Page not found');
    }

    public function getCalendar() {
        return $this->getViewState('Calendar');
    }

}

?>