diff options
Diffstat (limited to 'app/frontend')
-rw-r--r-- | app/frontend/controls/ViewPreference.php | 38 | ||||
-rw-r--r-- | app/frontend/controls/ViewPreference.tpl | 4 | ||||
-rw-r--r-- | app/frontend/pages/Profile.page | 5 |
3 files changed, 47 insertions, 0 deletions
diff --git a/app/frontend/controls/ViewPreference.php b/app/frontend/controls/ViewPreference.php new file mode 100644 index 0000000..8e79951 --- /dev/null +++ b/app/frontend/controls/ViewPreference.php @@ -0,0 +1,38 @@ +<?php + +Prado::using('Application.web.FacadeTemplateControl'); + +Prado::using('Application.user.DbUser'); +Prado::using('Application.facades.UserFacade'); + +Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox'); + +class ViewPreference extends FacadeTemplateControl { + + public function getUserToChange() { + return $this->getControlState('user'); + } + + public function setUserToChange(DbUser $user) { + if (!$this->Page->IsCallBack) { + if ($user->IsGuest) { + throw new TInvalidDataValueException( + Prado::localize( + 'Grouped view preference change impossible for guest user' + ) + ); + } + $this->setControlState('user', $user); + } + } + + public function savePreference($sender, $param) { + $this->getFacade()->setGroupedViewPreference( + $this->UserToChange, + $sender->Checked + ); + } + +} + +?> diff --git a/app/frontend/controls/ViewPreference.tpl b/app/frontend/controls/ViewPreference.tpl new file mode 100644 index 0000000..43b056d --- /dev/null +++ b/app/frontend/controls/ViewPreference.tpl @@ -0,0 +1,4 @@ +<com:TActiveCheckBox OnCheckedChanged="savePreference"> + <prop:Checked><%= $this->Facade->getGroupedViewPreference($this->UserToChange) %></prop:Checked> + <prop:Text><%[ group events in calendar view ]%></prop:Text> +</com:TActiveCheckBox> diff --git a/app/frontend/pages/Profile.page b/app/frontend/pages/Profile.page index 0d531cf..bf338ef 100644 --- a/app/frontend/pages/Profile.page +++ b/app/frontend/pages/Profile.page @@ -14,6 +14,11 @@ <prop:UserToChange><%= $this->User %></prop:UserToChange> </com:LanguageSelect> <br /> + <com:ViewPreference> + <prop:Facade><%= UserFacade::getInstance() %></prop:Facade> + <prop:UserToChange><%= $this->User %></prop:UserToChange> + </com:ViewPreference> + <br /> <com:UserSelection> <prop:UserToDisplay><%= $this->User %></prop:UserToDisplay> <prop:Facade><%= CalendarFacade::getInstance() %></prop:Facade> |