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')); $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); } }
private function getQuestionIdsForSourcePoolDefinitionIds(ilTestRandomQuestionSetSourcePoolDefinition $definition) { $this->stagingPoolQuestionList->resetQuestionList(); $this->stagingPoolQuestionList->setTestObjId($this->testOBJ->getId()); $this->stagingPoolQuestionList->setTestId($this->testOBJ->getTestId()); $this->stagingPoolQuestionList->setPoolId($definition->getPoolId()); if ($this->hasTaxonomyFilter($definition)) { $this->stagingPoolQuestionList->addTaxonomyFilter($definition->getMappedFilterTaxId(), array($definition->getMappedFilterTaxNodeId())); } $this->stagingPoolQuestionList->loadQuestions(); return $this->stagingPoolQuestionList->getQuestions(); }