#359 Dehardcoded the timezone (while preserving 'Europe/Paris' as the default)

SVN:trunk[1177]
This commit is contained in:
Romain Quetiez
2011-04-05 12:22:38 +00:00
parent 446a8f74fb
commit 25c529a797
4 changed files with 44 additions and 27 deletions

View File

@@ -1823,20 +1823,6 @@ class AttributeEnum extends AttributeString
*/
class AttributeDateTime extends AttributeDBField
{
//const MYDATETIMEZONE = "UTC";
const MYDATETIMEZONE = "Europe/Paris";
static protected $const_TIMEZONE = null; // set once for all upon object construct
static public function InitStatics()
{
// Init static constant once for all (remove when PHP allows real static const)
self::$const_TIMEZONE = new DateTimeZone(self::MYDATETIMEZONE);
// #@# Init default timezone -> do not get a notice... to be improved !!!
// duplicated in the email test page (the mail function does trigger a notice as well)
date_default_timezone_set(self::MYDATETIMEZONE);
}
static protected function GetDateFormat()
{
return "Y-m-d H:i:s";
@@ -1852,10 +1838,9 @@ class AttributeDateTime extends AttributeDBField
protected function GetSQLCol() {return "TIMESTAMP";}
public static function GetAsUnixSeconds($value)
{
$oDeadlineDateTime = new DateTime($value, self::$const_TIMEZONE);
$oDeadlineDateTime = new DateTime($value);
$iUnixSeconds = $oDeadlineDateTime->format('U');
return $iUnixSeconds;
}
// #@# THIS HAS TO REVISED
@@ -2153,11 +2138,6 @@ class AttributeDate extends AttributeDateTime
return "Y-m-d";
}
static public function InitStatics()
{
// Nothing to do...
}
static protected function ListExpectedParams()
{
return parent::ListExpectedParams();
@@ -2173,9 +2153,6 @@ class AttributeDate extends AttributeDateTime
}
}
// Init static constant once for all (remove when PHP allows real static const)
AttributeDate::InitStatics();
/**
* A dead line stored as a date & time
* The only difference with the DateTime attribute is the display:
@@ -2233,9 +2210,6 @@ class AttributeDeadline extends AttributeDateTime
return $sResult;
}
}
// Init static constant once for all (remove when PHP allows real static const)
AttributeDateTime::InitStatics();
/**
* Map a foreign key to an attribute