41include_once(
'Services/Calendar/classes/class.ilTimeZoneException.php');
 
   73                        $this->timezone = $a_timezone;
 
   80                if(!self::$server_timezone)
 
   85                if(!self::$default_timezone)
 
  120                if(isset(self::$instances[$a_tz]))
 
  122                        $instance = self::$instances[$a_tz];
 
  126                        $instance = self::$instances[$a_tz] = 
new ilTimeZone($a_tz);
 
  130                if(!array_key_exists($instance->getIdentifier(),self::$valid_tz))
 
  132                        if(!$instance->validateTZ())
 
  136                        self::$valid_tz[$instance->getIdentifier()] = 
true;
 
  158                        $this->log->write(__METHOD__.
': Unsupported timezone given: Timzone: '.$this->timezone);
 
  178                        $this->log->write(__METHOD__.
': Unsupported timezone given: Timzone: '.$this->timezone);
 
  210                if(self::$current_timezone == $a_timezone)
 
  212                        #$ilLog->write(__METHOD__.': Do not switch to active timezone: '.$a_timezone); 
  217                if(function_exists(
'date_default_timezone_set'))
 
  219                        if(!date_default_timezone_set($a_timezone))
 
  221                                $ilLog->write(__METHOD__.
': Invalid timezone given. Timezone: '.$a_timezone);
 
  224                        #$ilLog->write(__METHOD__.': Switched timezone to: '.$a_timezone); 
  225                        self::$current_timezone = $a_timezone;
 
  228                if(!putenv(
'TZ='.$a_timezone))
 
  230                        $ilLog->write(__METHOD__.
': Cannot set TZ environment variable. Please register TZ in php.ini (safe_mode_allowed_env_vars). Timezone');
 
  233                self::$current_timezone = $a_timezone;
 
  248                if(!self::$server_timezone)
 
  253                self::$default_timezone = $a_tz;
 
  279                if(strlen(self::$default_timezone))
 
  284                if(function_exists(
'date_default_timezone_get') and $tz = date_default_timezone_get())
 
  286                        return self::$default_timezone = $tz;
 
  289                if($tz = ini_get(
'date.timezone'))
 
  291                        return self::$default_timezone = $tz;
 
  294                if($tz = getenv(
'PHP_TZ'))
 
  296                        return self::$default_timezone = $tz;
 
  299                if($tz = getenv(
'TZ'))
 
  301                        return self::$default_timezone = $tz;
 
  303                if(strlen($tz = date(
'T')))
 
  305                        return self::$default_timezone = $tz;
 
  307                return self::$default_timezone = 
self::UTC;
 
Class for TimeZone exceptions.
This class offers methods for timezone handling.
restoreTZ()
Restore default timezone.
getIdentifier()
get identifier
static _restoreDefaultTimeZone()
restore default timezone to server timezone
static _getDefaultTimeZone()
Calculate and set default time zone.
static _switchTimeZone($a_timezone)
Switch tz
static _setDefaultTimeZone($a_tz)
set default timezone
static _getInstance($a_tz='')
get instance by timezone
__construct($a_timezone)
Create new timezone object If no timezone is given, the default server timezone is chosen.
switchTZ()
Switch timezone to given timezone.
validateTZ()
validate timezone