summaryrefslogtreecommitdiff
path: root/app/php/controls/UrlBasedCalendarControl.php
blob: b3e2253623a29354ab74488d1252b929d8426dc3 (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
34
35
36
37
<?php

Prado::using('Application.web.FacadeTemplateControl');
Prado::using('Application.facades.CalendarFacade');

class UrlBasedCalendarControl extends FacadeTemplateControl {

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

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

    public function setRaiseException($value) {
        $this->setControlState('RaiseException', TPropertyValue::ensureBoolean($value));
    }

    public function getRaiseException() {
        return $this->getControlState('RaiseException', FALSE);
    }

}

?>