Пример #1
0
 /**
  * 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));
 }
Пример #2
0
 /**
  * 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"));
 }