summaryrefslogtreecommitdiff
path: root/app/php/controls/UrlBasedCalendarControl.php
blob: a5be82eccd086e0d51b97b1d77648f0e8abf5a08 (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
38
39
40
<?php

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

class UrlBasedCalendarControl extends FacadeTemplateControl {

    public function setCalendarUrl(string $url = NULL) {
        if ($url) {
            $calendar = $this->getFacade()->resolveUrl($url);
            if ($calendar) {
                $this->setControlState('Calendar', $calendar);
                return;
            }
        }
        if ($this->getRaiseException()) {
            throw new THttpException(
                404,
                Prado::localize('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);
    }

}

?>