/**
  * Create new ILIAS account
  *
  * @access public
  * 
  * @param string external username
  */
 public function create($a_username, $a_userdata = array())
 {
     $a_userdata = $this->parseFullname($a_userdata);
     $this->writer->xmlStartTag('Users');
     // Single users
     // Required fields
     // Create user
     $this->writer->xmlStartTag('User', array('Action' => 'Insert'));
     $this->writer->xmlElement('Login', array(), $new_name = ilAuthUtils::_generateLogin($a_username));
     // Assign to role only for new users
     $this->writer->xmlElement('Role', array('Id' => $this->settings->getDefaultRole(), 'Type' => 'Global', 'Action' => 'Assign'), '');
     if (isset($a_userdata['email'])) {
         $this->writer->xmlElement('Email', array(), $a_userdata['email']);
     }
     if (isset($a_userdata['postcode'])) {
         $this->writer->xmlElement('PostalCode', array(), $a_userdata['postcode']);
     }
     if (isset($a_userdata['dob']) and $a_userdata['dob']) {
         $this->writer->xmlElement('Birthday', array(), $a_userdata['dob']);
     }
     if (isset($a_userdata['gender'])) {
         $this->writer->xmlElement('Gender', array(), strtolower($a_userdata['gender']));
     }
     if (isset($a_userdata['title'])) {
         $this->writer->xmlElement('Title', array(), $a_userdata['title']);
     }
     if (isset($a_userdata['firstname'])) {
         $this->writer->xmlElement('Firstname', array(), $a_userdata['firstname']);
     }
     if (isset($a_userdata['lastname'])) {
         $this->writer->xmlElement('Lastname', array(), $a_userdata['lastname']);
     }
     $this->writer->xmlElement('Active', array(), "true");
     $this->writer->xmlElement('TimeLimitOwner', array(), 7);
     $this->writer->xmlElement('TimeLimitUnlimited', array(), 1);
     $this->writer->xmlElement('TimeLimitFrom', array(), time());
     $this->writer->xmlElement('TimeLimitUntil', array(), time());
     $this->writer->xmlElement('AuthMode', array('type' => 'openid'), 'openid');
     $this->writer->xmlElement('ExternalAccount', array(), $a_username);
     $this->writer->xmlEndTag('User');
     $this->writer->xmlEndTag('Users');
     $this->log->write('OpenId: Started creation of user: '******'./Services/User/classes/class.ilUserImportParser.php';
     $importParser = new ilUserImportParser();
     $importParser->setXMLContent($this->writer->xmlDumpMem(false));
     $importParser->setRoleAssignment(array($this->settings->getDefaultRole() => $this->settings->getDefaultRole()));
     $importParser->setFolderId(7);
     $importParser->startParsing();
     // Assign timezone
     if (isset($a_userdata['timezone'])) {
         include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
         $tzs = ilCalendarUtil::_getShortTimeZoneList();
         if (isset($tzs[$a_userdata['timezone']])) {
             $usr_id = ilObjUser::_lookupId($new_name);
             ilObjUser::_writePref($usr_id, 'user_tz', $a_userdata['timezone']);
         }
     }
     return $new_name;
 }
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * Init basic settings form.
  */
 public function initBasicSettingsForm($a_install = false)
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // webspace dir
     $ne = new ilNonEditableValueGUI($lng->txt("data_directory_in_ws"), "webspace_dir");
     if ($a_install) {
         $ne->setInfo($this->lng->txt("data_directory_in_ws_info"));
     }
     $cwd = ilUtil::isWindows() ? str_replace("\\", "/", getcwd()) : getcwd();
     $ne->setValue($cwd . "/data");
     $this->form->addItem($ne);
     // data dir
     if ($a_install) {
         $ti = new ilTextInputGUI($lng->txt("data_directory_outside_ws"), "datadir_path");
         $ti->setInfo($lng->txt("data_directory_info"));
         $ti->setRequired(true);
         $this->form->addItem($ti);
     } else {
         $ne = new ilNonEditableValueGUI($lng->txt("data_directory_outside_ws"), "data_dir");
         $this->form->addItem($ne);
     }
     $lvext = ilUtil::isWindows() ? "_win" : "";
     // logging
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("logging"));
     $this->form->addItem($sh);
     // path to log file
     $ti = new ilTextInputGUI($lng->txt("log_path"), "log_path");
     $ti->setInfo($lng->txt("log_path_comment" . $lvext));
     $this->form->addItem($ti);
     // disable logging
     $cb = new ilCheckboxInputGUI($lng->txt("disable_logging"), "chk_log_status");
     $this->form->addItem($cb);
     // server settings
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("server_settings"));
     $this->form->addItem($sh);
     // time zone
     include_once "./Services/Calendar/classes/class.ilCalendarUtil.php";
     $si = new ilSelectInputGUI($lng->txt("time_zone"), "time_zone");
     $si->setOptions(array_merge(array("" => "-- " . $lng->txt("please_select") . " --"), ilCalendarUtil::_getShortTimeZoneList()));
     $si->setRequired(true);
     $this->form->addItem($si);
     // required 3rd party tools
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("3rd_party_software_req"));
     $this->form->addItem($sh);
     // convert path
     $ti = new ilTextInputGUI($lng->txt("convert_path"), "convert_path");
     $ti->setInfo($lng->txt("convert_path_comment" . $lvext));
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // zip path
     $ti = new ilTextInputGUI($lng->txt("zip_path"), "zip_path");
     $ti->setInfo($lng->txt("zip_path_comment" . $lvext));
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // unzip path
     $ti = new ilTextInputGUI($lng->txt("unzip_path"), "unzip_path");
     $ti->setInfo($lng->txt("unzip_path_comment" . $lvext));
     $ti->setRequired(true);
     $this->form->addItem($ti);
     // optional 3rd party tools
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("3rd_party_software_opt"));
     $this->form->addItem($sh);
     // ghostscript path
     $ti = new ilTextInputGUI($lng->txt("ghostscript_path"), "ghostscript_path");
     $ti->setInfo($lng->txt("ghostscript_path_comment" . $lvext));
     $this->form->addItem($ti);
     // java path
     $ti = new ilTextInputGUI($lng->txt("java_path"), "java_path");
     $ti->setInfo($lng->txt("java_path_comment" . $lvext));
     $this->form->addItem($ti);
     // htmldoc path
     $ti = new ilTextInputGUI($lng->txt("htmldoc_path"), "htmldoc_path");
     $ti->setInfo($lng->txt("htmldoc_path_comment" . $lvext));
     $this->form->addItem($ti);
     // ffmpeg path
     $ti = new ilTextInputGUI($lng->txt("ffmpeg_path"), "ffmpeg_path");
     $ti->setInfo($lng->txt("ffmpeg_path_comment"));
     $this->form->addItem($ti);
     // latex
     $ti = new ilTextInputGUI($lng->txt("url_to_latex"), "latex_url");
     $ti->setInfo($lng->txt("latex_url_comment"));
     $this->form->addItem($ti);
     // virus scanner
     $options = array("none" => $lng->txt("none"), "sophos" => $lng->txt("sophos"), "antivir" => $lng->txt("antivir"), "clamav" => $lng->txt("clamav"));
     $si = new ilSelectInputGUI($lng->txt("virus_scanner"), "vscanner_type");
     $si->setOptions($options);
     $this->form->addItem($si);
     // scan command
     $ti = new ilTextInputGUI($lng->txt("scan_command"), "scan_command");
     $this->form->addItem($ti);
     // clean command
     $ti = new ilTextInputGUI($lng->txt("clean_command"), "clean_command");
     $this->form->addItem($ti);
     if ($a_install) {
         $sh = new ilFormSectionHeaderGUI();
         $sh->setTitle($lng->txt("master_password"));
         $this->form->addItem($sh);
         // password
         $pi = new ilPasswordInputGUI($lng->txt("password"), "password");
         $pi->setRequired(true);
         $pi->setSkipSyntaxCheck(true);
         $pi->setInfo($lng->txt("password_info"));
         $this->form->addItem($pi);
     }
     if ($a_install) {
         $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
     } else {
         $this->form->addCommandButton("updateBasicSettings", $lng->txt("save"));
         $this->form->addCommandButton("determineToolsPath", $lng->txt("determine_tools_paths"));
     }
     $this->form->setTitle($lng->txt("data_directories"));
     $this->form->setFormAction("setup.php?cmd=gateway");
     if ($a_install) {
         $det = $this->determineTools();
         $this->form->setValuesByArray($det);
     }
 }
 /**
  * show settings table
  *
  * @access public
  * @return
  */
 public function initSettingsForm()
 {
     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, 'save'));
     $this->form->setTitle($this->lng->txt('cal_user_settings'));
     $this->form->addCommandButton('save', $this->lng->txt('save'));
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
     $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
     $select->setInfo($this->lng->txt('cal_timezone_info'));
     $select->setValue($this->user_settings->getTimeZone());
     $this->form->addItem($select);
     $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz');
     $export_type->setValue($this->user_settings->getExportTimeZoneType());
     $export_tz = new ilRadioOption($this->lng->txt('cal_export_timezone_tz'), ilCalendarUserSettings::CAL_EXPORT_TZ_TZ);
     $export_type->addOption($export_tz);
     $export_utc = new ilRadioOption($this->lng->txt('cal_export_timezone_utc'), ilCalendarUserSettings::CAL_EXPORT_TZ_UTC);
     $export_type->addOption($export_utc);
     $this->form->addItem($export_type);
     $year = date("Y");
     $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), '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_date_format_info'));
     $select->setValue($this->user_settings->getDateFormat());
     $this->form->addItem($select);
     $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
     $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm'));
     $select->setInfo($this->lng->txt('cal_time_format_info'));
     $select->setValue($this->user_settings->getTimeFormat());
     $this->form->addItem($select);
     // Week/Month View
     $week_month = new ilFormSectionHeaderGUI();
     $week_month->setTitle($this->lng->txt('cal_week_month_view'));
     $this->form->addItem($week_month);
     $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart');
     $radio->setValue($this->user_settings->getWeekStart());
     $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/Week View
     $week_month = new ilFormSectionHeaderGUI();
     $week_month->setTitle($this->lng->txt('cal_day_week_view'));
     $this->form->addItem($week_month);
     $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
     $day_start->setOptions(ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat()));
     $day_start->setValue($this->user_settings->getDayStart());
     $this->form->addItem($day_start);
     $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
     $day_end->setOptions(ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat()));
     $day_end->setValue($this->user_settings->getDayEnd());
     $this->form->addItem($day_end);
 }
 /**
  * Init general settings form.
  *
  */
 public function initGeneralSettingsForm()
 {
     global $lng, $ilUser, $styleDefinition, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // language
     if ($this->userSettingVisible("language")) {
         $languages = $this->lng->getInstalledLanguages();
         $options = array();
         foreach ($languages as $lang_key) {
             $options[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key);
         }
         $si = new ilSelectInputGUI($this->lng->txt("language"), "language");
         $si->setOptions($options);
         $si->setValue($ilUser->getLanguage());
         $si->setDisabled($ilSetting->get("usr_settings_disable_language"));
         $this->form->addItem($si);
     }
     // skin/style
     include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
     if ($this->userSettingVisible("skin_style")) {
         $templates = $styleDefinition->getAllTemplates();
         if (is_array($templates)) {
             $si = new ilSelectInputGUI($this->lng->txt("skin_style"), "skin_style");
             $options = array();
             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;
                     }
                     $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
                 }
             }
             $si->setOptions($options);
             $si->setValue($ilUser->skin . ":" . $ilUser->prefs["style"]);
             $si->setDisabled($ilSetting->get("usr_settings_disable_skin_style"));
             $this->form->addItem($si);
         }
     }
     // screen reader optimization
     if ($this->userSettingVisible("screen_reader_optimization")) {
         $cb = new ilCheckboxInputGUI($this->lng->txt("user_screen_reader_optimization"), "screen_reader_optimization");
         $cb->setChecked($ilUser->prefs["screen_reader_optimization"]);
         $cb->setDisabled($ilSetting->get("usr_settings_disable_screen_reader_optimization"));
         $cb->setInfo($this->lng->txt("user_screen_reader_optimization_info"));
         $this->form->addItem($cb);
     }
     // hits per page
     if ($this->userSettingVisible("hits_per_page")) {
         $si = new ilSelectInputGUI($this->lng->txt("hits_per_page"), "hits_per_page");
         $hits_options = array(10, 15, 20, 30, 40, 50, 100, 9999);
         $options = array();
         foreach ($hits_options as $hits_option) {
             $hstr = $hits_option == 9999 ? $this->lng->txt("no_limit") : $hits_option;
             $options[$hits_option] = $hstr;
         }
         $si->setOptions($options);
         $si->setValue($ilUser->prefs["hits_per_page"]);
         $si->setDisabled($ilSetting->get("usr_settings_disable_hits_per_page"));
         $this->form->addItem($si);
     }
     // Users Online
     if ($this->userSettingVisible("show_users_online")) {
         $si = new ilSelectInputGUI($this->lng->txt("show_users_online"), "show_users_online");
         $options = array("y" => $this->lng->txt("users_online_show_y"), "associated" => $this->lng->txt("users_online_show_associated"), "n" => $this->lng->txt("users_online_show_n"));
         $si->setOptions($options);
         $si->setValue($ilUser->prefs["show_users_online"]);
         $si->setDisabled($ilSetting->get("usr_settings_disable_show_users_online"));
         $this->form->addItem($si);
     }
     // Store last visited
     $lv = new ilSelectInputGUI($this->lng->txt("user_store_last_visited"), "store_last_visited");
     $options = array(0 => $this->lng->txt("user_lv_keep_entries"), 1 => $this->lng->txt("user_lv_keep_only_for_session"), 2 => $this->lng->txt("user_lv_do_not_store"));
     $lv->setOptions($options);
     $lv->setValue((int) $ilUser->prefs["store_last_visited"]);
     $this->form->addItem($lv);
     // hide_own_online_status
     if ($this->userSettingVisible("hide_own_online_status")) {
         $cb = new ilCheckboxInputGUI($this->lng->txt("hide_own_online_status"), "hide_own_online_status");
         $cb->setChecked($ilUser->prefs["hide_own_online_status"] == "y");
         $cb->setDisabled($ilSetting->get("usr_settings_disable_hide_own_online_status"));
         $this->form->addItem($cb);
     }
     include_once 'Services/Authentication/classes/class.ilSessionReminder.php';
     if (ilSessionReminder::isGloballyActivated()) {
         $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
         $cb->setInfo($this->lng->txt('session_reminder_info'));
         $cb->setValue(1);
         $cb->setChecked((int) $ilUser->getPref('session_reminder_enabled'));
         $expires = ilSession::getSessionExpireValue();
         $lead_time_gui = new ilNumberInputGUI($this->lng->txt('session_reminder_lead_time'), 'session_reminder_lead_time');
         $lead_time_gui->setInfo(sprintf($this->lng->txt('session_reminder_lead_time_info'), ilFormat::_secondsToString($expires, true)));
         $min_value = ilSessionReminder::MIN_LEAD_TIME;
         $max_value = max($min_value, (int) $expires / 60 - 1);
         $current_user_value = $ilUser->getPref('session_reminder_lead_time');
         if ($current_user_value < $min_value || $current_user_value > $max_value) {
             $current_user_value = ilSessionReminder::SUGGESTED_LEAD_TIME;
         }
         $value = min(max($min_value, $current_user_value), $max_value);
         $lead_time_gui->setValue($value);
         $lead_time_gui->setSize(3);
         $lead_time_gui->setMinValue($min_value);
         $lead_time_gui->setMaxValue($max_value);
         $cb->addSubItem($lead_time_gui);
         $this->form->addItem($cb);
     }
     // calendar settings (copied here to be reachable when calendar is inactive)
     // they cannot be hidden/deactivated
     include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
     include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
     $lng->loadLanguageModule("dateplaner");
     $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
     $select = new ilSelectInputGUI($lng->txt('cal_user_timezone'), 'timezone');
     $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
     $select->setInfo($lng->txt('cal_timezone_info'));
     $select->setValue($user_settings->getTimeZone());
     $this->form->addItem($select);
     $year = date("Y");
     $select = new ilSelectInputGUI($lng->txt('cal_user_date_format'), '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($lng->txt('cal_date_format_info'));
     $select->setValue($user_settings->getDateFormat());
     $this->form->addItem($select);
     $select = new ilSelectInputGUI($lng->txt('cal_user_time_format'), 'time_format');
     $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm'));
     $select->setInfo($lng->txt('cal_time_format_info'));
     $select->setValue($user_settings->getTimeFormat());
     $this->form->addItem($select);
     // starting point
     include_once "Services/User/classes/class.ilUserUtil.php";
     if (ilUserUtil::hasPersonalStartingPoint()) {
         $this->lng->loadLanguageModule("administration");
         $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start");
         $si->setRequired(true);
         $si->setInfo($this->lng->txt("adm_user_starting_point_info"));
         foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) {
             $si->addOption(new ilRadioOption($caption, $value));
         }
         $si->setValue(ilUserUtil::getPersonalStartingPoint());
         $this->form->addItem($si);
         // starting point: repository object
         $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
         $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id");
         $repobj_id->setRequired(true);
         $repobj_id->setSize(5);
         if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) {
             $start_ref_id = ilUserUtil::getPersonalStartingObject();
             $repobj_id->setValue($start_ref_id);
             if ($start_ref_id) {
                 $start_obj_id = ilObject::_lookupObjId($start_ref_id);
                 if ($start_obj_id) {
                     $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id));
                 }
             }
         }
         $repobj->addSubItem($repobj_id);
         $si->addOption($repobj);
     }
     // selector for unicode characters
     global $ilSetting;
     if ($ilSetting->get('char_selector_availability') > 0) {
         require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
         $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_USER);
         $char_selector->getConfig()->setAvailability($ilUser->getPref('char_selector_availability'));
         $char_selector->getConfig()->setDefinition($ilUser->getPref('char_selector_definition'));
         $char_selector->addFormProperties($this->form);
         $char_selector->setFormValues($this->form);
     }
     $this->form->addCommandButton("saveGeneralSettings", $lng->txt("save"));
     $this->form->setTitle($lng->txt("general_settings"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
Esempio n. 6
0
<?php

exit;
define('ZONEINFO', '/usr/share/zoneinfo');
define('TZ_CONVERT', 'tz_convert');
define('READLINK', 'readlink');
chdir('../../..');
include_once 'include/inc.header.php';
include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
foreach (ilCalendarUtil::_getShortTimeZoneList() as $tz_name => $tmp) {
    $name_underscore = str_replace('/', '_', $tz_name);
    if (is_link(ZONEINFO . '/' . $tz_name)) {
        $name = exec(READLINK . ' -f ' . ZONEINFO . '/' . $tz_name);
    } else {
        $name = ZONEINFO . '/' . $tz_name;
    }
    exec(TZ_CONVERT . ' -o Services/Calendar/zoneinfo/' . $name_underscore . '.tmp' . ' ' . $name);
    $reader = fopen('Services/Calendar/zoneinfo/' . $name_underscore . '.tmp', 'r');
    $writer = fopen('Services/Calendar/zoneinfo/' . $name_underscore . '.ics', 'w');
    $counter = 0;
    while ($line = fgets($reader)) {
        if (++$counter < 4) {
            continue;
        }
        if ($counter == 5) {
            fputs($writer, 'TZID=' . $tz_name . "\n");
        } else {
            if (substr($line, 0, 13) === 'END:VCALENDAR') {
                break;
            }
            fputs($writer, $line);