mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
allow EGroupware users to select only timezones, for which we have a VTIMEZONE component (I think the others are only unofficial aliases, not included in our database)
This commit is contained in:
parent
3de5e87288
commit
ddfcdfff06
@ -111,7 +111,7 @@ class calendar_timezones
|
||||
// if not tzid queried, resolve aliases automatically
|
||||
if ($data && $data['alias'] && $what != 'tzid' && $what != 'alias')
|
||||
{
|
||||
$data = self::is2tz($data['alias'],null);
|
||||
$data = self::id2tz($data['alias'],null);
|
||||
}
|
||||
return !$data ? $data : ($what ? $data[$what] : $data);
|
||||
}
|
||||
@ -206,4 +206,36 @@ class calendar_timezones
|
||||
$GLOBALS['egw']->framework->render('<h3>'.self::import_sqlite()."</h3>\n",lang('Update timezones'),true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests
|
||||
{
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => 'calendar',
|
||||
)
|
||||
);
|
||||
include('../../header.inc.php');
|
||||
calendar_timezones::init_static();
|
||||
|
||||
// echo "<h3>Testing availability of VTIMEZONE data for each tzid supported by PHP</h3>\n";
|
||||
// foreach(DateTimeZone::listIdentifiers() as $tz)
|
||||
echo "<h3>Testing availability of VTIMEZONE data for each TZID supported by EGroupware</h3>\n";
|
||||
foreach(call_user_func_array('array_merge',egw_time::getTimezones()) as $tz => $label)
|
||||
{
|
||||
if (($id = calendar_timezones::tz2id($tz,'component')) || $tz == 'UTC') // UTC is always supported
|
||||
{
|
||||
$found[] = $tz;
|
||||
//if (substr($tz,0,10) == 'Australia/') echo "$tz: found<br />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$not_found[] = $tz;
|
||||
echo "$tz: <b>NOT</b> found<br />\n";
|
||||
}
|
||||
}
|
||||
echo '<h3>'.count($found).' found, '.count($not_found)." <b>NOT</b> found</h3>\n";
|
||||
|
||||
if ($not_found) echo "<pre>\n\$no_vtimezone = array(\n\t'".implode("',\n\t'",$not_found)."',\n);\n</pre>\n";
|
||||
}
|
||||
else*/
|
||||
calendar_timezones::init_static();
|
@ -430,8 +430,51 @@ class egw_time extends DateTime
|
||||
'Arctic' => array(),
|
||||
'UTC' => array('UTC' => 'UTC'),
|
||||
);
|
||||
// no VTIMEZONE available in calendar_timezones --> do NOT return them
|
||||
static $no_vtimezone = array(
|
||||
'Europe/Tiraspol',
|
||||
'America/Atka',
|
||||
'America/Buenos_Aires',
|
||||
'America/Catamarca',
|
||||
'America/Coral_Harbour',
|
||||
'America/Cordoba',
|
||||
'America/Ensenada',
|
||||
'America/Fort_Wayne',
|
||||
'America/Indianapolis',
|
||||
'America/Jujuy',
|
||||
'America/Knox_IN',
|
||||
'America/Mendoza',
|
||||
'America/Porto_Acre',
|
||||
'America/Rosario',
|
||||
'America/Virgin',
|
||||
'Asia/Ashkhabad',
|
||||
'Asia/Beijing',
|
||||
'Asia/Chungking',
|
||||
'Asia/Dacca',
|
||||
'Asia/Macao',
|
||||
'Asia/Riyadh87',
|
||||
'Asia/Riyadh88',
|
||||
'Asia/Riyadh89',
|
||||
'Asia/Tel_Aviv',
|
||||
'Asia/Thimbu',
|
||||
'Asia/Ujung_Pandang',
|
||||
'Asia/Ulan_Bator',
|
||||
'Australia/ACT',
|
||||
'Australia/Canberra',
|
||||
'Australia/LHI',
|
||||
'Australia/North',
|
||||
'Australia/NSW',
|
||||
'Australia/Queensland',
|
||||
'Australia/South',
|
||||
'Australia/Tasmania',
|
||||
'Australia/Victoria',
|
||||
'Australia/West',
|
||||
'Australia/Yancowinna',
|
||||
'Pacific/Samoa',
|
||||
);
|
||||
foreach(DateTimeZone::listIdentifiers() as $name)
|
||||
{
|
||||
if (in_array($name,$no_vtimezone)) continue; // do NOT allow to set in EGroupware, as we have not VTIMEZONE component for it
|
||||
list($continent,$rest) = explode('/',$name,2);
|
||||
if (!isset($tzs[$continent])) continue; // old depricated timezones
|
||||
$datetime = new egw_time('now',new DateTimeZone($name));
|
||||
|
Loading…
Reference in New Issue
Block a user