Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2322554
PhabricatorTimezoneSetting.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorTimezoneSetting.php
View Options
<?php
final
class
PhabricatorTimezoneSetting
extends
PhabricatorOptionGroupSetting
{
const
SETTINGKEY
=
'timezone'
;
public
function
getSettingName
()
{
return
pht
(
'Timezone'
);
}
public
function
getSettingDefaultValue
()
{
return
date_default_timezone_get
();
}
protected
function
getSelectOptionGroups
()
{
$timezones
=
DateTimeZone
::
listIdentifiers
();
$now
=
new
DateTime
(
'@'
.
PhabricatorTime
::
getNow
());
$groups
=
array
();
foreach
(
$timezones
as
$timezone
)
{
$zone
=
new
DateTimeZone
(
$timezone
);
$offset
=
-(
$zone
->
getOffset
(
$now
)
/
(
60
*
60
));
$groups
[
$offset
][]
=
$timezone
;
}
krsort
(
$groups
);
$option_groups
=
array
(
array
(
'label'
=>
pht
(
'Default'
),
'options'
=>
array
(),
),
);
foreach
(
$groups
as
$offset
=>
$group
)
{
if
(
$offset
>=
0
)
{
$label
=
pht
(
'UTC-%d'
,
$offset
);
}
else
{
$label
=
pht
(
'UTC+%d'
,
-
$offset
);
}
sort
(
$group
);
$option_groups
[]
=
array
(
'label'
=>
$label
,
'options'
=>
array_fuse
(
$group
),
);
}
return
$option_groups
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 5:42 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
443579
Default Alt Text
PhabricatorTimezoneSetting.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment