commit ffe4f7a835e6085af243456403918b45f6619b17
parent 1eaec390f06adc790a519215d28945e069a165bc
Author: dankert <devnull@localhost>
Date: Thu, 22 Oct 2009 19:27:14 +0200
Benutzereinstellung für eine Zeitzone
Diffstat:
5 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/actionClasses/ProfileAction.class.php b/actionClasses/ProfileAction.class.php
@@ -70,11 +70,20 @@ class ProfileAction extends Action
* Benutzer-Einstellungen anzeigen.
* Diese Einstellungen werden im Cookie gespeichert.
*/
- function settings()
+ function settingsView()
{
- foreach( array('always_edit') as $name )
+ foreach( array('always_edit','timezone_offset') as $name )
+ $this->setTemplateVar($name,(int)($_COOKIE['or_'.$name]));
+
+ $timezone_list = array();
+ $timezone_list[ date('Z') ] = 'SERVER ('.(date('Z')>=0?'+':'').intval(date('Z')/3600).':00)';
- $this->setTemplateVar($name,isset($_COOKIE['or_'.$name]));
+ global $conf;
+ $tzlist = $conf['date']['timezone'];
+ foreach ($tzlist as $offset=>$name)
+ $timezone_list[$offset] = $name.' ('.($offset>=0?'+':'').intval($offset/60).':00)'.($offset==date('Z')/60?' *':'');
+
+ $this->setTemplateVar('timezone_list',$timezone_list);
}
@@ -82,16 +91,16 @@ class ProfileAction extends Action
/**
* Speichern der Benutzereinstellungen.
*/
- function savesettings()
+ function settingsAction()
{
- foreach( array('always_edit') as $name )
+ foreach( array('always_edit','timezone_offset') as $name )
{
// Prüfen, ob Checkbox aktiviert wurde.
if ( $this->hasRequestVar($name))
{
// Cookie setzen
- setcookie('or_'.$name,'1',time()+(60*60*24*30*12*2));
- $_COOKIE['or_'.$name] = '1';
+ setcookie('or_'.$name,$this->getRequestVar($name,'num'),time()+(60*60*24*30*12*2));
+ $_COOKIE['or_'.$name] = $this->getRequestVar($name,'num');
}
else
{
diff --git a/actionClasses/ProfileAction.ini.php b/actionClasses/ProfileAction.ini.php
@@ -36,10 +36,7 @@ goto=edit
[settings]
menu=edit
-target=savesettings
-
-[savesettings]
-goto=settings
+write=true
[menu]
edit=edit,settings,pwchange,mail,groups
\ No newline at end of file
diff --git a/config/date.ini.php b/config/date.ini.php
@@ -22,3 +22,8 @@ UNIX = "U"
LONG = "F j, Y, g:i a"
+[timezone]
+-6="New York"
+0="UTC (GMT)"
+60="MET (Middle European Time)"
+120="MEST (Middle European Summertime)"
+\ No newline at end of file
diff --git a/themes/default/include/html/date.inc.php b/themes/default/include/html/date.inc.php
@@ -2,7 +2,12 @@
global $conf;
$time = $attr_date;
- // TODO: Benutzereinstellung 'Zeitzonen-Offset' auswerten.
+ // Benutzereinstellung 'Zeitzonen-Offset' auswerten.
+ if ( isset($_COOKIE['or_timezone_offset']) )
+ {
+ $time -= (int)date('Z');
+ $time += ((int)$_COOKIE['or_timezone_offset']*60);
+ }
if ( $time==0)
echo lang('GLOBAL_UNKNOWN');
diff --git a/themes/default/templates/profile/settings.tpl.src.php b/themes/default/templates/profile/settings.tpl.src.php
@@ -3,10 +3,19 @@ page
window
row
cell
- checkbox name:always_edit
- #cell
- label for:always_edit
- text key:setting_always_edit
+ newline
+ fieldset title:message:settings
+ checkbox name:always_edit
+ #cell
+ label for:always_edit
+ text key:setting_always_edit
+
+ row
+ cell
+ newline
+ fieldset title:message:timezone
+ selectbox name:timezone_offset list:timezone_list addempty:true
+ newline
row
cell colspan:2 class:act