public function addToForm()
 {
     global $lng;
     $adt = $this->getADT();
     $default = false;
     if ($adt->isNull()) {
         // see ilPersonalProfileGUI::addLocationToForm()
         // use installation default
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $def = ilMapUtil::getDefaultSettings();
         $adt->setLatitude($def["latitude"]);
         $adt->setLongitude($def["longitude"]);
         $adt->setZoom($def["zoom"]);
         $default = true;
     }
     $optional = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl"));
     if (!$default && !$adt->isNull()) {
         $optional->setChecked(true);
     }
     $loc = new ilLocationInputGUI($lng->txt("location"), $this->getElementId());
     $loc->setLongitude($adt->getLongitude());
     $loc->setLatitude($adt->getLatitude());
     $loc->setZoom($adt->getZoom());
     $optional->addSubItem($loc);
     $rad = new ilNumberInputGUI($lng->txt("form_location_radius"), $this->addToElementId("rad"));
     $rad->setSize(4);
     $rad->setSuffix($lng->txt("form_location_radius_km"));
     $rad->setValue($this->radius);
     $rad->setRequired(true);
     $optional->addSubItem($rad);
     $this->addToParentElement($optional);
 }
 protected function addFieldsToEditForm(ilPropertyFormGUI $a_form)
 {
     // orientation
     $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
     $orientation->setRequired(false);
     $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0));
     $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1));
     $a_form->addItem($orientation);
     // minimum answers
     $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers");
     $minanswers->setValue(1);
     $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option"));
     $minanswers->setRequired(FALSE);
     $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers");
     $nranswers->setSize(5);
     $nranswers->setDecimals(0);
     $nranswers->setRequired(false);
     $nranswers->setMinValue(1);
     $minanswers->addSubItem($nranswers);
     $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers");
     $nrmaxanswers->setSize(5);
     $nrmaxanswers->setDecimals(0);
     $nrmaxanswers->setRequired(false);
     $nrmaxanswers->setMinValue(1);
     $minanswers->addSubItem($nrmaxanswers);
     $a_form->addItem($minanswers);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers");
     $answers->setRequired(false);
     $answers->setAllowMove(true);
     $answers->setShowWizard(false);
     $answers->setShowSavePhrase(false);
     $answers->setUseOtherAnswer(true);
     $answers->setShowNeutralCategory(true);
     $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer'));
     $answers->setDisabledScale(false);
     $a_form->addItem($answers);
     // values
     $orientation->setValue($this->object->getOrientation());
     $minanswers->setChecked($this->object->use_min_answers);
     $nranswers->setValue($this->object->nr_min_answers);
     $nrmaxanswers->setValue($this->object->nr_max_answers);
     if (!$this->object->getCategories()->getCategoryCount()) {
         $this->object->getCategories()->addCategory("");
     }
     $answers->setValues($this->object->getCategories());
 }
 public function addToForm()
 {
     global $lng;
     $adt = $this->getADT();
     $default = false;
     if ($adt->isNull()) {
         // see ilPersonalProfileGUI::addLocationToForm()
         // use installation default
         include_once "./Services/Maps/classes/class.ilMapUtil.php";
         $def = ilMapUtil::getDefaultSettings();
         $adt->setLatitude($def["latitude"]);
         $adt->setLongitude($def["longitude"]);
         $adt->setZoom($def["zoom"]);
         $default = true;
     }
     // :TODO: title?
     $title = $this->isRequired() ? $this->getTitle() : $lng->txt("location");
     $loc = new ilLocationInputGUI($title, $this->getElementId());
     $loc->setLongitude($adt->getLongitude());
     $loc->setLatitude($adt->getLatitude());
     $loc->setZoom($adt->getZoom());
     $this->addBasicFieldProperties($loc, $adt->getCopyOfDefinition());
     if (!$this->isRequired()) {
         $optional = new ilCheckboxInputGUI($this->getTitle(), $this->getElementId() . "_tgl");
         $optional->addSubItem($loc);
         $this->addToParentElement($optional);
         if (!$default && !$adt->isNull()) {
             $optional->setChecked(true);
         }
     } else {
         $this->addToParentElement($loc);
     }
 }
 public static function getGeneralSettingsForm()
 {
     global $lng;
     $form = new ilPropertyFormGUI();
     require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
     $channels = ilNotificationDatabaseHandler::getAvailableChannels(array(), true);
     $options = array('set_by_user' => $lng->txt('set_by_user'), 'set_by_admin' => $lng->txt('set_by_admin'));
     /**
      * @todo dirty...
      */
     $form->restored_values = array();
     $store_values = array();
     foreach ($channels as $channel) {
         $chb = new ilCheckboxInputGUI($lng->txt('enable_' . $channel['name']), 'enable_' . $channel['name']);
         $store_values[] = 'enable_' . $channel['name'];
         $select = new ilSelectInputGUI($lng->txt('config_type'), 'notifications[' . $channel['name'] . ']');
         $select->setOptions($options);
         $select->setValue($channel['config_type']);
         $chb->addSubItem($select);
         /**
          * @todo dirty...
          */
         $form->restored_values['notifications[' . $channel['name'] . ']'] = $channel['config_type'];
         require_once $channel['include'];
         // let the channel display their own settings below the "enable channel"
         // checkbox
         $result = call_user_func(array($channel['handler'], 'showSettings'), $chb);
         if ($result) {
             $store_values = array_merge($result, $store_values);
         }
         $form->addItem($chb);
     }
     /**
      * @todo dirty...
      */
     $form->store_values = $store_values;
     return $form;
 }
 /**
  * Init configuration form.
  *
  * @return object form object
  */
 public function initConfigurationForm()
 {
     /** @var ilCtrl $ilCtrl */
     global $lng, $ilCtrl;
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     foreach ($this->checkboxes as $key => $cb) {
         if (!is_array($cb)) {
             $checkbox = new ilCheckboxInputGUI($this->getPluginObject()->txt($cb), $cb);
             $this->form->addItem($checkbox);
         } else {
             $checkbox = new ilCheckboxInputGUI($this->getPluginObject()->txt($key), $key);
             foreach ($cb as $field => $gui) {
                 $sub = new $gui($this->getPluginObject()->txt($key . '_' . $field), $key . '_' . $field);
                 $checkbox->addSubItem($sub);
             }
             $this->form->addItem($checkbox);
         }
     }
     $this->form->addCommandButton('save', $lng->txt('save'));
     $this->form->setTitle($this->getPluginObject()->txt('configuration'));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     return $this->form;
 }
 /**
  * Edit news settings.
  */
 public function editSettings()
 {
     global $ilCtrl, $lng, $ilSetting;
     $news_set = new ilSetting("news");
     $feed_set = new ilSetting("feed");
     $enable_internal_news = $ilSetting->get("block_activated_news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     $rss_title_format = $news_set->get("rss_title_format");
     $enable_private_feed = $news_set->get("enable_private_feed");
     $news_default_visibility = $news_set->get("default_visibility") != "" ? $news_set->get("default_visibility") : "users";
     $disable_repository_feeds = $feed_set->get("disable_rep_feeds");
     $nr_personal_desktop_feeds = $ilSetting->get("block_limit_pdfeed");
     $allow_shorter_periods = $news_set->get("allow_shorter_periods");
     $allow_longer_periods = $news_set->get("allow_longer_periods");
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $rss_period = ilNewsItem::_lookupRSSPeriod();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("news_settings"));
     // Enable internal news
     $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_news"), "enable_internal_news");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("news_enable_internal_news_info"));
     $cb_prop->setChecked($enable_internal_news);
     $form->addItem($cb_prop);
     // Default Visibility
     $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "news_default_visibility");
     $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
     $radio_group->addOption($radio_option);
     $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
     $radio_group->addOption($radio_option);
     $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
     $radio_group->setRequired(false);
     $radio_group->setValue($news_default_visibility);
     $form->addItem($radio_group);
     // Number of news items per object
     $nr_opts = array(50 => 50, 100 => 100, 200 => 200);
     $nr_sel = new ilSelectInputGUI($lng->txt("news_nr_of_items"), "news_max_items");
     $nr_sel->setInfo($lng->txt("news_nr_of_items_info"));
     $nr_sel->setOptions($nr_opts);
     $nr_sel->setValue($news_set->get("max_items"));
     $form->addItem($nr_sel);
     // Access Cache
     $min_opts = array(0 => 0, 1 => 1, 2 => 2, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 60 => 60);
     $min_sel = new ilSelectInputGUI($lng->txt("news_cache"), "news_acc_cache_mins");
     $min_sel->setInfo($lng->txt("news_cache_info"));
     $min_sel->setOptions($min_opts);
     $min_sel->setValue($news_set->get("acc_cache_mins"));
     $form->addItem($min_sel);
     // PD News Period
     $per_opts = array(2 => "2 " . $lng->txt("days"), 3 => "3 " . $lng->txt("days"), 5 => "5 " . $lng->txt("days"), 7 => "1 " . $lng->txt("week"), 14 => "2 " . $lng->txt("weeks"), 30 => "1 " . $lng->txt("month"), 60 => "2 " . $lng->txt("months"), 120 => "4 " . $lng->txt("months"), 180 => "6 " . $lng->txt("months"), 366 => "1 " . $lng->txt("year"));
     $per_sel = new ilSelectInputGUI($lng->txt("news_pd_period"), "news_pd_period");
     $per_sel->setInfo($lng->txt("news_pd_period_info"));
     $per_sel->setOptions($per_opts);
     $per_sel->setValue((int) ilNewsItem::_lookupDefaultPDPeriod());
     $form->addItem($per_sel);
     // Allow user to choose lower values
     $sp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_shorter_periods"), "allow_shorter_periods");
     $sp_prop->setValue("1");
     $sp_prop->setInfo($lng->txt("news_allow_shorter_periods_info"));
     $sp_prop->setChecked($allow_shorter_periods);
     $form->addItem($sp_prop);
     // Allow user to choose higher values
     $lp_prop = new ilCheckboxInputGUI($lng->txt("news_allow_longer_periods"), "allow_longer_periods");
     $lp_prop->setValue("1");
     $lp_prop->setInfo($lng->txt("news_allow_longer_periods_info"));
     $lp_prop->setChecked($allow_longer_periods);
     $form->addItem($lp_prop);
     // Enable rss for internal news
     $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_internal_rss"), "enable_internal_rss");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("news_enable_internal_rss_info"));
     $cb_prop->setChecked($enable_internal_rss);
     // RSS News Period
     $rssp_opts = array(2 => "2 " . $lng->txt("days"), 3 => "3 " . $lng->txt("days"), 5 => "5 " . $lng->txt("days"), 7 => "1 " . $lng->txt("week"), 14 => "2 " . $lng->txt("weeks"), 30 => "1 " . $lng->txt("month"), 60 => "2 " . $lng->txt("months"), 120 => "4 " . $lng->txt("months"), 180 => "6 " . $lng->txt("months"), 365 => "1 " . $lng->txt("year"));
     $rssp_sel = new ilSelectInputGUI($lng->txt("news_rss_period"), "news_rss_period");
     $rssp_sel->setOptions($rssp_opts);
     $rssp_sel->setValue((int) $rss_period);
     $cb_prop->addSubItem($rssp_sel);
     // Section Header: RSS
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("news_rss"));
     $form->addItem($sh);
     // title format for rss entries
     $options = array("" => $lng->txt("news_rss_title_format_obj_news"), "news_obj" => $lng->txt("news_rss_title_format_news_obj"));
     $si = new ilSelectInputGUI($lng->txt("news_rss_title_format"), "rss_title_format");
     $si->setOptions($options);
     $si->setValue($rss_title_format);
     $cb_prop->addSubItem($si);
     $form->addItem($cb_prop);
     // Enable private news feed
     $cb_prop = new ilCheckboxInputGUI($lng->txt("news_enable_private_feed"), "enable_private_feed");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("news_enable_private_feed_info"));
     $cb_prop->setChecked($enable_private_feed);
     $form->addItem($cb_prop);
     // Section Header: External Web Feeds Settings
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("feed_settings"));
     $form->addItem($sh);
     // Number of External Feeds on personal desktop
     $sel = new ilSelectInputGUI($lng->txt("feed_nr_pd_feeds"), "nr_pd_feeds");
     $sel->setInfo($lng->txt("feed_nr_pd_feeds_info"));
     $sel->setOptions(array(0 => "0", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5"));
     $sel->setValue($nr_personal_desktop_feeds);
     $form->addItem($sel);
     // Disable External Web Feeds in catetegories
     $cb_prop = new ilCheckboxInputGUI($lng->txt("feed_disable_rep_feeds"), "disable_repository_feeds");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("feed_disable_rep_feeds_info"));
     $cb_prop->setChecked($disable_repository_feeds);
     $form->addItem($cb_prop);
     // command buttons
     $form->addCommandButton("saveSettings", $lng->txt("save"));
     $form->addCommandButton("view", $lng->txt("cancel"));
     $this->tpl->setContent($form->getHTML());
 }
 /**
  * Init client db form.
  */
 public function initClientDbForm($a_install = true, $dbupdate = null, $db_status = false, $hotfix_available = false, $custom_updates_available = false)
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // type
     $ne = new ilNonEditableValueGUI($lng->txt("db_type"), "db_type");
     $this->form->addItem($ne);
     // version
     if ($this->setup->getClient()->getDBType() == "mysql" || $this->setup->getClient()->getDBType() == "innodb") {
         $ne = new ilNonEditableValueGUI($lng->txt("version"), "db_version");
         $ilDB = $this->setup->getClient()->db;
         $ne->setValue($ilDB->getDBVersion());
         $this->form->addItem($ne);
     }
     // host
     $ne = new ilNonEditableValueGUI($lng->txt("host"), "db_host");
     $this->form->addItem($ne);
     // name
     $ne = new ilNonEditableValueGUI($lng->txt("name"), "db_name");
     $this->form->addItem($ne);
     // user
     $ne = new ilNonEditableValueGUI($lng->txt("user"), "db_user");
     $this->form->addItem($ne);
     // port
     $ne = new ilNonEditableValueGUI($lng->txt("port"), "db_port");
     $this->form->addItem($ne);
     // creation / collation for mysql
     if (($this->setup->getClient()->getDBType() == "mysql" || $this->setup->getClient()->getDBType() == "innodb") && $a_install) {
         // create database
         $cb = new ilCheckboxInputGUI($lng->txt("database_create"), "chk_db_create");
         // collation
         $collations = array("utf8_unicode_ci", "utf8_general_ci", "utf8_czech_ci", "utf8_danish_ci", "utf8_estonian_ci", "utf8_icelandic_ci", "utf8_latvian_ci", "utf8_lithuanian_ci", "utf8_persian_ci", "utf8_polish_ci", "utf8_roman_ci", "utf8_romanian_ci", "utf8_slovak_ci", "utf8_slovenian_ci", "utf8_spanish2_ci", "utf8_spanish_ci", "utf8_swedish_ci", "utf8_turkish_ci");
         foreach ($collations as $collation) {
             $options[$collation] = $collation;
         }
         $si = new ilSelectInputGUI($lng->txt("collation"), "collation");
         $si->setOptions($options);
         $si->setInfo($this->lng->txt("info_text_db_collation2") . " " . "<a target=\"_new\" href=\"http://dev.mysql.com/doc/mysql/en/charset-unicode-sets.html\">" . " MySQL Reference Manual :: 10.11.1 Unicode Character Sets</a>");
         $cb->addSubItem($si);
         $this->form->addItem($cb);
     }
     if ($a_install) {
         $this->form->addCommandButton("installDatabase", $lng->txt("database_install"));
     } else {
         $ilDB = $this->setup->getClient()->db;
         $this->lng->setDbHandler($ilDB);
         $dbupdate = new ilDBUpdate($ilDB);
         // database version
         $ne = new ilNonEditableValueGUI($lng->txt("database_version"), "curv");
         $ne->setValue($dbupdate->currentVersion);
         $this->form->addItem($ne);
         // file version
         $ne = new ilNonEditableValueGUI($lng->txt("file_version"), "filev");
         $ne->setValue($dbupdate->fileVersion);
         $this->form->addItem($ne);
         if (!($db_status = $dbupdate->getDBVersionStatus())) {
             // next update step
             $options = array();
             for ($i = $dbupdate->currentVersion + 1; $i <= $dbupdate->fileVersion; $i++) {
                 $options[$i] = $i;
             }
             if (count($options) > 1) {
                 $si = new ilSelectInputGUI($lng->txt("next_update_break"), "update_break");
                 $si->setOptions($options);
                 $si->setInfo($lng->txt("next_update_break_info"));
                 $this->form->addItem($si);
             }
             if ($dbupdate->getRunningStatus() > 0) {
                 ilUtil::sendFailure($this->lng->txt("db_update_interrupted") . "<br /><br />" . $this->lng->txt("db_update_interrupted_avoid"));
             } else {
                 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
             }
             $this->form->addCommandButton("updateDatabase", $lng->txt("database_update"));
             $this->form->addCommandButton("showUpdateSteps", $lng->txt("show_update_steps"));
         } else {
             if ($hotfix_available) {
                 // hotfix current version
                 $ne = new ilNonEditableValueGUI($lng->txt("applied_hotfixes"), "curhf");
                 $ne->setValue($dbupdate->getHotfixCurrentVersion());
                 $this->form->addItem($ne);
                 // hotfix file version
                 $ne = new ilNonEditableValueGUI($lng->txt("available_hotfixes"), "filehf");
                 $ne->setValue($dbupdate->getHotfixFileVersion());
                 $this->form->addItem($ne);
                 $this->form->addCommandButton("applyHotfix", $lng->txt("apply_hotfixes"));
                 $this->form->addCommandButton("showHotfixSteps", $lng->txt("show_update_steps"));
                 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
             } elseif ($custom_updates_available) {
                 // custom updates current version
                 $ne = new ilNonEditableValueGUI($lng->txt("applied_custom_updates"), "curcu");
                 $ne->setValue($dbupdate->getCustomUpdatesCurrentVersion());
                 $this->form->addItem($ne);
                 // custom updates file version
                 $ne = new ilNonEditableValueGUI($lng->txt("available_custom_updates"), "filecu");
                 $ne->setValue($dbupdate->getCustomUpdatesFileVersion());
                 $this->form->addItem($ne);
                 $this->form->addCommandButton("applyCustomUpdates", $lng->txt("apply_custom_updates"));
                 ilUtil::sendInfo($this->lng->txt("database_needs_update"));
             } else {
                 if ($dbupdate->getHotfixFileVersion() > 0) {
                     // hotfix current version
                     $ne = new ilNonEditableValueGUI($lng->txt("applied_hotfixes"), "curhf");
                     $ne->setValue($dbupdate->getHotfixCurrentVersion());
                     $this->form->addItem($ne);
                     // hotfix file version
                     $ne = new ilNonEditableValueGUI($lng->txt("available_hotfixes"), "filehf");
                     $ne->setValue($dbupdate->getHotfixFileVersion());
                     $this->form->addItem($ne);
                 }
                 if ($dbupdate->getCustomUpdatesFileVersion() > 0) {
                     // custom updates current version
                     $ne = new ilNonEditableValueGUI($lng->txt("applied_custom_updates"), "curcu");
                     $ne->setValue($dbupdate->getCustomUpdatesCurrentVersion());
                     $this->form->addItem($ne);
                     // custom updates file version
                     $ne = new ilNonEditableValueGUI($lng->txt("available_custom_updates"), "filecu");
                     $ne->setValue($dbupdate->getCustomUpdatesFileVersion());
                     $this->form->addItem($ne);
                 }
                 ilUtil::sendSuccess($this->lng->txt("database_is_uptodate"));
             }
         }
     }
     $this->form->setTitle($lng->txt("database"));
     $this->form->setFormAction("setup.php?cmd=gateway");
 }
 /**
  * init form table 'substitutions'
  *
  * @access protected
  */
 protected function initFormSubstitutions()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (!($visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())) {
         return;
     }
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     #$this->form->setTableWidth('100%');
     // substitution
     foreach ($visible_records as $obj_type => $records) {
         $perm = null;
         // :TODO: hardwird ?
         if (in_array($obj_type, array("crs", "cat"))) {
             $perm = $this->getPermissions()->hasPermissions(ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION, $obj_type, array(ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS));
         }
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php';
         $sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type);
         // Show section
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($this->lng->txt('objs_' . $obj_type));
         $this->form->addItem($section);
         $check = new ilCheckboxInputGUI($this->lng->txt('description'), 'enabled_desc_' . $obj_type);
         $check->setValue(1);
         $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
         $check->setChecked($sub->isDescriptionEnabled() ? true : false);
         $this->form->addItem($check);
         if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION]) {
             $check->setDisabled(true);
         }
         $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'), 'enabled_field_names_' . $obj_type);
         $check->setValue(1);
         $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
         $check->setChecked($sub->enabledFieldNames() ? true : false);
         $this->form->addItem($check);
         if ($perm && !$perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES]) {
             $check->setDisabled(true);
         }
         #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
         #$area->setUseRte(true);
         #$area->setRteTagSet('standard');
         #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
         #$area->setRows(5);
         #$area->setCols(80);
         #$this->form->addItem($area);
         if ($perm) {
             $perm_pos = $perm[ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS];
         }
         $definitions = ilAdvancedMDFieldDefinition::getInstancesByObjType($obj_type);
         $definitions = $sub->sortDefinitions($definitions);
         $counter = 1;
         foreach ($definitions as $def) {
             $definition_id = $def->getFieldId();
             $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id);
             $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId());
             $title = $def->getTitle() . ' (' . $title . ')';
             $check = new ilCheckboxInputGUI($title, 'show[' . $obj_type . '][' . $definition_id . ']');
             $check->setValue(1);
             $check->setOptionTitle($this->lng->txt('md_adv_show'));
             $check->setChecked($sub->isSubstituted($definition_id));
             if ($perm && !$perm["show"]) {
                 $check->setDisabled(true);
             }
             $pos = new ilNumberInputGUI($this->lng->txt('position'), 'position[' . $obj_type . '][' . $definition_id . ']');
             $pos->setSize(3);
             $pos->setMaxLength(4);
             $pos->allowDecimals(true);
             $pos->setValue(sprintf('%.1f', $counter++));
             $check->addSubItem($pos);
             if ($perm && !$perm_pos) {
                 $pos->setDisabled(true);
             }
             $bold = new ilCheckboxInputGUI($this->lng->txt('bold'), 'bold[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->isBold($definition_id));
             $check->addSubItem($bold);
             if ($perm && !$perm["bold"]) {
                 $bold->setDisabled(true);
             }
             $bold = new ilCheckboxInputGUI($this->lng->txt('newline'), 'newline[' . $obj_type . '][' . $definition_id . ']');
             $bold->setValue(1);
             $bold->setChecked($sub->hasNewline($definition_id));
             $check->addSubItem($bold);
             if ($perm && !$perm["newline"]) {
                 $bold->setDisabled(true);
             }
             $this->form->addItem($check);
         }
         // placeholder
         /*
         $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
         $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
         foreach($records as $record)
         {
         	foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
         	{
         		$tpl->setCurrentBlock('field');
         		$tpl->setVariable('FIELD_NAME',$definition->getTitle());
         		$tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
         			'[/IF_F_'.$definition->getFieldId().']');
         		$tpl->parseCurrentBlock();
         	}
         	
         	$tpl->setCurrentBlock('record');
         	$tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
         	$tpl->setVariable('TITLE',$record->getTitle());
         	$tpl->parseCurrentBlock();
         }
         $custom->setHTML($tpl->get());
         $this->form->addItem($custom);
         */
     }
     $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
     $this->form->addCommandButton('updateSubstitutions', $this->lng->txt('save'));
     return true;
 }
 /**
  * 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);
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode
  */
 public function initForm($a_mode = "create")
 {
     global $ilCtrl, $ilErr, $lng;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $item = new ilTextInputGUI($lng->txt('title'), 'title');
     $item->setRequired(true);
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_visible'), 'is_visible');
     $this->form->addItem($item);
     $item = new ilTextAreaInputGUI($lng->txt('additional_info'), 'description');
     $item->setUseRte(true);
     //        $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
     $item->setRteTagSet('mini');
     $this->form->addItem($item);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($lng->txt('dcl_permissions_form'));
     $this->form->addItem($section);
     $item = new ilCustomInputGUI();
     $item->setHtml($lng->txt('dcl_table_info'));
     $item->setTitle($lng->txt('dcl_table_info_title'));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_add_perm'), 'add_perm');
     //		$item->setInfo($lng->txt("dcl_add_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_perm'), 'edit_perm');
     //		$item->setInfo($lng->txt("dcl_edit_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_delete_perm'), 'delete_perm');
     //		$item->setInfo($lng->txt("dcl_delete_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_edit_by_owner'), 'edit_by_owner');
     //		$item->setInfo($lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_export_enabled'), 'export_enabled');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($lng->txt('dcl_limited'), 'limited');
     $sitem1 = new ilDateTimeInputGUI($lng->txt('dcl_limit_start'), 'limit_start');
     $sitem2 = new ilDateTimeInputGUI($lng->txt('dcl_limit_end'), 'limit_end');
     //		$item->setInfo($lng->txt("dcl_limited_info"));
     $item->addSubItem($sitem1);
     $item->addSubItem($sitem2);
     $this->form->addItem($item);
     if ($a_mode == "edit") {
         $this->form->addCommandButton('update', $lng->txt('dcl_table_' . $a_mode));
     } else {
         $this->form->addCommandButton('save', $lng->txt('dcl_table_' . $a_mode));
     }
     $this->form->addCommandButton('cancel', $lng->txt('cancel'));
     $this->form->setFormAction($ilCtrl->getFormAction($this, $a_mode));
     if ($a_mode == "edit") {
         $this->form->setTitle($lng->txt('dcl_edit_table'));
     } else {
         $this->form->setTitle($lng->txt('dcl_new_table'));
     }
 }
