X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=trunk%2Fgosa-core%2Finclude%2Futils%2Fclass_timezone.inc;fp=trunk%2Fgosa-core%2Finclude%2Futils%2Fclass_timezone.inc;h=7fcd7d5ca79ca6fc612159944821d8bb4f43c68c;hb=6b66bae334926c1329955b9abc458f4d4d45d285;hp=0000000000000000000000000000000000000000;hpb=7cdbfabc10974620c6fc779cd9db3a65921a59b8;p=gosa.git diff --git a/trunk/gosa-core/include/utils/class_timezone.inc b/trunk/gosa-core/include/utils/class_timezone.inc new file mode 100644 index 000000000..7fcd7d5ca --- /dev/null +++ b/trunk/gosa-core/include/utils/class_timezone.inc @@ -0,0 +1,77 @@ + "unconfigured", "value" => 0); + + /* Use current timestamp if $stamp is not set */ + if($stamp === NULL){ + $stamp = time(); + } + + /* Is there a timezone configured in the gosa configuration (gosa.conf) */ + if ($config->get_cfg_value("timezone") != ""){ + + /* Get zonename */ + $tz = $config->get_cfg_value("timezone"); + + if(!@date_default_timezone_set($tz)){ + msg_dialog::display(_("Configuration error"), sprintf(_("The timezone setting '%s' in your gosa.conf is not valid. Cannot calculate correct timezone offset."), $tz), ERROR_DIALOG); + } + $tz_delta = date("Z", $stamp); + $tz_delta = $tz_delta / 3600 ; + return(array("name" => $tz, "value" => $tz_delta)); + + } + return($zone); + } + + + /* Return zone informations */ + static public function _get_tz_zones() + { + $timezone_identifiers = DateTimeZone::listIdentifiers(); + $timezones = array(); + $zones = DateTimeZone::listAbbreviations(); + foreach($zones as $group){ + foreach($group as $zone) { + $timezones[$zone['timezone_id']] = $zone['offset']; + if($zone['dst']){ + $dst_timezones[$zone['timezone_id']] = 1; + } + } + } + return(array("TIMEZONES" => @$timezones, "DST_ZONES" => @$dst_timezones)); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>