summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-03-28 18:50:15 +0200
committeremkael <emkael@tlen.pl>2016-03-28 18:50:15 +0200
commit92438c15ae16765142795605dedb4a203ff5d6c6 (patch)
tree10c521134819e65e89a2177169dccb8a08059976 /app
parentb40eca92d8e5cfd561855a440550fecc86ca4bdc (diff)
* timezone preferences refactored
Diffstat (limited to 'app')
-rw-r--r--app/php/components/TimezoneSelect.php5
-rw-r--r--app/php/user/DbUser.php8
2 files changed, 10 insertions, 3 deletions
diff --git a/app/php/components/TimezoneSelect.php b/app/php/components/TimezoneSelect.php
index 50dc494..3302e2a 100644
--- a/app/php/components/TimezoneSelect.php
+++ b/app/php/components/TimezoneSelect.php
@@ -12,7 +12,7 @@ class TimezoneSelect extends TTemplateControl {
public function setUserToChange(DbUser $user) {
if ($user->IsGuest) {
throw new TInvalidDataValueException(
- 'Password change impossible for guest user'
+ 'Timezone preference change impossible for guest user'
);
}
$this->setControlState('user', $user);
@@ -30,8 +30,7 @@ class TimezoneSelect extends TTemplateControl {
}
public function saveTimezone($sender, $param) {
- $this->UserToChange->DbRecord->Timezone = $this->Timezones->SelectedValue;
- $this->UserToChange->DbRecord->save();
+ $this->UserToChange->setTimezonePreference($this->Timezones->SelectedValue);
}
private function _getTimezones() {
diff --git a/app/php/user/DbUser.php b/app/php/user/DbUser.php
index f9c8660..896d73d 100644
--- a/app/php/user/DbUser.php
+++ b/app/php/user/DbUser.php
@@ -63,6 +63,14 @@ class DbUser extends TDbUser {
}
}
+ public function setTimezonePreference($timezone) {
+ if ($this->IsGuest) {
+ throw new TInvalidDataException('Timezone preference change impossible for guest user');
+ }
+ $this->DbRecord->Timezone = $timezone;
+ $this->DbRecord->save();
+ }
+
public function getTimezonePreference() {
if (!$this->IsGuest) {
try {