/** * get formatted date * * @access public * @param int format type * @param string format string * @param string a specific timezone */ public function get($a_format, $a_format_str = '', $a_tz = '') { if ($a_tz) { try { $timezone = ilTimeZone::_getInstance($a_tz); } catch (ilTimeZoneException $exc) { $this->log->write(__METHOD__ . ': Invalid timezone given. Timezone: ' . $a_tz); } } else { #$timezone = $this->timezone; $timezone = $this->default_timezone; } switch ($a_format) { case IL_CAL_UNIX: $date = $this->getUnixTime(); break; case IL_CAL_DATE: $timezone->switchTZ(); $date = date('Y-m-d', $this->getUnixTime()); $timezone->restoreTZ(); break; case IL_CAL_DATETIME: $timezone->switchTZ(); $date = date('Y-m-d H:i:s', $this->getUnixTime()); $timezone->restoreTZ(); break; case IL_CAL_FKT_DATE: $timezone->switchTZ(); $date = date($a_format_str, $this->getUnixTime()); $timezone->restoreTZ(); break; case IL_CAL_FKT_GETDATE: $timezone->switchTZ(); $date = getdate($this->getUnixTime()); $timezone->restoreTZ(); // add iso 8601 week day number (Sunday = 7) $date['isoday'] = $date['wday'] == 0 ? 7 : $date['wday']; break; case IL_CAL_TIMESTAMP: $timezone->switchTZ(); $date = date('YmdHis', $this->getUnixTime()); $timezone->restoreTZ(); break; } return $date; }
/** * Init settings property form * * @access protected */ protected function initFormSettings() { if (is_object($this->form)) { return true; } include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('cal_global_settings')); $this->form->addCommandButton('save', $this->lng->txt('save')); #$this->form->addCommandButton('cancel',$this->lng->txt('cancel')); $check = new ilCheckboxInputGUI($this->lng->txt('enable_calendar'), 'enable'); $check->setValue(1); $check->setChecked($this->settings->isEnabled() ? true : false); $this->form->addItem($check); $server_tz = new ilNonEditableValueGUI($this->lng->txt('cal_server_tz')); $server_tz->setValue(ilTimeZone::_getDefaultTimeZone()); $this->form->addItem($server_tz); $select = new ilSelectInputGUI($this->lng->txt('cal_def_timezone'), 'default_timezone'); $select->setOptions(ilCalendarUtil::_getShortTimeZoneList()); $select->setInfo($this->lng->txt('cal_def_timezone_info')); $select->setValue($this->settings->getDefaultTimeZone()); $this->form->addItem($select); $year = date("Y"); $select = new ilSelectInputGUI($this->lng->txt('cal_def_date_format'), 'default_date_format'); $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year)); $select->setInfo($this->lng->txt('cal_def_date_format_info')); $select->setValue($this->settings->getDefaultDateFormat()); $this->form->addItem($select); $select = new ilSelectInputGUI($this->lng->txt('cal_def_time_format'), 'default_time_format'); $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm')); $select->setInfo($this->lng->txt('cal_def_time_format_info')); $select->setValue($this->settings->getDefaultTimeFormat()); $this->form->addItem($select); // Weekstart $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_def_week_start'), 'default_week_start'); $radio->setValue($this->settings->getDefaultWeekStart()); $option = new ilRadioOption($this->lng->txt('l_su'), 0); $radio->addOption($option); $option = new ilRadioOption($this->lng->txt('l_mo'), 1); $radio->addOption($option); $this->form->addItem($radio); // Day start $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst'); $day_start->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat())); $day_start->setValue($this->settings->getDefaultDayStart()); $this->form->addItem($day_start); $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den'); $day_end->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat())); $day_end->setValue($this->settings->getDefaultDayEnd()); $this->form->addItem($day_end); $sync = new ilCheckboxInputGUI($this->lng->txt('cal_webcal_sync'), 'webcal'); $sync->setValue(1); $sync->setChecked($this->settings->isWebCalSyncEnabled()); $sync->setInfo($this->lng->txt('cal_webcal_sync_info')); $sync_min = new ilNumberInputGUI('', 'webcal_hours'); $sync_min->setSize(2); $sync_min->setMaxLength(3); $sync_min->setValue($this->settings->getWebCalSyncHours()); $sync_min->setSuffix($this->lng->txt('hours')); $sync->addSubItem($sync_min); $this->form->addItem($sync); // enable milestone planning in groups $mil = new ilFormSectionHeaderGUI(); $mil->setTitle($this->lng->txt('cal_milestone_settings')); $this->form->addItem($mil); $checkm = new ilCheckboxInputGUI($this->lng->txt('cal_enable_group_milestones'), 'enable_grp_milestones'); $checkm->setValue(1); $checkm->setChecked($this->settings->getEnableGroupMilestones() ? true : false); $checkm->setInfo($this->lng->txt('cal_enable_group_milestones_desc')); $this->form->addItem($checkm); // Consultation hours $con = new ilFormSectionHeaderGUI(); $con->setTitle($this->lng->txt('cal_ch_form_header')); $this->form->addItem($con); $ch = new ilCheckboxInputGUI($this->lng->txt('cal_ch_form'), 'ch'); $ch->setInfo($this->lng->txt('cal_ch_form_info')); $ch->setValue(1); $ch->setChecked($this->settings->areConsultationHoursEnabled()); $this->form->addItem($ch); // repository visibility default $rep = new ilFormSectionHeaderGUI(); $rep->setTitle($GLOBALS['lng']->txt('cal_setting_global_vis_repos')); $this->form->addItem($rep); $crs = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_crs_vis'), 'visible_crs'); $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info')); $crs->setValue(1); $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info')); $crs->setChecked($this->settings->isCourseCalendarEnabled()); $this->form->addItem($crs); $grp = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_grp_vis'), 'visible_grp'); $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info')); $grp->setValue(1); $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info')); $grp->setChecked($this->settings->isGroupCalendarEnabled()); $this->form->addItem($grp); // Notifications $not = new ilFormSectionHeaderGUI(); $not->setTitle($this->lng->txt('notifications')); $this->form->addItem($not); $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_notification'), 'cn'); $cgn->setOptionTitle($this->lng->txt('cal_notification_crsgrp')); $cgn->setValue(1); $cgn->setChecked($this->settings->isNotificationEnabled()); $cgn->setInfo($this->lng->txt('cal_adm_notification_info')); $this->form->addItem($cgn); $cnu = new ilCheckboxInputGUI('', 'cnu'); $cnu->setOptionTitle($this->lng->txt('cal_notification_users')); $cnu->setValue(1); $cnu->setChecked($this->settings->isUserNotificationEnabled()); $cnu->setInfo($this->lng->txt('cal_adm_notification_user_info')); $this->form->addItem($cnu); // Registration $book = new ilFormSectionHeaderGUI(); $book->setTitle($this->lng->txt('cal_registrations')); $this->form->addItem($book); $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_cg_registrations'), 'cgr'); $cgn->setValue(1); $cgn->setChecked($this->settings->isCGRegistrationEnabled()); $cgn->setInfo($this->lng->txt('cal_cg_registration_info')); $this->form->addItem($cgn); // Synchronisation cache $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('cal_cache_settings')); $this->form->addItem($sec); $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_sync_cache'), 'sync_cache'); $cache->setValue((int) $this->settings->isSynchronisationCacheEnabled()); $cache->setInfo($this->lng->txt('cal_sync_cache_info')); $cache->setRequired(true); $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_disabled'), 0); $cache->addOption($sync_cache); $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_enabled'), 1); $cache->addOption($sync_cache); $cache_t = new ilNumberInputGUI('', 'sync_cache_time'); $cache_t->setValue($this->settings->getSynchronisationCacheMinutes()); $cache_t->setMinValue(0); $cache_t->setSize(3); $cache_t->setMaxLength(3); $cache_t->setSuffix($this->lng->txt('form_minutes')); $sync_cache->addSubItem($cache_t); $this->form->addItem($cache); // Calendar cache $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_cache'), 'cache'); $cache->setValue((int) $this->settings->isCacheUsed()); $cache->setInfo($this->lng->txt('cal_cache_info')); $cache->setRequired(true); $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_disabled'), 0); $cache->addOption($sync_cache); $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_enabled'), 1); $cache->addOption($sync_cache); $cache_t = new ilNumberInputGUI('', 'cache_time'); $cache_t->setValue($this->settings->getCacheMinutes()); $cache_t->setMinValue(0); $cache_t->setSize(3); $cache_t->setMaxLength(3); $cache_t->setSuffix($this->lng->txt('form_minutes')); $sync_cache->addSubItem($cache_t); $this->form->addItem($cache); }
/** * create client tag * * @param ilSetting $setting */ private function __buildClient($setting) { $auth_modes = ilAuthUtils::_getActiveAuthModes(); $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes))); $auth_mode_names = array(); foreach ($auth_modes as $mode) { $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode)); } // determine skins/styles $skin_styles = array(); include_once "./Services/Style/classes/class.ilStyleDefinition.php"; $styleDefinition = new ilStyleDefinition(); include_once "./Services/Style/classes/class.ilObjStyleSettings.php"; $templates = $styleDefinition->getAllTemplates(); if (is_array($templates)) { foreach ($templates as $template) { // get styles information of template $styleDef =& new ilStyleDefinition($template["id"]); $styleDef->startParsing(); $styles = $styleDef->getStyles(); foreach ($styles as $style) { if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) { continue; } $skin_styles[] = $template["id"] . ":" . $style["id"]; } } } // timezones include_once 'Services/Calendar/classes/class.ilTimeZone.php'; $this->xmlStartTag("Client", array("inst_id" => $setting->get("inst_id"), "id" => $setting->clientid, "enabled" => $setting->access == 1 ? "TRUE" : "FALSE", "default_lang" => $setting->language)); $this->xmlEndTag("Client"); return; // END here due to security reasons. $this->xmlElement("Name", null, $setting->get("inst_name")); $this->xmlElement("Description", null, $setting->description); $this->xmlElement("Institution", null, $setting->get("inst_institution")); $this->xmlStartTag("Responsible"); $this->xmlElement("Firstname", null, $setting->get("admin_firstname")); $this->xmlElement("Lastname", null, $setting->get("admin_lastname")); $this->xmlElement("Title", null, $setting->get("admin_title")); $this->xmlElement("Institution", null, $setting->get("admin_institution")); $this->xmlElement("Position", null, $setting->get("admin_position")); $this->xmlElement("Email", null, $setting->get("admin_email")); $this->xmlElement("Street ", null, $setting->get("admin_street")); $this->xmlElement("ZipCode ", null, $setting->get("admin_zipcode")); $this->xmlElement("City", null, $setting->get("admin_city")); $this->xmlElement("Country", null, $setting->get("admin_country")); $this->xmlElement("Phone", null, $setting->get("admin_phone")); $this->xmlEndTag("Responsible"); $this->xmlStartTag("Settings"); $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient")); $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient")); $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session); $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration")); $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names)); $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default); $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles)); $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style); $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone()); $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page); $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online); $this->xmlEndTag("Settings"); if ($this->exportAdvMDDefs) { // create advanced meta data record xml include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php'; include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php'; $record_ids = array(); $record_types = ilAdvancedMDRecord::_getAssignableObjectTypes(); foreach ($record_types as $type) { $records = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($type); foreach ($records as $record) { $record_ids[] = $record->getRecordId(); } } $record_ids = array_unique($record_ids); $this->xmlStartTag('AdvancedMetaDataRecords'); if (count($record_ids) > 0) { foreach ($record_ids as $record_id) { $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id); $record_obj->toXML($this); } } $this->xmlEndTag('AdvancedMetaDataRecords'); } if ($this->exportUDFDefs) { // create user defined fields record xml include_once "./Services/User/classes/class.ilUserDefinedFields.php"; $udf_data =& ilUserDefinedFields::_newInstance(); $udf_data->addToXML($this); } $this->xmlEndTag("Client"); }
private function verifyPref($key, $value) { switch ($key) { case 'mail_linebreak': case 'hits_per_page': if (!is_numeric($value) || $value < 0) { $this->logFailure("---", "Wrong value '{$value}': Positiv numeric value expected for preference {$key}."); } break; case 'language': case 'skin': case 'style': case 'ilPageEditor_HTMLMode': case 'ilPageEditor_JavaScript': case 'ilPageEditor_MediaMode': case 'tst_javascript': case 'tst_lastquestiontype': case 'tst_multiline_answers': case 'tst_use_previous_answers': case 'graphicalAnswerSetting': case 'priv_feed_pass': $this->logFailure("---", "Preference {$key} is not supported."); break; case 'public_city': case 'public_country': case 'public_department': case 'public_email': case 'public_fax': case 'public_hobby': case 'public_institution': case 'public_matriculation': case 'public_phone': case 'public_phone_home': case 'public_phone_mobile': case 'public_phone_office': case 'public_street': case 'public_upload': case 'public_zip': case 'send_info_mails': case 'hide_own_online_status': if (!in_array($value, array('y', 'n'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y' or 'n' expected for preference {$key}."); } break; case 'public_profile': if (!in_array($value, array('y', 'n', 'g'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y', 'g' or 'n' expected for preference {$key}."); } break; case 'show_users_online': if (!in_array($value, array('y', 'n', 'associated'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y' or 'n' or 'associated' expected for preference {$key}."); } break; case 'mail_incoming_type': if (!in_array((int) $value, array("0", "1", "2"))) { $this->logFailure("---", "Wrong value '{$value}': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference {$key}."); } break; case 'weekstart': if (!in_array($value, array("0", "1"))) { $this->logFailure("---", "Wrong value '{$value}': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference {$key}."); } break; case 'mail_signature': break; case 'user_tz': include_once 'Services/Calendar/classes/class.ilTimeZone.php'; try { $tz = ilTimeZone::_getInstance($value); return true; } catch (ilTimeZoneException $tze) { $this->logFailure("---", "Wrong value '{$value}': Invalid timezone {$value} detected for preference {$key}."); } break; default: if (!ilUserXMLWriter::isPrefExportable($key)) { $this->logFailure("---", "Preference {$key} is not supported."); } break; } }
/** * Create new date object * * @access public * @param mixed integer string following the format given as the second parameter * @param int format of date presentation * */ public function __construct($a_date = '', $a_format = 0) { parent::__construct($a_date, $a_format, ilTimeZone::UTC); $this->default_timezone = ilTimeZone::_getInstance('UTC'); }
/** * Apply BYMONTHDAY rules. * * @access protected */ protected function applyBYMONTHDAYRules(ilDateList $list) { // return unmodified, if no byweekno rules are available if (!$this->recurrence->getBYMONTHDAYList()) { return $list; } $days_list = $this->initDateList(); foreach ($list->get() as $seed) { $num_days = ilCalendarUtil::_getMaxDayOfMonth($seed->get(IL_CAL_FKT_DATE, 'Y', $this->timezone), $seed->get(IL_CAL_FKT_DATE, 'n', $this->timezone)); /* $num_days = cal_days_in_month(CAL_GREGORIAN, $seed->get(IL_CAL_FKT_DATE,'n',$this->timezone), $seed->get(IL_CAL_FKT_DATE,'Y',$this->timezone)); */ #$this->log->write(__METHOD__.': Month '.$seed->get(IL_CAL_FKT_DATE,'M',$this->timezone).' has '.$num_days.' days.'); foreach ($this->recurrence->getBYMONTHDAYList() as $bymonth_no) { $day_no = $bymonth_no < 0 ? $num_days + $bymonth_no + 1 : $bymonth_no; if ($this->frequence_context != ilCalendarRecurrence::FREQ_YEARLY) { if ($day_no < 1 or $day_no > $num_days) { $this->log->write(__METHOD__ . ': Ignoring BYMONTHDAY rule: ' . $day_no . ' for month ' . $seed->get(IL_CAL_FKT_DATE, 'M', $this->timezone)); continue; } } $day_diff = $day_no - $seed->get(IL_CAL_FKT_DATE, 'j', $this->timezone); $new_day = $this->createDate($seed->get(IL_CAL_UNIX, '', $this->timezone)); $new_day->increment(ilDateTime::DAY, $day_diff); switch ($this->frequence_context) { case ilCalendarRecurrence::FREQ_DAILY: // Check if day matches #var_dump("<pre>",$seed->get(IL_CAL_FKT_DATE,'z',$this->timezone),$day_no,"</pre>"); if ($seed->get(IL_CAL_FKT_DATE, 'j', $this->timezone) == $day_no) { $days_list->add($new_day); } break; case ilCalendarRecurrence::FREQ_WEEKLY: // Check if week matches if ($seed->get(IL_CAL_FKT_DATE, 'W', $this->timezone) == $new_day->get(IL_CAL_FKT_DATE, 'W', $this->timezone)) { $days_list->add($new_day); } break; case ilCalendarRecurrence::FREQ_MONTHLY: // seed and new day are in the same month. $days_list->add($new_day); break; case ilCalendarRecurrence::FREQ_YEARLY: $h = $this->event->isFullday() ? 0 : $seed->get(IL_CAL_FKT_DATE, 'H', $this->timezone); $i = $this->event->isFullday() ? 0 : $seed->get(IL_CAL_FKT_DATE, 'i', $this->timezone); $s = $this->event->isFullday() ? 0 : $seed->get(IL_CAL_FKT_DATE, 's', $this->timezone); $y = $seed->get(IL_CAL_FKT_DATE, 'Y', $this->timezone); // TODO: the chosen monthday has to added to all months for ($month = 1; $month <= 12; $month++) { #$num_days = cal_days_in_month(CAL_GREGORIAN, # $month, # $y); $num_days = ilCalendarUtil::_getMaxDayOfMonth($y, $month); $day_no = $bymonth_no < 0 ? $num_days + $bymonth_no + 1 : $bymonth_no; if ($day_no < 1 or $day_no > $num_days) { $this->log->write(__METHOD__ . ': Ignoring BYMONTHDAY rule: ' . $day_no . ' for month ' . $month); } else { $tz_obj = ilTimeZone::_getInstance($this->timezone); $tz_obj->switchTZ(); $unix = mktime($h, $i, $s, $month, $day_no, $y); $tz_obj->restoreTZ(); $new_day = $this->createDate($unix); $days_list->add($new_day); } } break; } } } $this->frequence_context = ilCalendarRecurrence::FREQ_DAILY; return $days_list; }
/** * Get timezone of recurrence */ public function getTimeZone() { ilTimeZone::_getDefaultTimeZone(); }
/** * Read settings * * @access private * @param * */ private function read() { $this->setEnabled($this->storage->get('enabled')); $this->setDefaultTimeZone($this->storage->get('default_timezone', ilTimeZone::_getDefaultTimeZone())); $this->setDefaultWeekStart($this->storage->get('default_week_start', self::WEEK_START_MONDAY)); $this->setDefaultDateFormat($this->storage->get('default_date_format', self::DATE_FORMAT_DMY)); $this->setDefaultTimeFormat($this->storage->get('default_time_format', self::TIME_FORMAT_24)); $this->setEnableGroupMilestones($this->storage->get('enable_grp_milestones')); $this->setDefaultDayStart($this->storage->get('default_day_start', self::DEFAULT_DAY_START)); $this->setDefaultDayEnd($this->storage->get('default_day_end', self::DEFAULT_DAY_END)); $this->useCache($this->storage->get('cache_enabled'), $this->cache_enabled); $this->setCacheMinutes($this->storage->get('cache_minutes', self::DEFAULT_CACHE_MINUTES)); $this->enableSynchronisationCache($this->storage->get('sync_cache_enabled'), $this->isSynchronisationCacheEnabled()); $this->setSynchronisationCacheMinutes($this->storage->get('sync_cache_minutes', self::DEFAULT_SYNC_CACHE_MINUTES)); $this->enableNotification($this->storage->get('notification', $this->isNotificationEnabled())); $this->enableConsultationHours($this->storage->get('consultation_hours', $this->areConsultationHoursEnabled())); $this->enableCGRegistration($this->storage->get('cg_registration', $this->isCGRegistrationEnabled())); $this->enableCourseCalendar($this->storage->get('course_cal', $this->isCourseCalendarEnabled())); $this->enableGroupCalendar($this->storage->get('group_cal', $this->isGroupCalendarEnabled())); $this->enableUserNotification($this->storage->get('notification_user', $this->isUserNotificationEnabled())); $this->enableWebCalSync($this->storage->get('webcal_sync', $this->isWebCalSyncEnabled())); $this->setWebCalSyncHours($this->storage->get('webcal_sync_hours', $this->getWebCalSyncHours())); }
/** * Calculate and set default time zone * * @access public * @static * @return time zone string */ public static function _getDefaultTimeZone() { if (strlen(self::$default_timezone)) { return self::$default_timezone; } // PHP >= 5.2.0 if (function_exists('date_default_timezone_get') and $tz = date_default_timezone_get()) { return self::$default_timezone = $tz; } // PHP ini option (PHP >= 5.1.0) if ($tz = ini_get('date.timezone')) { return self::$default_timezone = $tz; } // is $_ENV['PHP_TZ'] set ? if ($tz = getenv('PHP_TZ')) { return self::$default_timezone = $tz; } // is $_ENV['TZ'] set ? if ($tz = getenv('TZ')) { return self::$default_timezone = $tz; } if (strlen($tz = date('T'))) { return self::$default_timezone = $tz; } return self::$default_timezone = self::UTC; }
/** * Switch timezone * * @access protected */ protected function switchTZ(ilTimeZone $timezone) { try { $timezone->switchTZ(); } catch (ilTimeZoneException $e) { $this->log->write(__METHOD__ . ': Found invalid timezone: ' . $timezone); return false; } }