summaryrefslogtreecommitdiff
path: root/app/php/controls/UrlBasedCalendarControl.php
blob: c61bc3703daf525ee5ec4c3c0139f057594f33d5 (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(string $url = NULL) {
        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);
    }

}

?>