/**
  * 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");
 }
 /**
  * Get timezone of recurrence
  */
 public function getTimeZone()
 {
     ilTimeZone::_getDefaultTimeZone();
 }
 /**
  * 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);
 }
 /**
  * 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()));
 }