Example #11
0
 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
 {
     global $lng;
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $a_form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('poll_activation_online_info') . $act_obj_info);
     $a_form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('poll_availability_until_info'));
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getAccessBegin();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getAccessEnd();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $a_form->addItem($act_type);
     // period/results
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('poll_voting_period_and_results'));
     $a_form->addItem($section);
     $prd = new ilCheckboxInputGUI($this->lng->txt('poll_voting_period_limited'), 'period');
     $vdur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "voting_period");
     $vdur->setShowTime(true);
     $date = $this->object->getVotingPeriodBegin();
     $vdur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $vdur->setStartText($this->lng->txt('poll_voting_period_start'));
     $date = $this->object->getVotingPeriodEnd();
     $vdur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $vdur->setEndText($this->lng->txt('poll_voting_period_end'));
     $prd->addSubItem($vdur);
     $a_form->addItem($prd);
     $results = new ilRadioGroupInputGUI($lng->txt("poll_view_results"), "results");
     $results->setRequired(true);
     $results->addOption(new ilRadioOption($lng->txt("poll_view_results_always"), ilObjPoll::VIEW_RESULTS_ALWAYS));
     $results->addOption(new ilRadioOption($lng->txt("poll_view_results_never"), ilObjPoll::VIEW_RESULTS_NEVER));
     $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_vote"), ilObjPoll::VIEW_RESULTS_AFTER_VOTE));
     $results->addOption(new ilRadioOption($lng->txt("poll_view_results_after_period"), ilObjPoll::VIEW_RESULTS_AFTER_PERIOD));
     $a_form->addItem($results);
     $show_result_as = new ilRadioGroupInputGUI($lng->txt("poll_show_results_as"), "show_results_as");
     $show_result_as->setRequired(true);
     $result_bar = new ilRadioOption($lng->txt("poll_barchart"), ilObjPoll::SHOW_RESULTS_AS_BARCHART);
     $show_result_as->addOption($result_bar);
     $show_result_as->addOption(new ilRadioOption($lng->txt("poll_piechart"), ilObjPoll::SHOW_RESULTS_AS_PIECHART));
     $a_form->addItem($show_result_as);
     $sort = new ilRadioGroupInputGUI($lng->txt("poll_result_sorting"), "sort");
     $sort->setRequired(true);
     $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_answers"), 0));
     $sort->addOption(new ilRadioOption($lng->txt("poll_result_sorting_votes"), 1));
     $a_form->addItem($sort);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('poll_comments'));
     $a_form->addItem($section);
     $comment = new ilCheckboxInputGUI($this->lng->txt('poll_comments'), 'comment');
     //$comment->setInfo($this->lng->txt('poll_comments_info'));
     $a_form->addItem($comment);
 }
 /**
  * Init setting form
  */
 function initSettingsForm()
 {
     global $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
     $ilTabs->clearTargets();
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     $public = ilBlockSetting::_lookup($this->getBlockType(), "public_notifications", 0, $this->block_id);
     $public_feed = ilBlockSetting::_lookup($this->getBlockType(), "public_feed", 0, $this->block_id);
     $hide_block = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_block", 0, $this->block_id);
     $hide_news_per_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_per_date", 0, $this->block_id);
     $hide_news_date = ilBlockSetting::_lookup($this->getBlockType(), "hide_news_date", 0, $this->block_id);
     if ($hide_news_date != "") {
         $hide_news_date = explode(" ", $hide_news_date);
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->settings_form = new ilPropertyFormGUI();
     $this->settings_form->setTitle($lng->txt("news_settings"));
     $this->settings_form->setTitleIcon(ilUtil::getImagePath("icon_news.png"));
     // hide news block for learners
     if ($this->getProperty("hide_news_block_option")) {
         $ch = new ilCheckboxInputGUI($lng->txt("news_hide_news_block"), "hide_news_block");
         $ch->setInfo($lng->txt("news_hide_news_block_info"));
         $ch->setChecked($hide_block);
         $this->settings_form->addItem($ch);
         $hnpd = new ilCheckboxInputGUI($lng->txt("news_hide_news_per_date"), "hide_news_per_date");
         $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
         $hnpd->setChecked($hide_news_per_date);
         $dt_prop = new ilDateTimeInputGUI($lng->txt("news_hide_news_date"), "hide_news_date");
         if ($hide_news_date != "") {
             $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
         }
         #$dt_prop->setDate($hide_news_date[0]);
         #$dt_prop->setTime($hide_news_date[1]);
         $dt_prop->setShowTime(true);
         //$dt_prop->setInfo($lng->txt("news_hide_news_date_info"));
         $hnpd->addSubItem($dt_prop);
         $this->settings_form->addItem($hnpd);
     }
     // default visibility
     if ($this->getProperty("default_visibility_option") && $enable_internal_rss) {
         $default_visibility = ilBlockSetting::_lookup($this->getBlockType(), "default_visibility", 0, $this->block_id);
         if ($default_visibility == "") {
             $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
         }
         // Default Visibility
         $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
         $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
         $radio_group->addOption($radio_option);
         $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
         $radio_group->addOption($radio_option);
         $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
         $radio_group->setRequired(false);
         $radio_group->setValue($default_visibility);
         $this->settings_form->addItem($radio_group);
     }
     // public notifications
     if ($this->getProperty("public_notifications_option") && $enable_internal_rss) {
         $ch = new ilCheckboxInputGUI($lng->txt("news_notifications_public"), "notifications_public");
         $ch->setInfo($lng->txt("news_notifications_public_info"));
         $ch->setChecked($public);
         $this->settings_form->addItem($ch);
     }
     // extra rss feed
     if ($enable_internal_rss) {
         $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "notifications_public_feed");
         $ch->setInfo($lng->txt("news_public_feed_info"));
         $ch->setChecked($public_feed);
         $this->settings_form->addItem($ch);
     }
     //$this->settings_form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed",
     //	"1", $public_feed, $lng->txt("news_public_feed_info"));
     //if ($this->getProperty("public_notifications_option"))
     //{
     //	$this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
     //		"1", $public, $lng->txt("news_notifications_public_info"));
     //}
     $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
     $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
     $this->settings_form->setFormAction($ilCtrl->getFormaction($this));
 }
 /**
  * Show Privacy settings
  *
  * @access public
  */
 public function showSecurity()
 {
     global $ilSetting, $ilUser, $rbacreview;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $security = ilSecuritySettings::_getInstance();
     $this->tabs_gui->setTabActive('show_security');
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('ps_security_protection'));
     // Form checkbox
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_auto_https'), 'auto_https_detect_enabled');
     $check->setOptionTitle($this->lng->txt('ps_auto_https_description'));
     $check->setChecked($security->isAutomaticHTTPSEnabled() ? 1 : 0);
     $check->setValue(1);
     $text = new ilTextInputGUI($this->lng->txt('ps_auto_https_header_name'), 'auto_https_detect_header_name');
     $text->setValue($security->getAutomaticHTTPSHeaderName());
     $text->setSize(24);
     $text->setMaxLength(64);
     $check->addSubItem($text);
     $text = new ilTextInputGUI($this->lng->txt('ps_auto_https_header_value'), 'auto_https_detect_header_value');
     $text->setValue($security->getAutomaticHTTPSHeaderValue());
     $text->setSize(24);
     $text->setMaxLength(64);
     $check->addSubItem($text);
     $form->addItem($check);
     $check2 = new ilCheckboxInputGUI($this->lng->txt('activate_https'), 'https_enabled');
     $check2->setChecked($security->isHTTPSEnabled() ? 1 : 0);
     $check2->setValue(1);
     $form->addItem($check2);
     $radio_group = new ilRadioGroupInputGUI($this->lng->txt('ps_account_security_mode'), 'account_security_mode');
     $radio_group->setValue($security->getAccountSecurityMode());
     $radio_opt = new ilRadioOption($this->lng->txt('ps_account_security_mode_default'), ilSecuritySettings::ACCOUNT_SECURITY_MODE_DEFAULT);
     $radio_group->addOption($radio_opt);
     $radio_opt = new ilRadioOption($this->lng->txt('ps_account_security_mode_customized'), ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled');
     $check->setChecked($security->isPasswordCharsAndNumbersEnabled() ? 1 : 0);
     //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled'));
     $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info'));
     $radio_opt->addSubItem($check);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled');
     $check->setChecked($security->isPasswordSpecialCharsEnabled() ? 1 : 0);
     //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled'));
     $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info'));
     $radio_opt->addSubItem($check);
     $text = new ilTextInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length');
     $text->setInfo($this->lng->txt('ps_password_min_length_info'));
     $text->setValue($security->getPasswordMinLength());
     $text->setSize(1);
     $text->setMaxLength(2);
     $radio_opt->addSubItem($text);
     $text = new ilTextInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length');
     $text->setInfo($this->lng->txt('ps_password_max_length_info'));
     $text->setValue($security->getPasswordMaxLength());
     $text->setSize(2);
     $text->setMaxLength(3);
     $radio_opt->addSubItem($text);
     $text = new ilTextInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age');
     $text->setInfo($this->lng->txt('ps_password_max_age_info'));
     $text->setValue($security->getPasswordMaxAge());
     $text->setSize(2);
     $text->setMaxLength(3);
     $radio_opt->addSubItem($text);
     $text = new ilTextInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts');
     $text->setInfo($this->lng->txt('ps_login_max_attempts_info'));
     $text->setValue($security->getLoginMaxAttempts());
     $text->setSize(1);
     $text->setMaxLength(2);
     $radio_opt->addSubItem($text);
     $radio_group->addOption($radio_opt);
     $form->addItem($radio_group);
     $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled');
     $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info'));
     $check->setChecked($security->isPasswordChangeOnFirstLoginEnabled() ? 1 : 0);
     $form->addItem($check);
     // file suffix replacement
     $ti = new ilTextInputGUI($this->lng->txt("file_suffix_repl"), "suffix_repl_additional");
     $ti->setMaxLength(200);
     $ti->setSize(40);
     $ti->setInfo($this->lng->txt("file_suffix_repl_info") . " " . SUFFIX_REPL_DEFAULT);
     $ti->setValue($ilSetting->get("suffix_repl_additional"));
     $form->addItem($ti);
     // prevent login from multiple pcs at the same time
     $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins');
     $objCb->setChecked((int) $security->isPreventionOfSimultaneousLoginsEnabled());
     $objCb->setValue(1);
     $objCb->setOptionTitle($this->lng->txt('ps_prevent_simultaneous_logins_info'));
     $form->addItem($objCb);
     // protected admin
     $admin = new ilCheckboxInputGUI($GLOBALS['lng']->txt('adm_adm_role_protect'), 'admin_role');
     $admin->setDisabled(!$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID));
     $admin->setInfo($GLOBALS['lng']->txt('adm_adm_role_protect_info'));
     $admin->setChecked((int) $security->isAdminRoleProtected());
     $admin->setValue(1);
     $form->addItem($admin);
     $form->addCommandButton('save_security', $this->lng->txt('save'));
     $this->tpl->setContent($form->getHTML());
 }
 /**
  * Parse search 
  *
  * @access private
  * @param
  * 
  */
 private function parseSearch()
 {
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     foreach (ilAdvancedMDRecord::_getActiveSearchableRecords() as $record) {
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($record->getTitle());
         $this->form->addItem($section);
         foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $field) {
             if (!$field->isSearchable()) {
                 continue;
             }
             switch ($field->getFieldType()) {
                 case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                     $group = new ilRadioGroupInputGUI('', 'boolean[' . $field->getFieldId() . ']');
                     $group->setValue(isset($this->search_values['boolean'][$field->getFieldId()]) ? $this->search_values['boolean'][$field->getFieldId()] : 0);
                     $radio_option = new ilRadioOption($this->lng->txt("search_any_word"), 0);
                     $radio_option->setValue(0);
                     $group->addOption($radio_option);
                     $radio_option = new ilRadioOption($this->lng->txt("search_all_words"), 1);
                     $radio_option->setValue(1);
                     $group->addOption($radio_option);
                     $text = new ilTextInputGUI($field->getTitle(), $field->getFieldId());
                     $text->setValue(isset($this->search_values[$field->getFieldId()]) ? $this->search_values[$field->getFieldId()] : '');
                     $text->setSize(30);
                     $text->setMaxLength(255);
                     $text->addSubItem($group);
                     $this->form->addItem($text);
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                     $select = new ilSelectInputGUI($field->getTitle(), $field->getFieldId());
                     $select->setValue(isset($this->search_values[$field->getFieldId()]) ? $this->search_values[$field->getFieldId()] : 0);
                     $options = array(0 => $this->lng->txt('search_any'));
                     $counter = 1;
                     foreach ($field->getFieldValues() as $key => $value) {
                         $options[$counter++] = $value;
                     }
                     $select->setOptions($options);
                     $this->form->addItem($select);
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                     $check = new ilCheckboxInputGUI($field->getTitle(), $field->getFieldId());
                     $check->setValue(1);
                     $check->setChecked(isset($this->search_values[$field->getFieldId()]) ? $this->search_values[$field->getFieldId()] : 0);
                     $time = new ilDateTimeInputGUI($this->lng->txt('from'), 'date_start[' . $field->getFieldId() . ']');
                     if ($field->getFieldType() == ilAdvancedMDFieldDefinition::TYPE_DATE) {
                         $time->setShowTime(false);
                     } else {
                         $time->setShowTime(true);
                     }
                     if (isset($this->search_values['date_start'][$field->getFieldId()]) and 0) {
                         #$time->setUnixTime($this->toUnixTime($this->search_values['date_start'][$field->getFieldId()]['date'],$this->search_values['date_start'][$field->getFieldId()]['time']));
                     } else {
                         $time->setDate(new ilDateTime(mktime(8, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     }
                     $check->addSubItem($time);
                     $time = new ilDateTimeInputGUI($this->lng->txt('until'), 'date_end[' . $field->getFieldId() . ']');
                     if ($field->getFieldType() == ilAdvancedMDFieldDefinition::TYPE_DATE) {
                         $time->setShowTime(false);
                     } else {
                         $time->setShowTime(true);
                     }
                     if (isset($this->search_values['date_end'][$field->getFieldId()]) and 0) {
                         #$time->setUnixTime($this->toUnixTime($this->search_values['date_end'][$field->getFieldId()]['date'],$this->search_values['date_end'][$field->getFieldId()]['time']));
                     } else {
                         $time->setDate(new ilDateTime(mktime(16, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     }
                     $check->addSubItem($time);
                     $this->form->addItem($check);
                     break;
             }
         }
     }
 }
 /**
  * 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));
 }
 private function initHTTPSForm()
 {
     global $ilCtrl, $lng;
     $this->setServerInfoSubTabs('adm_https');
     $lng->loadLanguageModule('ps');
     include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
     $security = ilSecuritySettings::_getInstance();
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTitle($lng->txt("adm_https"));
     $form->setFormAction($ilCtrl->getFormAction($this, 'saveHTTPS'));
     $check = new ilCheckboxInputGUI($lng->txt('ps_auto_https'), 'auto_https_detect_enabled');
     $check->setOptionTitle($lng->txt('ps_auto_https_description'));
     $check->setChecked($security->isAutomaticHTTPSEnabled() ? 1 : 0);
     $check->setValue(1);
     $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_name'), 'auto_https_detect_header_name');
     $text->setValue($security->getAutomaticHTTPSHeaderName());
     $text->setSize(24);
     $text->setMaxLength(64);
     $text->setRequired(true);
     $check->addSubItem($text);
     $text = new ilTextInputGUI($lng->txt('ps_auto_https_header_value'), 'auto_https_detect_header_value');
     $text->setValue($security->getAutomaticHTTPSHeaderValue());
     $text->setSize(24);
     $text->setMaxLength(64);
     $text->setRequired(true);
     $check->addSubItem($text);
     $form->addItem($check);
     $check2 = new ilCheckboxInputGUI($lng->txt('activate_https'), 'https_enabled');
     $check2->setChecked($security->isHTTPSEnabled() ? 1 : 0);
     $check2->setValue(1);
     $form->addItem($check2);
     // save and cancel commands
     $form->addCommandButton('saveHTTPS', $lng->txt('save'));
     return $form;
 }
 /**
  * Init standard search form.
  */
 public function initStandardSearchForm($a_mode)
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->setOpenTag(false);
     $this->form->setCloseTag(false);
     // term combination
     $radg = new ilHiddenInputGUI('search_term_combination');
     $radg->setValue(ilSearchSettings::getInstance()->getDefaultOperator());
     $this->form->addItem($radg);
     if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
         if ($a_mode == self::SEARCH_FORM_STANDARD) {
             // search type
             $radg = new ilRadioGroupInputGUI($lng->txt("search_type"), "type");
             $radg->setValue($this->getType() == ilSearchBaseGUI::SEARCH_FAST ? ilSearchBaseGUI::SEARCH_FAST : ilSearchBaseGUI::SEARCH_DETAILS);
             $op1 = new ilRadioOption($lng->txt("search_fast_info"), ilSearchBaseGUI::SEARCH_FAST);
             $radg->addOption($op1);
             $op2 = new ilRadioOption($lng->txt("search_details_info"), ilSearchBaseGUI::SEARCH_DETAILS);
         } else {
             $op2 = new ilCheckboxInputGUI($this->lng->txt('search_filter_by_type'), 'item_filter_enabled');
             $op2->setValue(1);
             //				$op2->setChecked($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS);
         }
         $cbgr = new ilCheckboxGroupInputGUI('', 'filter_type');
         $cbgr->setUseValuesAsKeys(true);
         $details = $this->getDetails();
         $det = false;
         foreach (ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data) {
             $cb = new ilCheckboxOption($lng->txt($data['trans']), $type);
             if ($details[$type]) {
                 $det = true;
             }
             $cbgr->addOption($cb);
         }
         if ($a_mode == self::SEARCH_FORM_LUCENE) {
             if (ilSearchSettings::getInstance()->isLuceneMimeFilterEnabled()) {
                 $mimes = $this->getMimeDetails();
                 foreach (ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions() as $type => $data) {
                     $op3 = new ilCheckboxOption($this->lng->txt($data['trans']), $type);
                     if ($mimes[$type]) {
                         $det = true;
                     }
                     $cbgr->addOption($op3);
                 }
             }
         }
         $cbgr->setValue(array_merge((array) $details, (array) $mimes));
         $op2->addSubItem($cbgr);
         if ($a_mode != self::SEARCH_FORM_STANDARD && $det) {
             $op2->setChecked(true);
         }
         if ($a_mode == ilSearchBaseGUI::SEARCH_FORM_STANDARD) {
             $radg->addOption($op2);
             $this->form->addItem($radg);
         } else {
             $this->form->addItem($op2);
         }
     }
     $this->form->setFormAction($ilCtrl->getFormAction($this, 'performSearch'));
 }
 public function initEditForm()
 {
     global $lng;
     $form = parent::initEditForm();
     // Add File-Upload
     $in_file = new ilFileInputGUI($lng->txt("bibliography file"), "bibliographic_file");
     $in_file->setSuffixes(array("ris", "bib", "bibtex"));
     $in_file->setRequired(false);
     $cb_override = new ilCheckboxInputGUI($this->lng->txt("override_entries"), "override_entries");
     $cb_override->addSubItem($in_file);
     $form->addItem($cb_override);
     $form->setFormAction($this->ctrl->getFormAction($this, "save"));
     return $form;
 }
 private function addResultSettingsFormSection(ilPropertyFormGUI $form)
 {
     // HEADER: result settings
     $header_tr = new ilFormSectionHeaderGUI();
     $header_tr->setTitle($this->lng->txt('test_results'));
     $form->addItem($header_tr);
     // access to test results
     $resultsAccessEnabled = new ilCheckboxInputGUI($this->lng->txt('tst_results_access_enabled'), 'results_access_enabled');
     $resultsAccessEnabled->setInfo($this->lng->txt('tst_results_access_enabled_desc'));
     $resultsAccessEnabled->setChecked($this->testOBJ->isScoreReportingEnabled());
     $resultsAccessSetting = new ilRadioGroupInputGUI($this->lng->txt('tst_results_access_setting'), 'results_access_setting');
     $resultsAccessSetting->setRequired(true);
     $optAlways = new ilRadioOption($this->lng->txt('tst_results_access_always'), 2, '');
     $optAlways->setInfo($this->lng->txt('tst_results_access_always_desc'));
     $resultsAccessSetting->addOption($optAlways);
     $optFinished = $opt = new ilRadioOption($this->lng->txt('tst_results_access_finished'), 1, '');
     $optFinished->setInfo($this->lng->txt('tst_results_access_finished_desc'));
     $resultsAccessSetting->addOption($optFinished);
     $optionDate = new ilRadioOption($this->lng->txt('tst_results_access_date'), 3, '');
     $optionDate->setInfo($this->lng->txt('tst_results_access_date_desc'));
     // access date
     $reportingDate = new ilDateTimeInputGUI($this->lng->txt('tst_reporting_date'), 'reporting_date');
     $reportingDate->setShowTime(true);
     if (strlen($this->testOBJ->getReportingDate())) {
         $reportingDate->setDate(new ilDateTime($this->testOBJ->getReportingDate(), IL_CAL_TIMESTAMP));
     } else {
         $reportingDate->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $optionDate->addSubItem($reportingDate);
     $resultsAccessSetting->addOption($optionDate);
     $resultsAccessValue = $this->testOBJ->getScoreReporting();
     $resultsAccessSetting->setValue($resultsAccessValue > 0 && $resultsAccessValue < 4 ? $resultsAccessValue : 2);
     $resultsAccessEnabled->addSubItem($resultsAccessSetting);
     // show pass details
     $showPassDetails = new ilCheckboxInputGUI($this->lng->txt('tst_show_pass_details'), 'pass_details');
     $showPassDetails->setInfo($this->lng->txt('tst_show_pass_details_desc'));
     $showPassDetails->setChecked($this->testOBJ->getShowPassDetails());
     $resultsAccessEnabled->addSubItem($showPassDetails);
     $form->addItem($resultsAccessEnabled);
     // grading
     $chb_only_passed_failed = new ilCheckboxInputGUI($this->lng->txt('tst_results_grading_opt_show_status'), 'grading_status');
     $chb_only_passed_failed->setInfo($this->lng->txt('tst_results_grading_opt_show_status_desc'));
     $chb_only_passed_failed->setValue(1);
     $chb_only_passed_failed->setChecked($this->testOBJ->isShowGradingStatusEnabled());
     $form->addItem($chb_only_passed_failed);
     $chb_resulting_mark_only = new ilCheckboxInputGUI($this->lng->txt('tst_results_grading_opt_show_mark'), 'grading_mark');
     $chb_resulting_mark_only->setInfo($this->lng->txt('tst_results_grading_opt_show_mark_desc'));
     $chb_resulting_mark_only->setValue(1);
     $chb_resulting_mark_only->setChecked($this->testOBJ->isShowGradingMarkEnabled());
     $form->addItem($chb_resulting_mark_only);
 }
 /**
  * Edit personal desktop settings.
  */
 public function editSettings()
 {
     global $ilCtrl, $lng, $ilSetting;
     $pd_set = new ilSetting("pd");
     $enable_calendar = ilCalendarSettings::_getInstance()->isEnabled();
     #$enable_calendar = $ilSetting->get("enable_calendar");
     $enable_block_moving = $pd_set->get("enable_block_moving");
     $enable_active_users = $ilSetting->get("block_activated_pdusers");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("pd_settings"));
     // Enable calendar
     $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_calendar"), "enable_calendar");
     $cb_prop->setValue("1");
     //$cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
     $cb_prop->setChecked($enable_calendar);
     $form->addItem($cb_prop);
     // Enable bookmarks
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_bookmarks"), "enable_bookmarks");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_bookmarks") ? "0" : "1");
     $form->addItem($cb_prop);
     // Enable contacts
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_contacts"), "enable_contacts");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_contacts") ? "0" : "1");
     $cb_prop_requires_mail = new ilCheckboxInputGUI($lng->txt('pd_enable_contacts_requires_mail'), 'enable_contacts_require_mail');
     $cb_prop_requires_mail->setValue("1");
     $cb_prop_requires_mail->setChecked($ilSetting->get("disable_contacts_require_mail") ? "0" : "1");
     $cb_prop->addSubItem($cb_prop_requires_mail);
     $form->addItem($cb_prop);
     // Enable notes
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_notes"), "enable_notes");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_notes") ? "0" : "1");
     $form->addItem($cb_prop);
     // Enable notes
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_comments"), "enable_comments");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_comments") ? "0" : "1");
     $form->addItem($cb_prop);
     $comm_del_user = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_user"), "comm_del_user");
     $comm_del_user->setChecked($ilSetting->get("comments_del_user", 0));
     $cb_prop->addSubItem($comm_del_user);
     $comm_del_tutor = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_tutor"), "comm_del_tutor");
     $comm_del_tutor->setChecked($ilSetting->get("comments_del_tutor", 1));
     $cb_prop->addSubItem($comm_del_tutor);
     // Enable Chatviewer
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_chatviewer"), "block_activated_chatviewer");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("block_activated_chatviewer"));
     $form->addItem($cb_prop);
     // Enable block moving
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_block_moving"), "enable_block_moving");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
     $cb_prop->setChecked($enable_block_moving);
     $form->addItem($cb_prop);
     // Enable active users block
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_active_users"), "block_activated_pdusers");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($enable_active_users);
     // maximum inactivity time
     $ti_prop = new ilNumberInputGUI($lng->txt("pd_time_before_removal"), "time_removal");
     $ti_prop->setValue($pd_set->get("user_activity_time"));
     $ti_prop->setInfo($lng->txt("pd_time_before_removal_info"));
     $ti_prop->setMaxLength(3);
     $ti_prop->setSize(3);
     $cb_prop->addSubItem($ti_prop);
     // osi host
     // see http://www.onlinestatus.org
     $ti_prop = new ilTextInputGUI($lng->txt("pd_osi_host"), "osi_host");
     $ti_prop->setValue($pd_set->get("osi_host"));
     $ti_prop->setInfo($lng->txt("pd_osi_host_info") . ' <a href="http://www.onlinestatus.org" target="_blank">http://www.onlinestatus.org</a>');
     $cb_prop->addSubItem($ti_prop);
     $form->addItem($cb_prop);
     // Enable 'My Offers' (default personal items)
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_offers'), 'enable_my_offers');
     $cb_prop->setValue('1');
     $cb_prop->setInfo($lng->txt('pd_enable_my_offers_info'));
     $cb_prop->setChecked($ilSetting->get('disable_my_offers') ? '0' : '1');
     $form->addItem($cb_prop);
     // Enable 'My Memberships'
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_memberships'), 'enable_my_memberships');
     $cb_prop->setValue('1');
     $cb_prop->setInfo($lng->txt('pd_enable_my_memberships_info'));
     $cb_prop->setChecked($ilSetting->get('disable_my_memberships') ? '0' : '1');
     $form->addItem($cb_prop);
     if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
         // Default view of personal items
         $sb_prop = new ilSelectInputGUI($lng->txt('pd_personal_items_default_view'), 'personal_items_default_view');
         $sb_prop->setInfo($lng->txt('pd_personal_items_default_view_info'));
         $option = array();
         $option[0] = $lng->txt('pd_my_offers');
         $option[1] = $lng->txt('my_courses_groups');
         $sb_prop->setOptions($option);
         $sb_prop->setValue((int) $ilSetting->get('personal_items_default_view'));
         $form->addItem($sb_prop);
     }
     // command buttons
     $form->addCommandButton("saveSettings", $lng->txt("save"));
     $form->addCommandButton("view", $lng->txt("cancel"));
     $this->tpl->setContent($form->getHTML());
 }
 private function initForm()
 {
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'save'));
     $this->form_gui->setTitle($this->lng->txt('ldap_configure'));
     $active = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_enable'), 'active');
     $active->setValue(1);
     $this->form_gui->addItem($active);
     $ds = new ilCheckboxInputGUI($this->lng->txt('ldap_as_ds'), 'ds');
     $ds->setValue(1);
     $ds->setInfo($this->lng->txt('ldap_as_ds_info'));
     $this->form_gui->addItem($ds);
     $servername = new ilTextInputGUI($this->lng->txt('ldap_server_name'), 'server_name');
     $servername->setRequired(true);
     $servername->setInfo($this->lng->txt('ldap_server_name_info'));
     $servername->setSize(32);
     $servername->setMaxLength(32);
     $this->form_gui->addItem($servername);
     $serverurl = new ilTextInputGUI($this->lng->txt('ldap_server'), 'server_url');
     $serverurl->setRequired(true);
     $serverurl->setInfo($this->lng->txt('ldap_server_url_info'));
     $serverurl->setSize(64);
     $serverurl->setMaxLength(255);
     $this->form_gui->addItem($serverurl);
     $version = new ilSelectInputGUI($this->lng->txt('ldap_version'), 'version');
     $version->setOptions(array(2 => 2, 3 => 3));
     $version->setInfo($this->lng->txt('ldap_server_version_info'));
     $this->form_gui->addItem($version);
     $basedsn = new ilTextInputGUI($this->lng->txt('basedn'), 'base_dn');
     $basedsn->setRequired(true);
     $basedsn->setSize(64);
     $basedsn->setMaxLength(255);
     $this->form_gui->addItem($basedsn);
     $referrals = new ilCheckboxInputGUI($this->lng->txt('ldap_referrals'), 'referrals');
     $referrals->setValue(1);
     $referrals->setInfo($this->lng->txt('ldap_referrals_info'));
     $this->form_gui->addItem($referrals);
     $section_security = new ilFormSectionHeaderGUI();
     $section_security->setTitle($this->lng->txt('ldap_server_security_settings'));
     $this->form_gui->addItem($section_security);
     $tls = new ilCheckboxInputGUI($this->lng->txt('ldap_tls'), 'tls');
     $tls->setValue(1);
     $this->form_gui->addItem($tls);
     $binding = new ilRadioGroupInputGUI($this->lng->txt('ldap_server_binding'), 'binding_type');
     $anonymous = new ilRadioOption($this->lng->txt('ldap_bind_anonymous'), IL_LDAP_BIND_ANONYMOUS);
     $binding->addOption($anonymous);
     $user = new ilRadioOption($this->lng->txt('ldap_bind_user'), IL_LDAP_BIND_USER);
     $dn = new ilTextInputGUI($this->lng->txt('ldap_server_bind_dn'), 'bind_dn');
     $dn->setSize(64);
     $dn->setMaxLength(255);
     $user->addSubItem($dn);
     $pass = new ilPasswordInputGUI($this->lng->txt('ldap_server_bind_pass'), 'bind_pass');
     $pass->setSkipSyntaxCheck(true);
     $pass->setSize(12);
     $pass->setMaxLength(36);
     $user->addSubItem($pass);
     $binding->addOption($user);
     $this->form_gui->addItem($binding);
     $section_auth = new ilFormSectionHeaderGUI();
     $section_auth->setTitle($this->lng->txt('ldap_authentication_settings'));
     $this->form_gui->addItem($section_auth);
     $search_base = new ilTextInputGUI($this->lng->txt('ldap_user_dn'), 'search_base');
     $search_base->setInfo($this->lng->txt('ldap_search_base_info'));
     $search_base->setSize(64);
     $search_base->setMaxLength(255);
     $this->form_gui->addItem($search_base);
     $user_scope = new ilSelectInputGUI($this->lng->txt('ldap_user_scope'), 'user_scope');
     $user_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $user_scope->setInfo($this->lng->txt('ldap_user_scope_info'));
     $this->form_gui->addItem($user_scope);
     $user_attribute = new ilTextInputGUI($this->lng->txt('ldap_user_attribute'), 'user_attribute');
     $user_attribute->setSize(16);
     $user_attribute->setMaxLength(64);
     $user_attribute->setRequired(true);
     $this->form_gui->addItem($user_attribute);
     $filter = new ilTextInputGUI($this->lng->txt('ldap_search_filter'), 'filter');
     $filter->setInfo($this->lng->txt('ldap_filter_info'));
     $filter->setSize(64);
     $filter->setMaxLength(512);
     $this->form_gui->addItem($filter);
     $section_restrictions = new ilFormSectionHeaderGUI();
     $section_restrictions->setTitle($this->lng->txt('ldap_group_restrictions'));
     $this->form_gui->addItem($section_restrictions);
     $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_search_base'), 'group_dn');
     $group_dn->setInfo($this->lng->txt('ldap_group_dn_info'));
     $group_dn->setSize(64);
     $group_dn->setMaxLength(255);
     $this->form_gui->addItem($group_dn);
     $group_scope = new ilSelectInputGUI($this->lng->txt('ldap_group_scope'), 'group_scope');
     $group_scope->setOptions(array(IL_LDAP_SCOPE_ONE => $this->lng->txt('ldap_scope_one'), IL_LDAP_SCOPE_SUB => $this->lng->txt('ldap_scope_sub')));
     $group_scope->setInfo($this->lng->txt('ldap_group_scope_info'));
     $this->form_gui->addItem($group_scope);
     $group_filter = new ilTextInputGUI($this->lng->txt('ldap_group_filter'), 'group_filter');
     $group_filter->setInfo($this->lng->txt('ldap_group_filter_info'));
     $group_filter->setSize(64);
     $group_filter->setMaxLength(255);
     $this->form_gui->addItem($group_filter);
     $group_member = new ilTextInputGUI($this->lng->txt('ldap_group_member'), 'group_member');
     $group_member->setInfo($this->lng->txt('ldap_group_member_info'));
     $group_member->setSize(32);
     $group_member->setMaxLength(255);
     $this->form_gui->addItem($group_member);
     $group_member_isdn = new ilCheckboxInputGUI($this->lng->txt('ldap_memberisdn'), 'memberisdn');
     #$group_member_isdn->setInfo($this->lng->txt('ldap_group_member_info'));
     $this->form_gui->addItem($group_member_isdn);
     #$group_member->addSubItem($group_member_isdn);
     $group = new ilTextInputGUI($this->lng->txt('ldap_group_name'), 'group');
     $group->setInfo($this->lng->txt('ldap_group_name_info'));
     $group->setSize(32);
     $group->setMaxLength(255);
     $this->form_gui->addItem($group);
     $group_atrr = new ilTextInputGUI($this->lng->txt('ldap_group_attribute'), 'group_attribute');
     $group_atrr->setInfo($this->lng->txt('ldap_group_attribute_info'));
     $group_atrr->setSize(16);
     $group_atrr->setMaxLength(64);
     $this->form_gui->addItem($group_atrr);
     $group_optional = new ilCheckboxInputGUI($this->lng->txt('ldap_group_membership'), 'group_optional');
     $group_optional->setOptionTitle($this->lng->txt('ldap_group_member_optional'));
     $group_optional->setInfo($this->lng->txt('ldap_group_optional_info'));
     $group_optional->setValue(1);
     $group_user_filter = new ilTextInputGUI($this->lng->txt('ldap_group_user_filter'), 'group_user_filter');
     $group_user_filter->setSize(64);
     $group_user_filter->setMaxLength(255);
     $group_optional->addSubItem($group_user_filter);
     $this->form_gui->addItem($group_optional);
     $section_sync = new ilFormSectionHeaderGUI();
     $section_sync->setTitle($this->lng->txt('ldap_user_sync'));
     $this->form_gui->addItem($section_sync);
     $ci_gui = new ilCustomInputGUI($this->lng->txt('ldap_moment_sync'));
     $sync_on_login = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_login'), 'sync_on_login');
     $sync_on_login->setValue(1);
     $ci_gui->addSubItem($sync_on_login);
     $sync_per_cron = new ilCheckboxInputGUI($this->lng->txt('ldap_sync_cron'), 'sync_per_cron');
     $sync_per_cron->setValue(1);
     $ci_gui->addSubItem($sync_per_cron);
     $ci_gui->setInfo($this->lng->txt('ldap_user_sync_info'));
     $this->form_gui->addItem($ci_gui);
     $global_role = new ilSelectInputGUI($this->lng->txt('ldap_global_role_assignment'), 'global_role');
     $global_role->setOptions($this->prepareRoleSelect(false));
     $global_role->setInfo($this->lng->txt('ldap_global_role_info'));
     $this->form_gui->addItem($global_role);
     $migr = new ilCheckboxInputGUI($this->lng->txt('auth_ldap_migration'), 'migration');
     $migr->setInfo($this->lng->txt('auth_ldap_migration_info'));
     $migr->setValue(1);
     $this->form_gui->addItem($migr);
     include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php";
     ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_LDAP, $this->form_gui, ilAdministrationSettingsFormHandler::getSettingsGUIInstance("auth"));
     $this->form_gui->addCommandButton('save', $this->lng->txt('save'));
 }
