/**
  * @param $currentRequestCmd
  * @return bool
  */
 private function isQuestionAmountConfigPerPoolHintRequired($currentRequestCmd)
 {
     if ($currentRequestCmd != self::CMD_SHOW_GENERAL_CONFIG_FORM) {
         return false;
     }
     if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
         return false;
     }
     return true;
 }
 private function buildSourcePoolDefinitionListTableGUI()
 {
     require_once 'Modules/Test/classes/tables/class.ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI.php';
     $table = new ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI($this->ctrl, $this->lng, $this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
     if (!$this->testOBJ->participantDataExist()) {
         $table->setDefinitionEditModeEnabled(true);
     }
     $table->setQuestionAmountColumnEnabled($this->questionSetConfig->isQuestionAmountConfigurationModePerPool());
     require_once 'Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
     $translater = new ilTestTaxonomyFilterLabelTranslater($this->db);
     $translater->loadLabels($this->sourcePoolDefinitionList);
     $table->setTaxonomyFilterLabelTranslater($translater);
     $table->build();
     return $table;
 }
 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());
     }
 }
Exemple #4
0
 /**
  * Returns the number of questions in the test
  *
  * @return integer The number of questions
  * @access	public
  */
 function getQuestionCount()
 {
     $num = 0;
     if ($this->isRandomTest()) {
         global $tree, $ilDB, $ilPluginAdmin;
         $questionSetConfig = new ilTestRandomQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this);
         $questionSetConfig->loadFromDb();
         if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
             $sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList($ilDB, $this, new ilTestRandomQuestionSetSourcePoolDefinitionFactory($ilDB, $this));
             $sourcePoolDefinitionList->loadDefinitions();
             $num = $sourcePoolDefinitionList->getQuestionAmount();
         } else {
             $num = $questionSetConfig->getQuestionAmountPerTest();
         }
     } else {
         $num = count($this->questions);
     }
     return $num;
 }
 public static final function getInstance(ilDB $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
 {
     if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
         require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
         return new ilTestRandomQuestionSetBuilderWithAmountPerPool($db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList);
     }
     require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerTest.php';
     return new ilTestRandomQuestionSetBuilderWithAmountPerTest($db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList);
 }