protected function populateTaxonomyFormSection(ilPropertyFormGUI $form) { if (count($this->getTaxonomyIds())) { $sectHeader = new ilFormSectionHeaderGUI(); $sectHeader->setTitle($this->lng->txt('qpl_qst_edit_form_taxonomy_section')); $form->addItem($sectHeader); require_once 'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php'; foreach ($this->getTaxonomyIds() as $taxonomyId) { $taxonomy = new ilObjTaxonomy($taxonomyId); $label = sprintf($this->lng->txt('qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle()); $postvar = "tax_node_assign_{$taxonomyId}"; $taxNodeAssign = new ilTaxAssignInputGUI($taxonomy->getId(), true, $label, $postvar); // TODO: determine tst/qpl when tax assigns become maintainable within tests $taxNodeAssign->setCurrentValues('qpl', $this->object->getObjId(), 'quest', $this->object->getId()); $form->addItem($taxNodeAssign); } } }
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); } }