diff options
author | emkael <emkael@tlen.pl> | 2016-05-04 15:43:10 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-04 15:48:28 +0200 |
commit | bdd798916cef168d3ce57e1039bf22cd617beff6 (patch) | |
tree | 4f20162f6fedda6f89cf90d02e101db38ea9d9aa /app/php/controls/UrlBasedCalendarControl.php | |
parent | 46afd2ec473ec4adc7e1de2a0d59872ba84288b1 (diff) |
* controls capable of resolving calendar URLs
Diffstat (limited to 'app/php/controls/UrlBasedCalendarControl.php')
-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'); + } + +} + +?> |