CC-4816: Timezones should be a user preference

-done
This commit is contained in:
denise 2013-01-09 13:38:38 -05:00
parent f887ca3d8d
commit db62b538dd
9 changed files with 98 additions and 46 deletions

View file

@ -434,17 +434,43 @@ class Application_Model_Preference
return self::getValue("description");
}
public static function SetTimezone($timezone)
public static function SetDefaultTimezone($timezone)
{
self::setValue("timezone", $timezone);
date_default_timezone_set($timezone);
}
public static function GetTimezone()
public static function GetDefaultTimezone()
{
return self::getValue("timezone");
}
public static function SetUserTimezone($userId, $timezone = null)
{
// When a new user is created they will get the default timezone
// setting which the admin sets on preferences page
if (is_null($timezone)) {
$timezone = self::GetDefaultTimezone();
}
self::setValue("user_".$userId."_timezone", $timezone, true, $userId);
}
public static function GetUserTimezone($id)
{
return self::getValue("user_".$id."_timezone", true);
}
public static function GetTimezone()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
return self::GetUserTimezone($id);
} else {
return self::GetDefaultTimezone();
}
}
// This is the language setting on preferences page
public static function SetDefaultLocale($locale)
{