private function hasTaxonomyFilter(ilTestRandomQuestionSetSourcePoolDefinition $definition)
 {
     if (!(int) $definition->getMappedFilterTaxId()) {
         return false;
     }
     if (!(int) $definition->getMappedFilterTaxNodeId()) {
         return false;
     }
     return true;
 }
 private function fetchQuestionAmountParameter(ilTestRandomQuestionSetSourcePoolDefinition $definition)
 {
     return (int) $_POST['quest_amount'][$definition->getId()];
 }
 public function addDefinition(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition)
 {
     $this->sourcePoolDefinitions[$sourcePoolDefinition->getId()] = $sourcePoolDefinition;
 }
Exemplo n.º 4
0
 /**
  * build title by definition
  * @param ilTestRandomQuestionSetSourcePoolDefinition $def
  */
 protected static function buildQplTitleByDefinition(ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestTaxonomyFilterLabelTranslater $trans)
 {
     $title = $def->getPoolTitle();
     $tax_id = $def->getMappedFilterTaxId();
     if ($tax_id) {
         $title .= ' -> ' . $trans->getTaxonomyTreeLabel($tax_id);
     }
     $tax_node = $def->getMappedFilterTaxNodeId();
     if ($tax_node) {
         $title .= ' -> ' . $trans->getTaxonomyNodeLabel($tax_node);
     }
     return $title;
 }
 public function applySubmit(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $availableTaxonomyIds)
 {
     switch (true) {
         case $this->getItemByPostVar('source_pool_filter_tax') === null:
         case !in_array($this->getItemByPostVar('filter_tax')->getValue(), $availableTaxonomyIds):
             $sourcePoolDefinition->setOriginalFilterTaxId(null);
             $sourcePoolDefinition->setOriginalFilterTaxNodeId(null);
             break;
         default:
             $taxId = $this->getItemByPostVar('filter_tax')->getValue();
             $sourcePoolDefinition->setOriginalFilterTaxId($taxId);
             $sourcePoolDefinition->setOriginalFilterTaxNodeId($this->getItemByPostVar("filter_tax_{$taxId}")->getValue());
     }
     if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
         $sourcePoolDefinition->setQuestionAmount($this->getItemByPostVar('question_amount_per_pool')->getValue());
     }
 }