/**
  * build property form for extended category settings
  *
  * @access protected
  */
 protected function initExtendedSettings()
 {
     if (is_object($this->form)) {
         return true;
     }
     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('ext_cat_settings'));
     $this->form->addCommandButton('updateInfo', $this->lng->txt('save'));
     $this->form->addCommandButton('editInfo', $this->lng->txt('cancel'));
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'cat', $this->object->getId());
     $record_gui->setPropertyForm($this->form);
     $record_gui->parse();
     return true;
 }
 /**
  * Init settings form.
  *
  * @param        int        $a_mode        Edit Mode
  */
 public function initSettingsForm($a_mode = "edit")
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // title
     $title = new ilTextInputGUI($lng->txt("title"), "title");
     $title->setRequired(true);
     $this->form->addItem($title);
     // description
     $desc = new ilTextAreaInputGUI($lng->txt("desc"), "description");
     $this->form->addItem($desc);
     $lng->loadLanguageModule("rep");
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('rep_activation_availability'));
     $this->form->addItem($section);
     // online
     $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
     $online->setValue("y");
     $online->setInfo($lng->txt("glo_online_info"));
     $this->form->addItem($online);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('glo_content_settings'));
     $this->form->addItem($section);
     // glossary mode
     $glo_mode = new ilRadioGroupInputGUI($lng->txt("glo_mode"), "glo_mode");
     //$glo_mode->setInfo($lng->txt("glo_mode_desc"));
     $op1 = new ilRadioOption($lng->txt("glo_mode_normal"), "none", $lng->txt("glo_mode_normal_info"));
     $glo_mode->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("glo_mode_level"), "level", $lng->txt("glo_mode_level_info"));
     $glo_mode->addOption($op2);
     $op3 = new ilRadioOption($lng->txt("glo_mode_subtree"), "subtree", $lng->txt("glo_mode_subtree_info"));
     $glo_mode->addOption($op3);
     $this->form->addItem($glo_mode);
     // glossary mode
     /*$options = array(
     			"none"=>$this->lng->txt("glo_mode_normal"),
     			"level"=>$this->lng->txt("glo_mode_level"),
     			"subtree"=>$this->lng->txt("glo_mode_subtree")
     			);
     		$glo_mode = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode");
     		$glo_mode->setOptions($options);
     		$glo_mode->setInfo($lng->txt("glo_mode_desc"));
     		$this->form->addItem($glo_mode);*/
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('cont_presentation'));
     $this->form->addItem($section);
     // presentation mode
     $pres_mode = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode");
     $pres_mode->setValue("table");
     $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info"));
     // short text length
     $snl = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length");
     $snl->setMaxValue(3000);
     $snl->setMinValue(100);
     $snl->setMaxLength(4);
     $snl->setSize(4);
     $snl->setInfo($lng->txt("glo_text_snippet_length_info"));
     $snl->setValue(200);
     $op1->addSubItem($snl);
     $pres_mode->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info"));
     $pres_mode->addOption($op2);
     $this->form->addItem($pres_mode);
     // show taxonomy
     include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
     $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
     if (count($tax_ids) > 0) {
         $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
         $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
         $this->form->addItem($show_tax);
     }
     // downloads
     $down = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads");
     $down->setValue("y");
     $down->setInfo($lng->txt("cont_downloads_desc"));
     $this->form->addItem($down);
     if ($a_mode == "edit") {
         $title->setValue($this->object->getTitle());
         $desc->setValue($this->object->getDescription());
         $online->setChecked($this->object->getOnline());
         $glo_mode->setValue($this->object->getVirtualMode());
         $pres_mode->setValue($this->object->getPresentationMode());
         $snl->setValue($this->object->getSnippetLength());
         if (count($tax_ids) > 0) {
             $show_tax->setChecked($this->object->getShowTaxonomy());
         }
         $down->setChecked($this->object->isActiveDownloads());
     }
     // advanced metadata
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION, 'glo', $this->object->getId(), "term");
     $record_gui->setPropertyForm($this->form);
     $record_gui->parseRecordSelection($this->lng->txt("glo_add_term_properties"));
     // sort columns, if adv fields are given
     include_once "./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php";
     $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
     $cols = $adv_ap->getColumnOrder();
     if (count($cols) > 1) {
         include_once './Modules/Glossary/classes/class.ilGloAdvColSortInputGUI.php';
         $ti = new ilGloAdvColSortInputGUI($lng->txt("cont_col_ordering"), "field_order");
         $this->form->addItem($ti);
         $ti->setValue($cols);
     }
     // save and cancel commands
     $this->form->addCommandButton("saveProperties", $lng->txt("save"));
     $this->form->setTitle($lng->txt("cont_glo_properties"));
     $this->form->setFormAction($ilCtrl->getFormAction($this));
 }
 /**
  * Update Advanced Metadata
  */
 protected function updateAdvancedSettings()
 {
     if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this);
     }
     $form = $this->initAdvancedSettingsForm();
     $gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
     $gui->setPropertyForm($form);
     $gui->setSelectedOnly(true);
     $form->checkInput();
     $gui->parse();
     if ($gui->importEditFormPostValues()) {
         $gui->writeEditForm();
         ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
         $this->ctrl->redirect($this, 'editAdvancedSettings');
     } else {
         $this->tpl->setContent($form->getHTML());
     }
 }
 /**
  * 
  *
  * @access protected
  */
 protected function initAdvancedMetaDataForm()
 {
     if (is_object($this->form)) {
         return $this->form;
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'performAdvMDSearch'));
     $this->form->setTitle($this->lng->txt('adv_md_search_title'));
     $this->form->addCommandButton('performAdvMDSearch', $this->lng->txt('search'));
     #$this->form->setSubformMode('right');
     $content = new ilTextInputGUI($this->lng->txt('meta_title') . '/' . $this->lng->txt('meta_keyword') . '/' . $this->lng->txt('meta_description'), 'title');
     $content->setValue($this->options['title']);
     $content->setSize(30);
     $content->setMaxLength(255);
     //		$content->setSubformMode('right');
     $group = new ilRadioGroupInputGUI('', 'title_ao');
     $group->setValue($this->options['title_ao']);
     $radio_option = new ilRadioOption($this->lng->txt("search_any_word"), 0);
     $group->addOption($radio_option);
     $radio_option = new ilRadioOption($this->lng->txt("search_all_words"), 1);
     $group->addOption($radio_option);
     $content->addSubItem($group);
     $this->form->addItem($content);
     $type = new ilSelectInputGUI($this->lng->txt('type'), 'type');
     $options['adv_all'] = $this->lng->txt('search_any');
     foreach (ilAdvancedMDRecord::_getActivatedObjTypes() as $obj_type) {
         $options[$obj_type] = $this->lng->txt('objs_' . $obj_type);
     }
     $type->setOptions($options);
     $type->setValue($this->options['type']);
     $this->form->addItem($type);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_SEARCH);
     $record_gui->setPropertyForm($this->form);
     $record_gui->setSearchValues($this->options);
     $record_gui->parse();
 }
 /**
  * Init edit settings form
  *
  * @return ilPropertyFormGUI
  */
 protected function initEditForm()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('ecs_general_info'));
     $form->addCommandButton('update', $this->lng->txt('save'));
     $form->addCommandButton('edit', $this->lng->txt('cancel'));
     $text = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $text->setValue($this->object->getTitle());
     $text->setSize(40);
     $text->setMaxLength(128);
     $text->setDisabled(true);
     $form->addItem($text);
     $area = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $area->setValue($this->object->getDescription());
     $area->setRows(3);
     $area->setCols(80);
     $area->setDisabled(true);
     $form->addItem($area);
     $area = new ilTextAreaInputGUI($this->lng->txt('ecs_local_information'), 'local_info');
     $area->setValue($this->object->getLocalInformation());
     $area->setRows(3);
     $area->setCols(80);
     $form->addItem($area);
     $this->addCustomEditForm($form);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, $this->getType(), $this->object->getId());
     $record_gui->setPropertyForm($form);
     $record_gui->parse();
     return $form;
 }
 /**
  * Init Settings Form
  */
 function initSettingsForm($a_mode = "edit")
 {
     global $lng, $ilCtrl, $ilTabs, $ilSetting;
     $lng->loadLanguageModule("wiki");
     $ilTabs->activateTab("settings");
     include "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     // Title
     $tit = new ilTextInputGUI($lng->txt("title"), "title");
     $tit->setRequired(true);
     $this->form_gui->addItem($tit);
     // Short Title
     // The problem with the short title is, that it is per object
     // and can't be a substitute for a ref id in the permanent link
     /*		
     		$stit = new ilRegExpInputGUI($lng->txt("wiki_short_title"), "shorttitle");
     		$stit->setPattern("/^[^0-9][^ _\&]+$/");
     		$stit->setRequired(false);
     		$stit->setNoMatchMessage($lng->txt("wiki_msg_short_name_regexp")." & _");
     		$stit->setSize(20);
     		$stit->setMaxLength(20);
     		$stit->setInfo($lng->txt("wiki_short_title_desc2"));
     		$this->form_gui->addItem($stit);
     */
     // Description
     $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
     $this->form_gui->addItem($des);
     // Introduction
     $intro = new ilTextAreaInputGUI($lng->txt("wiki_introduction"), "intro");
     $intro->setCols(40);
     $intro->setRows(4);
     $this->form_gui->addItem($intro);
     // Start Page
     if ($a_mode == "edit") {
         $pages = ilWikiPage::getAllPages($this->object->getId());
         foreach ($pages as $p) {
             $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
         }
         $si = new ilSelectInputGUI($lng->txt("wiki_start_page"), "startpage_id");
         $si->setOptions($options);
         $this->form_gui->addItem($si);
     } else {
         $sp = new ilTextInputGUI($lng->txt("wiki_start_page"), "startpage");
         if ($a_mode == "edit") {
             $sp->setInfo($lng->txt("wiki_start_page_info"));
         }
         $sp->setMaxLength(200);
         $sp->setRequired(true);
         $this->form_gui->addItem($sp);
     }
     // Online
     $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
     $this->form_gui->addItem($online);
     // rating
     $lng->loadLanguageModule('rating');
     $rate = new ilCheckboxInputGUI($lng->txt('rating_activate_rating'), 'rating_overall');
     $rate->setInfo($lng->txt('rating_activate_rating_info'));
     $this->form_gui->addItem($rate);
     $rating = new ilCheckboxInputGUI($lng->txt("wiki_activate_rating"), "rating");
     $this->form_gui->addItem($rating);
     /* always active 
     		$side = new ilCheckboxInputGUI($lng->txt("wiki_activate_sideblock_rating"), "rating_side");
     		$rating->addSubItem($side);
     		*/
     $new = new ilCheckboxInputGUI($lng->txt("wiki_activate_new_page_rating"), "rating_new");
     $rating->addSubItem($new);
     $extended = new ilCheckboxInputGUI($lng->txt("wiki_activate_extended_rating"), "rating_ext");
     $rating->addSubItem($extended);
     // public comments
     if (!$ilSetting->get("disable_comments")) {
         $comments = new ilCheckboxInputGUI($lng->txt("wiki_public_comments"), "public_notes");
         $this->form_gui->addItem($comments);
     }
     // important pages
     //		$imp_pages = new ilCheckboxInputGUI($lng->txt("wiki_important_pages"), "imp_pages");
     //		$this->form_gui->addItem($imp_pages);
     // page toc
     $page_toc = new ilCheckboxInputGUI($lng->txt("wiki_page_toc"), "page_toc");
     $page_toc->setInfo($lng->txt("wiki_page_toc_info"));
     $this->form_gui->addItem($page_toc);
     if ($a_mode == "edit") {
         // advanced metadata
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
         $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION, 'wiki', $this->object->getId(), "wpg");
         $record_gui->setPropertyForm($this->form_gui);
         $record_gui->parseRecordSelection($this->lng->txt("wiki_add_page_properties"));
     }
     // :TODO: sorting
     // Form action and save button
     $this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_wiki.svg"));
     if ($a_mode != "create") {
         $this->form_gui->setTitle($lng->txt("wiki_settings"));
         $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
     } else {
         $this->form_gui->setTitle($lng->txt("wiki_new"));
         $this->form_gui->addCommandButton("save", $lng->txt("wiki_add"));
         $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
     }
     // set values
     if ($a_mode == "create") {
         $ilCtrl->setParameter($this, "new_type", "wiki");
     }
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
 }
 /**
  * Get edit term form
  *
  * @param
  * @return
  */
 function getEditTermForm()
 {
     global $ilTabs, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "updateTerm"));
     $form->setTitle($this->lng->txt("cont_edit_term"));
     $term = new ilTextInputGUI($this->lng->txt("cont_term"), "term");
     $term->setRequired(true);
     $term->setValue($this->term->getTerm());
     $form->addItem($term);
     $lang = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
     $lang->setRequired(true);
     $lang->setOptions(ilMDLanguageItem::_getLanguages());
     $lang->setValue($this->term->getLanguage());
     $form->addItem($lang);
     // taxonomy
     if ($this->glossary->getTaxonomyId() > 0) {
         include_once "./Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php";
         $tax_node_assign = new ilTaxSelectInputGUI($this->glossary->getTaxonomyId(), "tax_node", true);
         include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
         $ta = new ilTaxNodeAssignment("glo", $this->glossary->getId(), "term", $this->glossary->getTaxonomyId());
         $assgnmts = $ta->getAssignmentsOfItem($this->term->getId());
         $node_ids = array();
         foreach ($assgnmts as $a) {
             $node_ids[] = $a["node_id"];
         }
         $tax_node_assign->setValue($node_ids);
         $form->addItem($tax_node_assign);
     }
     // advanced metadata
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'glo', $this->glossary->getId(), 'term', $this->term->getId());
     $record_gui->setPropertyForm($form);
     $record_gui->setSelectedOnly(true);
     $record_gui->parse();
     $form->addCommandButton("updateTerm", $this->lng->txt("save"));
     return $form;
 }
 /**
  * init info editor
  *
  * @access public
  * @param
  * 
  */
 public function initInfoEditor()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
     $form->setMultipart(true);
     $form->setTitle($this->lng->txt('crs_general_info'));
     $form->addCommandButton('updateInfo', $this->lng->txt('save'));
     $form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'), 'important');
     $area->setValue($this->object->getImportantInformation());
     $area->setRows(6);
     $area->setCols(80);
     $form->addItem($area);
     $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'), 'syllabus');
     $area->setValue($this->object->getSyllabus());
     $area->setRows(6);
     $area->setCols(80);
     $form->addItem($area);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('crs_info_download'));
     $form->addItem($section);
     $file = new ilFileInputGUI($this->lng->txt('crs_file'), 'file');
     $file->enableFileNameSelection('file_name');
     $form->addItem($file);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('crs_contact'));
     $form->addItem($section);
     $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'), 'contact_name');
     $text->setValue($this->object->getContactName());
     $text->setSize(40);
     $text->setMaxLength(70);
     $form->addItem($text);
     $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'), 'contact_responsibility');
     $text->setValue($this->object->getContactResponsibility());
     $text->setSize(40);
     $text->setMaxLength(70);
     $form->addItem($text);
     $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'), 'contact_phone');
     $text->setValue($this->object->getContactPhone());
     $text->setSize(40);
     $text->setMaxLength(40);
     $form->addItem($text);
     $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'), 'contact_email');
     $text->setValue($this->object->getContactEmail());
     $text->setInfo($this->lng->txt('crs_contact_email_info'));
     $text->setSize(40);
     $text->setMaxLength(255);
     $form->addItem($text);
     $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'), 'contact_consultation');
     $area->setValue($this->object->getContactConsultation());
     $area->setRows(6);
     $area->setCols(80);
     $form->addItem($area);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'crs', $this->object->getId());
     $record_gui->setPropertyForm($form);
     $record_gui->parse();
     return $form;
 }