/** * 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'; $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'glo', $this->glossary->getId(), 'term', $this->term->getId()); $this->record_gui->setPropertyForm($form); $this->record_gui->setSelectedOnly(true); $this->record_gui->parse(); $form->addCommandButton("updateTerm", $this->lng->txt("save")); return $form; }
/** * Add taxonomy selector to MD (quick edit) form * * @param ilPropertyFormGUI $a_form */ public function addToMDForm(ilPropertyFormGUI $a_form) { $tax_ids = $this->getSelectableTaxonomies(); if (is_array($tax_ids)) { include_once "Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php"; foreach ($tax_ids as $tax_id) { // get existing assignments $node_ids = array(); $ta = $this->initTaxNodeAssignment($tax_id); foreach ($ta->getAssignmentsOfItem($this->md_obj_id) as $ass) { $node_ids[] = $ass["node_id"]; } $tax_sel = new ilTaxSelectInputGUI($tax_id, "md_tax_" . $tax_id, true); $tax_sel->setValue($node_ids); $a_form->addItem($tax_sel); } } }
public function build(ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $availableTaxonomyIds) { $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI)); $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form')); $this->setId('tstRndQuestSetCfgPoolForm'); $this->addCommandButton($this->getSaveCommand(), $this->lng->txt('save_and_back')); if (null !== $this->getSaveAndNewCommand()) { $this->addCommandButton($this->getSaveAndNewCommand(), $this->lng->txt('tst_save_and_create_new_rule')); } $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SHOW_SRC_POOL_DEF_LIST, $this->lng->txt('cancel')); $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id'); $hiddenDefId->setValue($sourcePool->getId()); $this->addItem($hiddenDefId); $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id'); $hiddenPoolId->setValue($sourcePool->getPoolId()); $this->addItem($hiddenPoolId); $nonEditablePoolLabel = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_label'), 'quest_pool_label'); $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng)); $this->addItem($nonEditablePoolLabel); if (count($availableTaxonomyIds)) { $taxRadio = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax'); $taxRadio->setRequired(true); $taxRadio->addOption(new ilRadioOption($this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0)); $taxRadio->setValue(0); require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php'; foreach ($availableTaxonomyIds as $taxId) { $taxonomy = new ilObjTaxonomy($taxId); $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle()); $taxRadioOption = new ilRadioOption($label, $taxId); $taxRadio->addOption($taxRadioOption); $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_{$taxId}", false); $taxSelect->setRequired(true); $taxRadioOption->addSubItem($taxSelect); if ($taxId == $sourcePool->getOriginalFilterTaxId()) { $taxRadio->setValue($sourcePool->getOriginalFilterTaxId()); $taxSelect->setValue($sourcePool->getOriginalFilterTaxNodeId()); } } $this->addItem($taxRadio); } else { $hiddenNoTax = new ilHiddenInputGUI('filter_tax'); $hiddenNoTax->setValue(0); $this->addItem($hiddenNoTax); $nonEditableNoTax = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'no_tax_label'); $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint')); $this->addItem($nonEditableNoTax); } if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) { $questionAmountPerSourcePool = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_source_pool'), 'question_amount_per_pool'); $questionAmountPerSourcePool->setRequired(true); $questionAmountPerSourcePool->allowDecimals(false); $questionAmountPerSourcePool->setMinValue(0); $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true); $questionAmountPerSourcePool->setSize(4); if ($sourcePool->getQuestionAmount()) { $questionAmountPerSourcePool->setValue($sourcePool->getQuestionAmount()); } $this->addItem($questionAmountPerSourcePool); } }