Example #22
0
 public function showForm()
 {
     global $rbacsystem, $ilUser, $ilCtrl, $lng, $ilTabs;
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_new.html", "Services/Mail");
     $this->tpl->setTitle($this->lng->txt("mail"));
     $this->lng->loadLanguageModule("crs");
     if (ilMailFormCall::isRefererStored()) {
         $ilTabs->setBackTarget($lng->txt('back'), $ilCtrl->getLinkTarget($this, 'cancelMail'));
     }
     switch ($_GET["type"]) {
         case 'reply':
             if ($_SESSION['mail_id']) {
                 $_GET['mail_id'] = $_SESSION['mail_id'];
             }
             $mailData = $this->umail->getMail($_GET["mail_id"]);
             $mailData["m_subject"] = $this->umail->formatReplySubject();
             $mailData["m_message"] = $this->umail->formatReplyMessage();
             $mailData["m_message"] = $this->umail->prependSignature();
             // NO ATTACHMENTS FOR REPLIES
             $mailData["attachments"] = array();
             //$mailData["rcp_cc"] = $this->umail->formatReplyRecipientsForCC();
             $mailData["rcp_cc"] = '';
             $mailData["rcp_to"] = $this->umail->formatReplyRecipient();
             $_SESSION["mail_id"] = "";
             break;
         case 'search_res':
             $mailData = $this->umail->getSavedData();
             /*if($_SESSION["mail_search_results"])
             		{
             			$mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results"],$_SESSION["mail_search"]);
             		}
             		unset($_SESSION["mail_search"]);
             		unset($_SESSION["mail_search_results"]);*/
             if ($_SESSION["mail_search_results_to"]) {
                 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_to"], 'to');
             }
             if ($_SESSION["mail_search_results_cc"]) {
                 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_cc"], 'cc');
             }
             if ($_SESSION["mail_search_results_bcc"]) {
                 $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_bcc"], 'bc');
             }
             unset($_SESSION["mail_search_results_to"]);
             unset($_SESSION["mail_search_results_cc"]);
             unset($_SESSION["mail_search_results_bcc"]);
             break;
         case 'attach':
             $mailData = $this->umail->getSavedData();
             break;
         case 'draft':
             $_SESSION["draft"] = $_GET["mail_id"];
             $mailData = $this->umail->getMail($_GET["mail_id"]);
             break;
         case 'forward':
             $mailData = $this->umail->getMail($_GET["mail_id"]);
             $mailData["rcp_to"] = $mailData["rcp_cc"] = $mailData["rcp_bcc"] = '';
             $mailData["m_subject"] = $this->umail->formatForwardSubject();
             $mailData["m_message"] = $this->umail->prependSignature();
             if (count($mailData["attachments"])) {
                 if ($error = $this->mfile->adoptAttachments($mailData["attachments"], $_GET["mail_id"])) {
                     ilUtil::sendInfo($error);
                 }
             }
             break;
         case 'new':
             if ($_GET['rcp_to']) {
                 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
                 $mailData["rcp_to"] = ilUtil::securePlainString($_GET['rcp_to']);
             } else {
                 if ($_SESSION['rcp_to']) {
                     $mailData["rcp_to"] = $_SESSION['rcp_to'];
                 }
             }
             if ($_GET['rcp_cc']) {
                 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
                 $mailData["rcp_cc"] = ilUtil::securePlainString($_GET['rcp_cc']);
             } else {
                 if ($_SESSION['rcp_cc']) {
                     $mailData["rcp_cc"] = $_SESSION['rcp_cc'];
                 }
             }
             if ($_GET['rcp_bcc']) {
                 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
                 $mailData["rcp_bcc"] = ilUtil::securePlainString($_GET['rcp_bcc']);
             } else {
                 if ($_SESSION['rcp_bcc']) {
                     $mailData["rcp_bcc"] = $_SESSION['rcp_bcc'];
                 }
             }
             $mailData['m_message'] = '';
             if (strlen($sig = ilMailFormCall::getSignature())) {
                 $mailData['m_message'] = $sig;
                 $mailData['m_message'] .= chr(13) . chr(10) . chr(13) . chr(10);
             }
             $mailData['m_message'] .= $this->umail->appendSignature();
             $_SESSION['rcp_to'] = '';
             $_SESSION['rcp_cc'] = '';
             $_SESSION['rcp_bcc'] = '';
             break;
         case 'role':
             if (is_array($_POST['roles'])) {
                 // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
                 $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_POST['roles']));
             } elseif (is_array($_SESSION['mail_roles'])) {
                 $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_SESSION['mail_roles']));
             }
             $mailData['m_message'] = '';
             if (strlen($sig = ilMailFormCall::getSignature())) {
                 $mailData['m_message'] = $sig;
                 $mailData['m_message'] .= chr(13) . chr(10) . chr(13) . chr(10);
             }
             $mailData['m_message'] .= $_POST["additional_message_text"] . chr(13) . chr(10) . $this->umail->appendSignature();
             $_POST["additional_message_text"] = "";
             $_SESSION['mail_roles'] = "";
             break;
         case 'address':
             $mailData["rcp_to"] = urldecode($_GET["rcp"]);
             break;
         default:
             // GET DATA FROM POST
             $mailData = $_POST;
             // strip slashes
             foreach ($mailData as $key => $value) {
                 if (is_string($value)) {
                     // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
                     $mailData[$key] = ilUtil::securePlainString($value);
                 }
             }
             break;
     }
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setTitle($this->lng->txt('compose'));
     $form_gui->setOpenTag(false);
     $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage'));
     $this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients"));
     $this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses"));
     $this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups"));
     $this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists"));
     $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
     // RECIPIENT
     $inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to');
     $inp->setRequired(true);
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_to"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // CC
     $inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc');
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_cc"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // BCC
     $inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc');
     $inp->setSize(50);
     $inp->setValue($mailData["rcp_bcc"]);
     $inp->setDataSource($dsDataLink, ",");
     $inp->setMaxLength(null);
     $form_gui->addItem($inp);
     // SUBJECT
     $inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
     $inp->setSize(50);
     $inp->setRequired(true);
     $inp->setValue($mailData["m_subject"]);
     $form_gui->addItem($inp);
     // Attachments
     include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php';
     $att = new ilMailFormAttachmentPropertyGUI($this->lng->txt($mailData["attachments"] ? 'edit' : 'add'));
     if (is_array($mailData["attachments"]) && count($mailData["attachments"])) {
         foreach ($mailData["attachments"] as $data) {
             if (is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data)) {
                 $hidden = new ilHiddenInputGUI('attachments[]');
                 $form_gui->addItem($hidden);
                 $size = filesize($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data);
                 $label = $data . " [" . ilFormat::formatSize($size) . "]";
                 $att->addItem($label);
                 $hidden->setValue(urlencode($data));
             }
         }
     }
     $form_gui->addItem($att);
     // ONLY IF SYSTEM MAILS ARE ALLOWED
     if ($rbacsystem->checkAccess("system_message", $this->umail->getMailObjectReferenceId())) {
         $chb = new ilCheckboxInputGUI($this->lng->txt('type'), 'm_type[]');
         $chb->setOptionTitle($this->lng->txt('system_message'));
         $chb->setValue('system');
         $chb->setChecked(false);
         if (is_array($mailData["m_type"]) and in_array('system', $mailData["m_type"])) {
             $chb->setChecked(true);
         }
         $form_gui->addItem($chb);
     }
     // MESSAGE
     $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
     //$inp->setValue(htmlspecialchars($mailData["m_message"], false));
     $inp->setValue($mailData["m_message"]);
     $inp->setRequired(false);
     $inp->setCols(60);
     $inp->setRows(10);
     // PLACEHOLDERS
     $chb = new ilCheckboxInputGUI($this->lng->txt('activate_serial_letter_placeholders'), 'use_placeholders');
     $chb->setOptionTitle($this->lng->txt('activate_serial_letter_placeholders'));
     $chb->setValue(1);
     $chb->setChecked(false);
     $form_gui->addItem($inp);
     include_once 'Services/Mail/classes/class.ilMailFormPlaceholdersPropertyGUI.php';
     $prop = new ilMailFormPlaceholdersPropertyGUI();
     $chb->addSubItem($prop);
     if ($mailData['use_placeholders']) {
         $chb->setChecked(true);
     }
     $form_gui->addItem($chb);
     $form_gui->addCommandButton('sendMessage', $this->lng->txt('send_mail'));
     $form_gui->addCommandButton('saveDraft', $this->lng->txt('save_message'));
     if (ilMailFormCall::isRefererStored()) {
         $form_gui->addCommandButton('cancelMail', $this->lng->txt('cancel'));
     }
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
     $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
     $this->tpl->show();
 }
 /**
  * Init settings form
  */
 protected function initFormCSettings()
 {
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('settings'));
     // individual course allocation
     $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled');
     $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled());
     $form->addItem($check);
     // add default container
     $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat');
     $imp->setRequired(true);
     $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
     $tpl->setVariable('SIZE', 5);
     $tpl->setVariable('MAXLENGTH', 11);
     $tpl->setVariable('POST_VAR', 'default_cat');
     $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory();
     $tpl->setVariable('PROPERTY_VALUE', $default);
     if ($default) {
         include_once './Services/Tree/classes/class.ilPathGUI.php';
         $path = new ilPathGUI();
         $path->enableTextOnly(false);
         $path->enableHideLeaf(false);
         $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
     }
     $imp->setHtml($tpl->get());
     $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info'));
     $form->addItem($imp);
     // all in one category
     $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone');
     $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled());
     $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info'));
     $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat');
     $allinone_cat->setRequired(true);
     $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS');
     $tpl->setVariable('SIZE', 5);
     $tpl->setVariable('MAXLENGTH', 11);
     $tpl->setVariable('POST_VAR', 'allinone_cat');
     $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory();
     $tpl->setVariable('PROPERTY_VALUE', $cat);
     if ($cat) {
         include_once './Services/Tree/classes/class.ilPathGUI.php';
         $path = new ilPathGUI();
         $path->enableTextOnly(false);
         $path->enableHideLeaf(false);
         $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default));
     }
     $allinone_cat->setHtml($tpl->get());
     $allinone->addSubItem($allinone_cat);
     $form->addItem($allinone);
     // multiple attributes
     $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple');
     $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled());
     // attribute selection
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php';
     $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts');
     $attributes->setMulti(true);
     $attributes->setValue(ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getAttributeValues());
     $attributes->setRequired(true);
     $attributes->setOptions(ilECSMappingUtils::getCourseMappingFieldSelectOptions());
     $multiple->addSubItem($attributes);
     $form->addItem($multiple);
     // role mapping
     $rm = new ilFormSectionHeaderGUI();
     $rm->setTitle($this->lng->txt('ecs_role_mappings'));
     $form->addItem($rm);
     $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings();
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
     foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) {
         $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), $name);
         $role_map->setValue($mapping_defs[$name]);
         $role_map->setSize(32);
         $role_map->setMaxLength(64);
         $role_map->setRequired($info['required']);
         $form->addItem($role_map);
     }
     $form->addCommandButton('cUpdateSettings', $this->lng->txt('save'));
     $form->addCommandButton('cSettings', $this->lng->txt('cancel'));
     return $form;
 }
 public function getFormElement($a_query, $a_field_name)
 {
     include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
     $a_post_name = 'query[' . $a_field_name . ']';
     switch ($a_field_name) {
         case 'general_offline':
             $offline_options = array('0' => $this->lng->txt('search_any'), self::ONLINE_QUERY => $this->lng->txt('search_option_online'), self::OFFLINE_QUERY => $this->lng->txt('search_option_offline'));
             $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $offline->setOptions($offline_options);
             $offline->setValue($a_query['general_offline']);
             return $offline;
         case 'lom_content':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_content']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
             // General
         // General
         case 'lom_language':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_language']);
             $select->setOptions(ilMDUtilSelect::_getLanguageSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_keyword':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_keyword']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_coverage':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_coverage']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_structure':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_structure']);
             $select->setOptions(ilMDUtilSelect::_getStructureSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Lifecycle
         // Lifecycle
         case 'lom_status':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_status']);
             $select->setOptions(ilMDUtilSelect::_getStatusSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_version':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_version']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         case 'lom_contribute':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], 'query[' . 'lom_role' . ']');
             $select->setValue($a_query['lom_role']);
             $select->setOptions(ilMDUtilSelect::_getRoleSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
             $text->setValue($a_query['lom_role_entry']);
             $text->setSize(30);
             $text->setMaxLength(255);
             $select->addSubItem($text);
             return $select;
             // Technical
         // Technical
         case 'lom_format':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_format']);
             $select->setOptions(ilMDUtilSelect::_getFormatSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_operating_system':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_operating_system']);
             $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_browser':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_browser']);
             $select->setOptions(ilMDUtilSelect::_getBrowserSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Education
         // Education
         case 'lom_interactivity':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_interactivity']);
             $select->setOptions(ilMDUtilSelect::_getInteractivityTypeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_resource':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_resource']);
             $select->setOptions(ilMDUtilSelect::_getLearningResourceTypeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_level':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getInteractivityLevelSelect($a_query['lom_level_start'], 'query[' . 'lom_level_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getInteractivityLevelSelect($a_query['lom_level_end'], 'query[' . 'lom_level_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
         case 'lom_density':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getSemanticDensitySelect($a_query['lom_density_start'], 'query[' . 'lom_density_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getSemanticDensitySelect($a_query['lom_density_end'], 'query[' . 'lom_density_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
         case 'lom_user_role':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_user_role']);
             $select->setOptions(ilMDUtilSelect::_getIntendedEndUserRoleSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_context':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_context']);
             $select->setOptions(ilMDUtilSelect::_getContextSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_difficulty':
             $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
             $html = $this->getRangeSelect($this->lng->txt('from'), ilMDUtilSelect::_getDifficultySelect($a_query['lom_difficulty_start'], 'query[' . 'lom_difficulty_start' . ']', array(0 => $this->lng->txt('search_any'))), $this->lng->txt('until'), ilMDUtilSelect::_getDifficultySelect($a_query['lom_difficulty_end'], 'query[' . 'lom_difficulty_end' . ']', array(0 => $this->lng->txt('search_any'))));
             $range->setHTML($html);
             return $range;
             // Rights
         // Rights
         case 'lom_costs':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_costs']);
             $select->setOptions(ilMDUtilSelect::_getCostsSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_copyright':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_copyright']);
             $select->setOptions(ilMDUtilSelect::_getCopyrightAndOtherRestrictionsSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
             // Classification
         // Classification
         case 'lom_purpose':
             $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $select->setValue($a_query['lom_purpose']);
             $select->setOptions(ilMDUtilSelect::_getPurposeSelect('', $a_field_name, array(0 => $this->lng->txt('search_any')), true));
             return $select;
         case 'lom_taxon':
             $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
             $text->setSubmitFormOnEnter(true);
             $text->setValue($a_query['lom_taxon']);
             $text->setSize(30);
             $text->setMaxLength(255);
             return $text;
         default:
             if (substr($a_field_name, 0, 3) != 'adv') {
                 break;
             }
             // Advanced meta data
             $field_id = substr($a_field_name, 4);
             include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
             $field = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($field_id);
             switch ($field->getFieldType()) {
                 case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                     $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $text->setSubmitFormOnEnter(true);
                     $text->setValue($a_query[$a_field_name]);
                     $text->setSize(30);
                     $text->setMaxLength(255);
                     return $text;
                 case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                     $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $select->setValue($a_query[$a_field_name]);
                     $select->setOptions($field->getFieldValuesForSearch());
                     return $select;
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                     $check = new ilCheckboxInputGUI($this->active_fields[$a_field_name], $a_post_name);
                     $check->setValue(1);
                     $check->setChecked($a_query[$a_field_name]);
                     $time = new ilDateTimeInputGUI($this->lng->txt('from'), $a_field_name . '_start');
                     $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
                     $time->setDate(new ilDateTime(mktime(8, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     $check->addSubItem($time);
                     $time = new ilDateTimeInputGUI($this->lng->txt('until'), $a_field_name . '_end');
                     $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
                     $time->setDate(new ilDateTime(mktime(16, 0, 0, date('m'), date('d'), date('Y')), IL_CAL_UNIX));
                     $check->addSubItem($time);
                     return $check;
             }
     }
     return null;
 }
 private function buildForm()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save"));
     $form->setTableWidth("100%");
     $form->setId("test_properties");
     if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) {
         // general properties
         $header = new ilFormSectionHeaderGUI();
         $header->setTitle($this->lng->txt("tst_general_properties"));
         $form->addItem($header);
     }
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // anonymity
     $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity');
     if ($this->testOBJ->participantDataExist()) {
         $anonymity->setDisabled(true);
     }
     $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0);
     $anonymity->addOption($rb);
     $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1);
     $anonymity->addOption($rb);
     $anonymity->setValue((int) $this->testOBJ->getAnonymity());
     $form->addItem($anonymity);
     // test mode (question set type)
     $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type');
     $questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc"));
     $questSetType->addOption($questSetTypeFixed);
     $questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc"));
     $questSetType->addOption($questSetTypeRandom);
     $questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc"));
     $questSetType->addOption($questSetTypeContinues);
     $questSetType->setValue($this->testOBJ->getQuestionSetType());
     if ($this->testOBJ->participantDataExist()) {
         $questSetType->setDisabled(true);
     }
     $form->addItem($questSetType);
     // pool usage
     $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool");
     $pool_usage->setValue(1);
     $pool_usage->setChecked($this->testOBJ->getPoolUsage());
     $form->addItem($pool_usage);
     // enable_archiving
     $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving');
     $enable_archiving->setValue(1);
     $enable_archiving->setChecked($this->testOBJ->getEnableArchiving());
     $form->addItem($enable_archiving);
     // activation/availability  (no template support yet)
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->testOBJ->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setChecked($this->testOBJ->isOnline());
     $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info);
     $form->addItem($online);
     $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type');
     $act_type->setInfo($act_ref_info);
     $act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED);
     $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED);
     $opt->setInfo($this->lng->txt('tst_availability_limitless_info'));
     $act_type->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION);
     $opt->setInfo($this->lng->txt('tst_availability_until_info'));
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI("", "access_period");
     $dur->setShowTime(true);
     $date = $this->testOBJ->getActivationStartingTime();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->testOBJ->getActivationEndingTime();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $opt->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
     $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info'));
     $visible->setChecked($this->testOBJ->getActivationVisibility());
     $opt->addSubItem($visible);
     $act_type->addOption($opt);
     $form->addItem($act_type);
     if (!$this->settingsTemplate || $this->formShowBeginningEndingInformation($this->settingsTemplate->getSettings())) {
         // general properties
         $header = new ilFormSectionHeaderGUI();
         $header->setTitle($this->lng->txt("tst_beginning_ending_information"));
         $form->addItem($header);
     }
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction");
     $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
     $intro->setRteTagSet('full');
     $intro->setInfo($this->lng->txt('intro_desc'));
     // showinfo
     $showinfo = new ilCheckboxInputGUI('', "showinfo");
     $showinfo->setValue(1);
     $showinfo->setChecked($this->testOBJ->getShowInfo());
     $showinfo->setOptionTitle($this->lng->txt("showinfo"));
     $showinfo->setInfo($this->lng->txt("showinfo_desc"));
     $intro->addSubItem($showinfo);
     $form->addItem($intro);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement");
     $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
     $finalstatement->setRteTagSet('full');
     // show final statement
     $showfinal = new ilCheckboxInputGUI('', "showfinalstatement");
     $showfinal->setValue(1);
     $showfinal->setChecked($this->testOBJ->getShowFinalStatement());
     $showfinal->setOptionTitle($this->lng->txt("final_statement_show"));
     $showfinal->setInfo($this->lng->txt("final_statement_show_desc"));
     $finalstatement->addSubItem($showfinal);
     $form->addItem($finalstatement);
     // examview
     $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview');
     $enable_examview->setValue(1);
     $enable_examview->setChecked($this->testOBJ->getEnableExamview());
     $enable_examview->setInfo($this->lng->txt("enable_examview_desc"));
     $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html');
     $show_examview_html->setValue(1);
     $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml());
     $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html"));
     $show_examview_html->setInfo($this->lng->txt("show_examview_html_desc"));
     $enable_examview->addSubItem($show_examview_html);
     $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf');
     $show_examview_pdf->setValue(1);
     $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf());
     $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf"));
     $show_examview_pdf->setInfo($this->lng->txt("show_examview_pdf_desc"));
     $enable_examview->addSubItem($show_examview_pdf);
     $form->addItem($enable_examview);
     if (!$this->settingsTemplate || $this->formShowSessionSection($this->settingsTemplate->getSettings())) {
         // session properties
         $sessionheader = new ilFormSectionHeaderGUI();
         $sessionheader->setTitle($this->lng->txt("tst_session_settings"));
         $form->addItem($sessionheader);
     }
     // max. number of passes
     $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries");
     $nr_of_tries->setSize(3);
     $nr_of_tries->setValue($this->testOBJ->getNrOfTries());
     $nr_of_tries->setRequired(true);
     $nr_of_tries->setSuffix($this->lng->txt("0_unlimited"));
     $total = $this->testOBJ->evalTotalPersons();
     if ($total) {
         $nr_of_tries->setDisabled(true);
     }
     $form->addItem($nr_of_tries);
     // enable max. processing time
     $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time");
     $processing->setValue(1);
     //$processing->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) {
         $processing->setChecked(true);
     } else {
         $processing->setChecked($this->testOBJ->getEnableProcessingTime());
     }
     // max. processing time
     $processingtime = new ilDurationInputGUI('', 'processing_time');
     $ptime = $this->testOBJ->getProcessingTimeAsArray();
     $processingtime->setHours($ptime['hh']);
     $processingtime->setMinutes($ptime['mm']);
     $processingtime->setSeconds($ptime['ss']);
     $processingtime->setShowMonths(false);
     $processingtime->setShowDays(false);
     $processingtime->setShowHours(true);
     $processingtime->setShowMinutes(true);
     $processingtime->setShowSeconds(true);
     $processingtime->setInfo($this->lng->txt("tst_processing_time_desc"));
     $processing->addSubItem($processingtime);
     // reset max. processing time
     $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time");
     $resetprocessing->setValue(1);
     $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time"));
     $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime());
     $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc"));
     $processing->addSubItem($resetprocessing);
     $form->addItem($processing);
     // enable starting time
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time");
     $enablestartingtime->setValue(1);
     //$enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_starting_time')) {
         $enablestartingtime->setChecked(true);
     } else {
         $enablestartingtime->setChecked(strlen($this->testOBJ->getStartingTime()));
     }
     // starting time
     $startingtime = new ilDateTimeInputGUI('', 'starting_time');
     $startingtime->setShowDate(true);
     $startingtime->setShowTime(true);
     if (strlen($this->testOBJ->getStartingTime())) {
         $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP));
     } else {
         $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     if ($this->testOBJ->participantDataExist()) {
         $enablestartingtime->setDisabled(true);
         $startingtime->setDisabled(true);
     }
     // enable ending time
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time");
     $enableendingtime->setValue(1);
     //$enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_ending_time')) {
         $enableendingtime->setChecked(true);
     } else {
         $enableendingtime->setChecked(strlen($this->testOBJ->getEndingTime()));
     }
     // ending time
     $endingtime = new ilDateTimeInputGUI('', 'ending_time');
     $endingtime->setShowDate(true);
     $endingtime->setShowTime(true);
     if (strlen($this->testOBJ->getEndingTime())) {
         $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP));
     } else {
         $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // test password
     $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password");
     $password->setSize(20);
     $password->setValue($this->testOBJ->getPassword());
     $password->setInfo($this->lng->txt("tst_password_details"));
     $form->addItem($password);
     if (!$this->settingsTemplate || $this->formShowPresentationSection($this->settingsTemplate->getSettings())) {
         // sequence properties
         $seqheader = new ilFormSectionHeaderGUI();
         $seqheader->setTitle($this->lng->txt("tst_presentation_properties"));
         $form->addItem($seqheader);
     }
     // use previous answers
     $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers");
     $prevanswers->setValue(1);
     $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers());
     $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description"));
     $form->addItem($prevanswers);
     // force js
     $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs");
     $forcejs->setValue(1);
     $forcejs->setChecked($this->testOBJ->getForceJS());
     $forcejs->setOptionTitle($this->lng->txt("forcejs"));
     $forcejs->setInfo($this->lng->txt("forcejs_desc"));
     $form->addItem($forcejs);
     // question title output
     $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output");
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, ''));
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, ''));
     $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, ''));
     $title_output->setValue($this->testOBJ->getTitleOutput());
     $title_output->setInfo($this->lng->txt("tst_title_output_description"));
     $form->addItem($title_output);
     // 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_TEST);
         $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability());
         $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition());
         $char_selector->addFormProperties($form);
         $char_selector->setFormValues($form);
     }
     // Autosave
     $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave');
     $autosave_output->setValue(1);
     $autosave_output->setChecked($this->testOBJ->getAutosave());
     $autosave_output->setInfo($this->lng->txt('autosave_info'));
     $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival');
     $autosave_interval->setSize(10);
     $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000);
     $autosave_interval->setInfo($this->lng->txt('autosave_ival_info'));
     $autosave_output->addSubItem($autosave_interval);
     $form->addItem($autosave_output);
     if (!$this->settingsTemplate || $this->formShowSequenceSection($this->settingsTemplate->getSettings())) {
         // sequence properties
         $seqheader = new ilFormSectionHeaderGUI();
         $seqheader->setTitle($this->lng->txt("tst_sequence_properties"));
         $form->addItem($seqheader);
     }
     // postpone questions
     $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone");
     $postpone->setValue(1);
     $postpone->setChecked($this->testOBJ->getSequenceSettings());
     $postpone->setInfo($this->lng->txt("tst_postpone_description"));
     $form->addItem($postpone);
     // shuffle questions
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->testOBJ->getShuffleQuestions());
     $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description"));
     $form->addItem($shuffle);
     // show list of questions
     $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions");
     //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary"));
     $list_of_questions->setValue(1);
     $list_of_questions->setChecked($this->testOBJ->getListOfQuestions());
     $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description"));
     $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options");
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', ''));
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', ''));
     $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', ''));
     $values = array();
     if ($this->testOBJ->getListOfQuestionsStart()) {
         array_push($values, 'chb_list_of_questions_start');
     }
     if ($this->testOBJ->getListOfQuestionsEnd()) {
         array_push($values, 'chb_list_of_questions_end');
     }
     if ($this->testOBJ->getListOfQuestionsDescription()) {
         array_push($values, 'chb_list_of_questions_with_description');
     }
     $list_of_questions_options->setValue($values);
     $list_of_questions->addSubItem($list_of_questions_options);
     $form->addItem($list_of_questions);
     // show question marking
     $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker");
     $marking->setValue(1);
     $marking->setChecked($this->testOBJ->getShowMarker());
     $marking->setInfo($this->lng->txt("question_marking_description"));
     $form->addItem($marking);
     // show suspend test
     $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel");
     $cancel->setValue(1);
     $cancel->setChecked($this->testOBJ->getShowCancel());
     $cancel->setInfo($this->lng->txt("tst_show_cancel_description"));
     $form->addItem($cancel);
     if (!$this->settingsTemplate || $this->formShowNotificationSection($this->settingsTemplate->getSettings())) {
         // notifications
         $notifications = new ilFormSectionHeaderGUI();
         $notifications->setTitle($this->lng->txt("tst_mail_notification"));
         $form->addItem($notifications);
     }
     // mail notification
     $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification");
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, ''));
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, ''));
     $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, ''));
     $mailnotification->setValue($this->testOBJ->getMailNotification());
     $form->addItem($mailnotification);
     $mailnottype = new ilCheckboxInputGUI('', "mailnottype");
     $mailnottype->setValue(1);
     $mailnottype->setOptionTitle($this->lng->txt("mailnottype"));
     $mailnottype->setChecked($this->testOBJ->getMailNotificationType());
     $form->addItem($mailnottype);
     /* This options always active (?) */
     $highscore_head = new ilFormSectionHeaderGUI();
     $highscore_head->setTitle($this->lng->txt("tst_highscore_options"));
     $form->addItem($highscore_head);
     $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled");
     $highscore->setValue(1);
     $highscore->setChecked($this->testOBJ->getHighscoreEnabled());
     $highscore->setInfo($this->lng->txt("tst_highscore_description"));
     $form->addItem($highscore);
     $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon");
     $highscore_anon->setValue(1);
     $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon());
     $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description"));
     $highscore->addSubItem($highscore_anon);
     $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts");
     $highscore_achieved_ts->setValue(1);
     $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS());
     $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description"));
     $highscore->addSubItem($highscore_achieved_ts);
     $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score");
     $highscore_score->setValue(1);
     $highscore_score->setChecked($this->testOBJ->getHighscoreScore());
     $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description"));
     $highscore->addSubItem($highscore_score);
     $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage");
     $highscore_percentage->setValue(1);
     $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage());
     $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description"));
     $highscore->addSubItem($highscore_percentage);
     $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints");
     $highscore_hints->setValue(1);
     $highscore_hints->setChecked($this->testOBJ->getHighscoreHints());
     $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description"));
     $highscore->addSubItem($highscore_hints);
     $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime");
     $highscore_wtime->setValue(1);
     $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime());
     $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description"));
     $highscore->addSubItem($highscore_wtime);
     $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table");
     $highscore_own_table->setValue(1);
     $highscore_own_table->setChecked($this->testOBJ->getHighscoreOwnTable());
     $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description"));
     $highscore->addSubItem($highscore_own_table);
     $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table");
     $highscore_top_table->setValue(1);
     $highscore_top_table->setChecked($this->testOBJ->getHighscoreTopTable());
     $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description"));
     $highscore->addSubItem($highscore_top_table);
     $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num");
     $highscore_top_num->setSize(4);
     $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit"));
     $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum());
     $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description"));
     $highscore->addSubItem($highscore_top_num);
     if (!$this->settingsTemplate || $this->formShowTestExecutionSection($this->settingsTemplate->getSettings())) {
         $testExecution = new ilFormSectionHeaderGUI();
         $testExecution->setTitle($this->lng->txt("tst_test_execution"));
         $form->addItem($testExecution);
     }
     // kiosk mode
     $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk");
     $kiosk->setValue(1);
     $kiosk->setChecked($this->testOBJ->getKioskMode());
     $kiosk->setInfo($this->lng->txt("kiosk_description"));
     // kiosk mode options
     $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options");
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', ''));
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', ''));
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt('examid_in_kiosk'), 'examid_in_kiosk'));
     $values = array();
     if ($this->testOBJ->getShowKioskModeTitle()) {
         array_push($values, 'kiosk_title');
     }
     if ($this->testOBJ->getShowKioskModeParticipant()) {
         array_push($values, 'kiosk_participant');
     }
     if ($this->testOBJ->getExamidInKiosk()) {
         array_push($values, 'examid_in_kiosk');
     }
     $kiosktitle->setValue($values);
     $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc"));
     $kiosk->addSubItem($kiosktitle);
     $form->addItem($kiosk);
     $redirection_mode = $this->testOBJ->getRedirectionMode();
     $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled');
     $rm_enabled->setChecked($redirection_mode == '0' ? false : true);
     $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_mode');
     $always = new ilRadioOption($this->lng->txt('tst_results_access_always'), REDIRECT_ALWAYS);
     $radio_rm->addOption($always);
     $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK);
     $radio_rm->addOption($kiosk);
     $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS);
     $rm_enabled->addSubItem($radio_rm);
     $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url');
     $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl());
     $redirection_url->setRequired(true);
     $rm_enabled->addSubItem($redirection_url);
     $form->addItem($rm_enabled);
     // Sign submission
     $sign_submission = $this->testOBJ->getSignSubmission();
     $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission');
     $sign_submission_enabled->setChecked($sign_submission);
     $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info'));
     $form->addItem($sign_submission_enabled);
     if (!$this->settingsTemplate || $this->formShowParticipantSection($this->settingsTemplate->getSettings())) {
         // participants properties
         $restrictions = new ilFormSectionHeaderGUI();
         $restrictions->setTitle($this->lng->txt("tst_max_allowed_users"));
         $form->addItem($restrictions);
     }
     $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants");
     $fixedparticipants->setValue(1);
     $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants());
     $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants"));
     $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description"));
     $invited_users = $this->testOBJ->getInvitedUsers();
     if ($total && count($invited_users) == 0) {
         $fixedparticipants->setDisabled(true);
     }
     $form->addItem($fixedparticipants);
     // simultaneous users
     $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers");
     $simul->setSize(3);
     $simul->setValue($this->testOBJ->getAllowedUsers() ? $this->testOBJ->getAllowedUsers() : '');
     $form->addItem($simul);
     // idle time
     $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap");
     $idle->setSize(4);
     $idle->setSuffix($this->lng->txt("seconds"));
     $idle->setValue($this->testOBJ->getAllowedUsersTimeGap() ? $this->testOBJ->getAllowedUsersTimeGap() : '');
     $form->addItem($idle);
     // Edit ecs export settings
     include_once 'Modules/Test/classes/class.ilECSTestSettings.php';
     $ecs = new ilECSTestSettings($this->testOBJ);
     $ecs->addSettingsToForm($form, 'tst');
     // remove items when using template
     if ($this->settingsTemplate) {
         foreach ($this->settingsTemplate->getSettings() as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 /**
  * Init settings property form
  *
  * @access protected
  */
 protected function initFormSettings()
 {
     global $lng;
     $tags_set = new ilSetting("tags");
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('tagging_settings'));
     $form->addCommandButton('saveSettings', $this->lng->txt('save'));
     $form->addCommandButton('cancel', $this->lng->txt('cancel'));
     // enable tagging
     $cb_prop = new ilCheckboxInputGUI($lng->txt("tagging_enable_tagging"), "enable_tagging");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($tags_set->get("enable"));
     // enable all users info
     $cb_prop2 = new ilCheckboxInputGUI($lng->txt("tagging_enable_all_users"), "enable_all_users");
     $cb_prop2->setInfo($lng->txt("tagging_enable_all_users_info"));
     $cb_prop2->setChecked($tags_set->get("enable_all_users"));
     $cb_prop->addSubItem($cb_prop2);
     $form->addItem($cb_prop);
     include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php";
     ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_TAGGING, $form, $this);
     $this->tpl->setContent($form->getHTML());
 }
