Exemplo n.º 1
0
 /**
  * Init basic settings form.
  */
 public function initBasicSettingsForm()
 {
     /**
      * @var $lng ilLanguage
      * @var $ilSetting ilSetting
      */
     global $lng, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $lng->loadLanguageModule("pd");
     // installation short title
     $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
     $ti->setMaxLength(200);
     $ti->setSize(40);
     $ti->setValue($ilSetting->get("short_inst_name"));
     $ti->setInfo($this->lng->txt("short_inst_name_info"));
     $this->form->addItem($ti);
     // public section
     $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
     $cb->setInfo($lng->txt("pub_section_info"));
     if ($ilSetting->get("pub_section")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // Enable Global Profiles
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
     $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
     $cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
     $cb->addSubItem($cb_prop);
     // search engine
     include_once 'Services/PrivacySecurity/classes/class.ilRobotSettings.php';
     $robot_settings = ilRobotSettings::_getInstance();
     $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
     $cb2->setInfo($this->lng->txt("enable_search_engine"));
     $this->form->addItem($cb2);
     if (!$robot_settings->checkRewrite()) {
         $cb2->setAlert($lng->txt("allow_override_alert"));
         $cb2->setChecked(false);
         $cb2->setDisabled(true);
     } else {
         if ($ilSetting->get("open_google")) {
             $cb2->setChecked(true);
         }
     }
     // locale
     $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
     $ti->setMaxLength(80);
     $ti->setSize(40);
     $ti->setInfo($this->lng->txt("adm_locale_info"));
     $ti->setValue($ilSetting->get("locale"));
     $this->form->addItem($ti);
     // starting point
     include_once "Services/User/classes/class.ilUserUtil.php";
     $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"));
     $valid = array_keys(ilUserUtil::getPossibleStartingPoints());
     foreach (ilUserUtil::getPossibleStartingPoints(true) as $value => $caption) {
         $opt = new ilRadioOption($caption, $value);
         $si->addOption($opt);
         if (!in_array($value, $valid)) {
             $opt->setInfo($this->lng->txt("adm_user_starting_point_invalid_info"));
         }
     }
     $si->setValue(ilUserUtil::getStartingPoint());
     $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::getStartingObject();
         $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);
     // starting point: personal
     $startp = new ilCheckboxInputGUI($lng->txt("adm_user_starting_point_personal"), "usr_start_pers");
     $startp->setInfo($lng->txt("adm_user_starting_point_personal_info"));
     $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
     $si->addSubItem($startp);
     // save and cancel commands
     $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
     $this->form->setTitle($lng->txt("basic_settings"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * Init basic settings form.
  */
 public function initBasicSettingsForm()
 {
     global $lng, $ilSetting;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $lng->loadLanguageModule("pd");
     // installation short title
     $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
     $ti->setMaxLength(200);
     $ti->setSize(40);
     $ti->setValue($ilSetting->get("short_inst_name"));
     $ti->setInfo($this->lng->txt("short_inst_name_info"));
     $this->form->addItem($ti);
     // public section
     $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
     $cb->setInfo($lng->txt("pub_section_info"));
     if ($ilSetting->get("pub_section")) {
         $cb->setChecked(true);
     }
     // search engine
     include_once 'Services/PrivacySecurity/classes/class.ilRobotSettings.php';
     $robot_settings = ilRobotSettings::_getInstance();
     $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
     $cb2->setInfo($this->lng->txt("enable_search_engine"));
     $cb->addSubItem($cb2);
     if (!$robot_settings->checkModRewrite()) {
         $cb2->setAlert($lng->txt("mod_rewrite_disabled"));
         $cb2->setChecked(false);
         $cb2->setDisabled(true);
     } elseif (!$robot_settings->checkRewrite()) {
         $cb2->setAlert($lng->txt("allow_override_alert"));
         $cb2->setChecked(false);
         $cb2->setDisabled(true);
     } else {
         if ($ilSetting->get("open_google")) {
             $cb2->setChecked(true);
         }
     }
     // Enable Global Profiles
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
     $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info'));
     $cb_prop->setChecked($ilSetting->get('enable_global_profiles'));
     $cb->addSubItem($cb_prop);
     // activate captcha for anonymous wiki/forum editing
     include_once "./Services/Captcha/classes/class.ilCaptchaUtil.php";
     $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_wiki_forum'), 'activate_captcha_anonym');
     $cap->setValue(1);
     if (ilCaptchaUtil::checkFreetype()) {
         $cap->setChecked($ilSetting->get('activate_captcha_anonym'));
     } else {
         $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
     }
     $cb->addSubItem($cap);
     $this->form->addItem($cb);
     // default repository view
     $options = array("flat" => $lng->txt("flatview"), "tree" => $lng->txt("treeview"));
     $si = new ilSelectInputGUI($this->lng->txt("def_repository_view"), "default_rep_view");
     $si->setOptions($options);
     $si->setInfo($this->lng->txt(""));
     if ($ilSetting->get("default_repository_view") == "tree") {
         $si->setValue("tree");
     } else {
         $si->setValue("flat");
     }
     $this->form->addItem($si);
     //
     $options = array("" => $lng->txt("adm_rep_tree_only_container"), "tree" => $lng->txt("adm_all_resource_types"));
     // repository tree
     $radg = new ilRadioGroupInputGUI($lng->txt("adm_rep_tree_presentation"), "tree_pres");
     $radg->setValue($ilSetting->get("repository_tree_pres"));
     $op1 = new ilRadioOption($lng->txt("adm_rep_tree_only_cntr"), "", $lng->txt("adm_rep_tree_only_cntr_info"));
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("adm_rep_tree_all_types"), "all_types", $lng->txt("adm_rep_tree_all_types_info"));
     // limit tree in courses and groups
     $cb = new ilCheckboxInputGUI($lng->txt("adm_rep_tree_limit_grp_crs"), "rep_tree_limit_grp_crs");
     $cb->setChecked($ilSetting->get("rep_tree_limit_grp_crs"));
     $cb->setInfo($lng->txt("adm_rep_tree_limit_grp_crs_info"));
     $op2->addSubItem($cb);
     $radg->addOption($op2);
     $this->form->addItem($radg);
     $sdesc = new ilCheckboxInputGUI($lng->txt("adm_rep_shorten_description"), "rep_shorten_description");
     $sdesc->setInfo($lng->txt("adm_rep_shorten_description_info"));
     $sdesc->setChecked($ilSetting->get("rep_shorten_description"));
     $this->form->addItem($sdesc);
     $sdesclen = new ilTextInputGUI($lng->txt("adm_rep_shorten_description_length"), "rep_shorten_description_length");
     $sdesclen->setValue($ilSetting->get("rep_shorten_description_length"));
     $sdesclen->setSize(3);
     $sdesc->addSubItem($sdesclen);
     // synchronize repository tree with main view
     $cb = new ilCheckboxInputGUI($lng->txt("adm_synchronize_rep_tree"), "rep_tree_synchronize");
     $cb->setInfo($lng->txt("adm_synchronize_rep_tree_info"));
     $cb->setChecked($ilSetting->get("rep_tree_synchronize"));
     $this->form->addItem($cb);
     // repository access check
     /*		$options = array(
     			0 => "0",
     			10 => "10",
     			30 => "30",
     			60 => "60",
     			120 => "120"
     			);
     		$si = new ilSelectInputGUI($this->lng->txt("adm_repository_cache_time"), "rep_cache");
     		$si->setOptions($options);
     		$si->setValue($ilSetting->get("rep_cache"));
     		$si->setInfo($this->lng->txt("adm_repository_cache_time_info")." ".
     			$this->lng->txt("adm_repository_cache_time_info2"));
     		$this->form->addItem($si);*/
     // load action commands asynchronously
     $cb = new ilCheckboxInputGUI($this->lng->txt("adm_item_cmd_asynch"), "item_cmd_asynch");
     $cb->setInfo($this->lng->txt("adm_item_cmd_asynch_info"));
     $cb->setChecked($ilSetting->get("item_cmd_asynch"));
     $this->form->addItem($cb);
     // locale
     $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
     $ti->setMaxLength(80);
     $ti->setSize(40);
     $ti->setInfo($this->lng->txt("adm_locale_info"));
     $ti->setValue($ilSetting->get("locale"));
     $this->form->addItem($ti);
     // trash
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_trash"), "enable_trash");
     $cb->setInfo($this->lng->txt("enable_trash_info"));
     if ($ilSetting->get("enable_trash")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // BEGIN SESSION SETTINGS
     // create session handling radio group
     $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type');
     $ssettings->setValue($ilSetting->get('session_handling_type', ilSession::SESSION_HANDLING_FIXED));
     // first option, fixed session duration
     $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED);
     // create session reminder subform
     $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled");
     $expires = ilSession::getSessionExpireValue();
     $time = ilFormat::_secondsToString($expires, true);
     $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time));
     if ((int) $ilSetting->get("session_reminder_enabled")) {
         $cb->setChecked(true);
     }
     $fixed->addSubItem($cb);
     // add session handling to radio group
     $ssettings->addOption($fixed);
     // second option, session control
     $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT);
     // add session control subform
     require_once 'Services/Authentication/classes/class.ilSessionControl.php';
     // this is the max count of active sessions
     // that are getting started simlutanously
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_count_info'));
     $sub_ti->setValue($ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (min) idle time the session can be deleted,
     // if there are further requests for new sessions,
     // but max session count is reached yet
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_min_idle_info'));
     $sub_ti->setValue($ilSetting->get("session_min_idle", ilSessionControl::DEFAULT_MIN_IDLE));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // after this (max) idle timeout the session expires
     // and become invalid, so it is not considered anymore
     // when calculating current count of active sessions
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_info'));
     $sub_ti->setValue($ilSetting->get("session_max_idle", ilSessionControl::DEFAULT_MAX_IDLE));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // this is the max duration that can elapse between the first and the secnd
     // request to the system before the session is immidietly deleted
     $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request');
     $sub_ti->setMaxLength(5);
     $sub_ti->setSize(5);
     $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info'));
     $sub_ti->setValue($ilSetting->get("session_max_idle_after_first_request", ilSessionControl::DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST));
     if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         $sub_ti->setDisabled(true);
     }
     $ldsh->addSubItem($sub_ti);
     // add session control to radio group
     $ssettings->addOption($ldsh);
     // add radio group to form
     if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $this->form->addItem($ssettings);
     } else {
         // just shows the status wether the session
         //setting maintenance is allowed by setup
         $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config");
         $ti->setValue($this->lng->txt('session_config_maintenance_disabled'));
         $ssettings->setDisabled(true);
         $ti->addSubItem($ssettings);
         $this->form->addItem($ti);
     }
     // END SESSION SETTINGS
     // password assistance
     $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance");
     if ($ilSetting->get("password_assistance")) {
         $cb->setChecked(true);
     }
     $cb->setInfo($this->lng->txt("password_assistance_info"));
     $this->form->addItem($cb);
     // password generation
     $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate");
     if ($ilSetting->get("passwd_auto_generate")) {
         $cb->setChecked(true);
     }
     $cb->setInfo($this->lng->txt("passwd_generation_info"));
     $this->form->addItem($cb);
     // dynamic web links
     $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic");
     $cb->setInfo($this->lng->txt("links_dynamic_info"));
     if ($ilSetting->get("links_dynamic")) {
         $cb->setChecked(true);
     }
     $this->form->addItem($cb);
     // Learners View
     $pl = new ilCheckboxInputGUI($this->lng->txt('preview_learner'), 'preview_learner');
     $pl->setValue(1);
     $pl->setInfo($this->lng->txt('preview_learner_info'));
     $pl->setChecked($ilSetting->get('preview_learner'));
     $this->form->addItem($pl);
     // notes/comments/tagging
     $pl = new ilCheckboxInputGUI($this->lng->txt('adm_show_comments_tagging_in_lists'), 'comments_tagging_in_lists');
     $pl->setValue(1);
     $pl->setChecked($ilSetting->get('comments_tagging_in_lists'));
     $this->form->addItem($pl);
     // starting point
     include_once "Services/User/classes/class.ilUserUtil.php";
     $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::getStartingPoint());
     $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::getStartingObject();
         $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);
     // starting point: personal
     $startp = new ilCheckboxInputGUI($lng->txt("adm_user_starting_point_personal"), "usr_start_pers");
     $startp->setInfo($lng->txt("adm_user_starting_point_personal_info"));
     $startp->setChecked(ilUserUtil::hasPersonalStartingPoint());
     $si->addSubItem($startp);
     // save and cancel commands
     $this->form->addCommandButton("saveBasicSettings", $lng->txt("save"));
     $this->form->setTitle($lng->txt("basic_settings"));
     $this->form->setFormAction($this->ctrl->getFormAction($this));
 }
 /**
  * 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));
 }
 protected function initForm()
 {
     $this->setTitle($this->pl->txt('form_title'));
     $te = new ilTextInputGUI($this->txt(self::F_TITLE), self::F_TITLE);
     $te->setRequired(true);
     $this->addItem($te);
     $this->setTitle($this->pl->txt('form_title'));
     $te = new ilTextAreaInputGUI($this->txt(self::F_DESCRIPTION), self::F_DESCRIPTION);
     $this->addItem($te);
     $cb = new ilCheckboxInputGUI($this->txt(self::F_STATUS), self::F_STATUS);
     //		$this->addItem($cb);
     $se = new ilSelectInputGUI($this->txt(self::F_GLOBAL_ROLE), self::F_GLOBAL_ROLE);
     $se->setRequired(true);
     $global_roles = self::getRoles(ilRbacReview::FILTER_ALL_GLOBAL);
     $se->setOptions($global_roles);
     $this->addItem($se);
     $ilCourseMultiSelectInputGUI = new ilContainerMultiSelectInputGUI('crs', $this->txt(self::F_ASSIGNED_COURSES), self::F_ASSIGNED_COURSES);
     $ilCourseMultiSelectInputGUI->setAjaxLink($this->ctrl->getLinkTarget($this->parent_gui, ilUserSettingsGUI::CMD_SEARCH_COURSES));
     $this->addItem($ilCourseMultiSelectInputGUI);
     $ilCourseMultiSelectInputGUI = new ilContainerMultiSelectInputGUI('grp', $this->txt(self::F_ASSIGNED_GROUPS), self::F_ASSIGNED_GROUPS);
     $ilCourseMultiSelectInputGUI->setAjaxLink($this->ctrl->getLinkTarget($this->parent_gui, ilUserSettingsGUI::CMD_SEARCH_COURSES));
     $this->addItem($ilCourseMultiSelectInputGUI);
     $se = new ilSelectInputGUI($this->txt(self::F_PORTFOLIO_TEMPLATE_ID), self::F_PORTFOLIO_TEMPLATE_ID);
     $options = ilObjPortfolioTemplate::getAvailablePortfolioTemplates();
     //		$options[0] = $this->pl->txt('crs_no_template');
     $options[1] = '--';
     asort($options);
     $se->setOptions($options);
     $this->addItem($se);
     $te = new ilTextInputGUI($this->txt(self::F_PORTFOLIO_NAME), self::F_PORTFOLIO_NAME);
     $te->setInfo(ilUserSetting::getAvailablePlaceholdersAsString());
     //		$te->setRequired(true);
     $this->addItem($te);
     $se = new ilSelectInputGUI($this->txt(self::F_SKIN), self::F_SKIN);
     $options = [];
     foreach (ilStyleDefinition::getAllSkinStyles() as $skin) {
         $options[$skin["id"]] = $skin["title"];
     }
     asort($options);
     $se->setOptions($options);
     $this->addItem($se);
     // $te = new ilTextInputGUI($this->txt(self::F_SKIN), self::F_SKIN);
     // $this->addItem($te);
     $te = new ilTextInputGUI($this->txt(self::F_BLOG_NAME), self::F_BLOG_NAME);
     $this->addItem($te);
     $ilCourseMultiSelectInputGUI = new ilContainerMultiSelectInputGUI('grp', $this->txt(self::F_PORTFOLIO_ASSIGNED_TO_GROUPS), self::F_PORTFOLIO_ASSIGNED_TO_GROUPS);
     $ilCourseMultiSelectInputGUI->setAjaxLink($this->ctrl->getLinkTarget($this->parent_gui, ilUserSettingsGUI::CMD_SEARCH_COURSES));
     $this->addItem($ilCourseMultiSelectInputGUI);
     $ilOrgUnitMultiSelectInputGUI = new ilContainerMultiSelectInputGUI('orgu', $this->txt(self::F_ASSIGNED_ORGUS), self::F_ASSIGNED_ORGUS);
     $ilOrgUnitMultiSelectInputGUI->setAjaxLink($this->ctrl->getLinkTarget($this->parent_gui, ilUserSettingsGUI::CMD_SEARCH_COURSES));
     $this->addItem($ilOrgUnitMultiSelectInputGUI);
     include_once "Services/User/classes/class.ilUserUtil.php";
     $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));
     }
     $this->addItem($si);
     // starting point: repository object
     $repobj = new ilRadioOption($this->lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ);
     $repobj_id = new ilTextInputGUI($this->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($this->lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id));
             }
         }
     }
     $repobj->addSubItem($repobj_id);
     $si->addOption($repobj);
     if ($this->pl->is51()) {
         $ilStudyProgramMultiSelectInputGUI = new ilContainerMultiSelectInputGUI('prg', $this->txt(self::F_ASSIGNED_STUDYPROGRAMS), self::F_ASSIGNED_STUDYPROGRAMS);
         $ilStudyProgramMultiSelectInputGUI->setAjaxLink($this->ctrl->getLinkTarget($this->parent_gui, ilUserSettingsGUI::CMD_SEARCH_COURSES));
         $this->addItem($ilStudyProgramMultiSelectInputGUI);
     }
     $this->addCommandButtons();
 }