diff options
Diffstat (limited to 'app/php/controls')
-rw-r--r-- | app/php/controls/UrlBasedCalendarControl.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/php/controls/UrlBasedCalendarControl.php b/app/php/controls/UrlBasedCalendarControl.php new file mode 100644 index 0000000..89d05a1 --- /dev/null +++ b/app/php/controls/UrlBasedCalendarControl.php @@ -0,0 +1,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'); + } + +} + +?> |