Example #27
0
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $md_section = $md_obj->getGeneral();
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(true);
     $title->setValue($md_section->getTitle());
     $form->addItem($title);
     $ids = $md_section->getDescriptionIds();
     if ($ids) {
         $desc_obj = $md_section->getDescription(array_pop($ids));
         $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
         $desc->setCols(50);
         $desc->setRows(4);
         $desc->setValue($desc_obj->getDescription());
         $form->addItem($desc);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     include_once "Services/Object/classes/class.ilObjectActivation.php";
     $this->lng->loadLanguageModule('rep');
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $form->addItem($section);
     // additional info only with multiple references
     $act_obj_info = $act_ref_info = "";
     if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) {
         $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
         $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
     }
     $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
     $online->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     // orientation
     $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
     $orientation->setRequired(false);
     $orientation->setValue($this->object->getOrientation());
     $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0));
     $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1));
     $form->addItem($orientation);
     // minimum answers
     $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers");
     $minanswers->setValue(1);
     $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option"));
     $minanswers->setChecked($this->object->use_min_answers);
     $minanswers->setRequired(FALSE);
     $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers");
     $nranswers->setSize(5);
     $nranswers->setDecimals(0);
     $nranswers->setRequired(false);
     $nranswers->setMinValue(1);
     $nranswers->setValue($this->object->nr_min_answers);
     $minanswers->addSubItem($nranswers);
     $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers");
     $nrmaxanswers->setSize(5);
     $nrmaxanswers->setDecimals(0);
     $nrmaxanswers->setRequired(false);
     $nrmaxanswers->setMinValue(1);
     $nrmaxanswers->setValue($this->object->nr_max_answers);
     $minanswers->addSubItem($nrmaxanswers);
     $form->addItem($minanswers);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers");
     $answers->setRequired(false);
     $answers->setAllowMove(true);
     $answers->setShowWizard(false);
     $answers->setShowSavePhrase(false);
     $answers->setUseOtherAnswer(true);
     $answers->setShowNeutralCategory(true);
     $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer'));
     if (!$this->object->getCategories()->getCategoryCount()) {
         $this->object->getCategories()->addCategory("");
     }
     $answers->setValues($this->object->getCategories());
     $answers->setDisabledScale(false);
     $form->addItem($answers);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand()) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($nranswers->getValue() > $answers->getCategoryCount()) {
             $nrmaxanswers->setAlert($this->lng->txt('err_minvalueganswers'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($nrmaxanswers->getValue() > 0 && ($nrmaxanswers->getValue() > $answers->getCategoryCount() || $nrmaxanswers->getValue() < $nranswers->getValue())) {
             $nrmaxanswers->setAlert($this->lng->txt('err_maxvaluegeminvalue'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 public function BillingMailObject()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
     $form_gui = new ilPropertyFormGUI();
     $form_gui->setFormAction($this->ctrl->getFormAction($this, 'savebillingmail'));
     $form_gui->setTitle($this->lng->txt('billing_mail'));
     // MESSAGE
     $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
     $inp->setValue(ilPaymentSettings::getMailBillingText());
     $inp->setRequired(false);
     $inp->setCols(60);
     $inp->setRows(10);
     // PLACEHOLDERS
     $chb = new ilCheckboxInputGUI($this->lng->txt('activate_placeholders'), 'use_placeholders');
     $chb->setOptionTitle($this->lng->txt('activate_placeholders'));
     $chb->setValue(1);
     $chb->setChecked(ilPaymentSettings::getMailUsePlaceholders());
     $form_gui->addItem($inp);
     include_once 'Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
     $prop = new ilBillingMailPlaceholdersPropertyGUI();
     $chb->addSubItem($prop);
     $chb->setChecked(true);
     $form_gui->addItem($chb);
     $form_gui->addCommandButton('saveBillingMail', $this->lng->txt('save'));
     $this->tpl->setVariable('FORM', $form_gui->getHTML());
     return true;
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode
  */
 public function initForm($a_mode = "create")
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $item->setRequired(true);
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_visible'), 'is_visible');
     $this->form->addItem($item);
     // Show default order field and direction only in edit mode, because table id is not yet given and there are no fields to select
     if ($a_mode != 'create') {
         $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field'), 'default_sort_field');
         $fields = $this->table->getVisibleFields();
         $options = array(0 => $this->lng->txt('dcl_please_select'));
         foreach ($fields as $field) {
             $options[$field->getId()] = $field->getTitle();
         }
         $item->setOptions($options);
         $this->form->addItem($item);
         $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field_order'), 'default_sort_field_order');
         $options = array('asc' => $this->lng->txt('dcl_asc'), 'desc' => $this->lng->txt('dcl_desc'));
         $item->setOptions($options);
         $this->form->addItem($item);
     }
     $item = new ilTextAreaInputGUI($this->lng->txt('additional_info'), 'description');
     $item->setUseRte(true);
     //        $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
     $item->setRteTagSet('mini');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_public_comments'), 'public_comments');
     $this->form->addItem($item);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('dcl_permissions_form'));
     $this->form->addItem($section);
     $item = new ilCustomInputGUI();
     $item->setHtml($this->lng->txt('dcl_table_info'));
     $item->setTitle($this->lng->txt('dcl_table_info_title'));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_add_perm'), 'add_perm');
     //		$item->setInfo($this->lng->txt("dcl_add_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_perm'), 'edit_perm');
     //		$item->setInfo($this->lng->txt("dcl_edit_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_delete_perm'), 'delete_perm');
     //		$item->setInfo($this->lng->txt("dcl_delete_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_by_owner'), 'edit_by_owner');
     //		$item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_view_own_records_perm'), 'view_own_records_perm');
     //		$item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_export_enabled'), 'export_enabled');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_limited'), 'limited');
     $sitem1 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_start'), 'limit_start');
     $sitem1->setShowTime(true);
     $sitem2 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_end'), 'limit_end');
     $sitem2->setShowTime(true);
     //		$item->setInfo($this->lng->txt("dcl_limited_info"));
     $item->addSubItem($sitem1);
     $item->addSubItem($sitem2);
     $this->form->addItem($item);
     if ($a_mode == "edit") {
         $this->form->addCommandButton('update', $this->lng->txt('dcl_table_' . $a_mode));
     } else {
         $this->form->addCommandButton('save', $this->lng->txt('dcl_table_' . $a_mode));
     }
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode));
     if ($a_mode == "edit") {
         $this->form->setTitle($this->lng->txt('dcl_edit_table'));
     } else {
         $this->form->setTitle($this->lng->txt('dcl_new_table'));
     }
 }