mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
initial import
This commit is contained in:
40
lib/classes/timezone.class.php
Normal file
40
lib/classes/timezone.class.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
class timezone
|
||||
{
|
||||
|
||||
public static function getForm($props=array(),$selected=false)
|
||||
{
|
||||
$form = '<select ';
|
||||
|
||||
foreach($props as $k=>$v)
|
||||
$form .= $k.'="'.$v.'" ';
|
||||
$form .='>';
|
||||
|
||||
$list = self::getList();
|
||||
|
||||
$times = array();
|
||||
|
||||
foreach($list as $k=>$v)
|
||||
{
|
||||
foreach($v as $v2)
|
||||
if(($timezone = trim($v2['timezone_id'])) !== '')
|
||||
$times[] = $timezone;
|
||||
}
|
||||
|
||||
$times = array_unique($times);
|
||||
asort($times);
|
||||
|
||||
foreach($times as $time)
|
||||
$form .= '<option '.($selected == $time ? "selected" : "").' value="'.$time.'">'.$time.'</option>';
|
||||
|
||||
$form .= '</select>';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
private static function getList()
|
||||
{
|
||||
return DateTimeZone::listAbbreviations();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user