From 5bfe174b5907440a4f08bd45fd9c384ab5c58037 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 6 May 2016 15:35:54 +0200 Subject: * common super-class for template controls using a facade --- app/php/controls/CalendarScaffold.php | 12 ++---------- app/php/controls/PasswordChange.php | 4 ++-- app/php/controls/RegistrationForm.php | 4 ++-- app/php/controls/TimezoneSelect.php | 4 ++-- app/php/controls/UpcomingEvents.php | 12 ++---------- app/php/controls/UrlBasedCalendarControl.php | 12 ++---------- app/php/controls/UserSelection.php | 12 ++---------- app/php/web/FacadeTemplateControl.php | 18 ++++++++++++++++++ 8 files changed, 32 insertions(+), 46 deletions(-) create mode 100644 app/php/web/FacadeTemplateControl.php diff --git a/app/php/controls/CalendarScaffold.php b/app/php/controls/CalendarScaffold.php index 87ffdb0..b12f6aa 100644 --- a/app/php/controls/CalendarScaffold.php +++ b/app/php/controls/CalendarScaffold.php @@ -1,6 +1,6 @@ setViewState('Facade', $facade); - } - - public function getFacade() { - return $this->getViewState('Facade'); - } +class CalendarScaffold extends FacadeTemplateControl { public function onPreRender($param) { parent::onPreRender($param); diff --git a/app/php/controls/PasswordChange.php b/app/php/controls/PasswordChange.php index 5653ef3..7c177a6 100644 --- a/app/php/controls/PasswordChange.php +++ b/app/php/controls/PasswordChange.php @@ -1,10 +1,10 @@ getControlState('user'); diff --git a/app/php/controls/RegistrationForm.php b/app/php/controls/RegistrationForm.php index 0f24cea..d88fb95 100644 --- a/app/php/controls/RegistrationForm.php +++ b/app/php/controls/RegistrationForm.php @@ -1,10 +1,10 @@ IsValid = !User::finder()->countByLogin($this->Login->SafeText); diff --git a/app/php/controls/TimezoneSelect.php b/app/php/controls/TimezoneSelect.php index d0357e4..31ba15d 100644 --- a/app/php/controls/TimezoneSelect.php +++ b/app/php/controls/TimezoneSelect.php @@ -1,11 +1,11 @@ getControlState('user'); diff --git a/app/php/controls/UpcomingEvents.php b/app/php/controls/UpcomingEvents.php index 1ba5600..ac0271b 100644 --- a/app/php/controls/UpcomingEvents.php +++ b/app/php/controls/UpcomingEvents.php @@ -1,18 +1,10 @@ setViewState('Facade', $facade); - } - - public function getFacade() { - return $this->getViewState('Facade'); - } +class UpcomingEvents extends FacadeTemplateControl { public function getUserToDisplay() { return $this->getControlState('user'); diff --git a/app/php/controls/UrlBasedCalendarControl.php b/app/php/controls/UrlBasedCalendarControl.php index 89d05a1..1f737e8 100644 --- a/app/php/controls/UrlBasedCalendarControl.php +++ b/app/php/controls/UrlBasedCalendarControl.php @@ -1,17 +1,9 @@ setViewState('Facade', $facade); - } - - public function getFacade() { - return $this->getViewState('Facade'); - } +class UrlBasedCalendarControl extends FacadeTemplateControl { public function setCalendarUrl($url) { if ($url) { diff --git a/app/php/controls/UserSelection.php b/app/php/controls/UserSelection.php index 83c7bae..d215d7b 100644 --- a/app/php/controls/UserSelection.php +++ b/app/php/controls/UserSelection.php @@ -1,18 +1,10 @@ setViewState('Facade', $facade); - } - - public function getFacade() { - return $this->getViewState('Facade'); - } +class UserSelection extends FacadeTemplateControl { public function getUserToDisplay() { return $this->getControlState('user'); diff --git a/app/php/web/FacadeTemplateControl.php b/app/php/web/FacadeTemplateControl.php new file mode 100644 index 0000000..b713f49 --- /dev/null +++ b/app/php/web/FacadeTemplateControl.php @@ -0,0 +1,18 @@ +setControlState('Facade', $facade); + } + + public function getFacade() { + return $this->getControlState('Facade'); + } + +} + +?> -- cgit v1.2.3