summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
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 {