public function build()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
     $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_general_form'));
     $this->setId('tstRndQuestSetCfgGeneralForm');
     $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SAVE_GENERAL_CONFIG_FORM, $this->lng->txt('save'));
     // Require Pools with Homogeneous Scored Questions
     $requirePoolsQuestionsHomoScored = new ilCheckboxInputGUI($this->lng->txt('tst_inp_all_quest_points_equal_per_pool'), 'quest_points_equal_per_pool');
     $requirePoolsQuestionsHomoScored->setInfo($this->lng->txt('tst_inp_all_quest_points_equal_per_pool_desc'));
     $requirePoolsQuestionsHomoScored->setChecked($this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired());
     $this->addItem($requirePoolsQuestionsHomoScored);
     // question amount config mode (per test / per pool)
     $questionAmountConfigMode = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_quest_amount_cfg_mode'), 'quest_amount_cfg_mode');
     $questionAmountConfigMode->setValue($this->fetchValidQuestionAmountConfigModeWithFallbackModePerTest($this->questionSetConfig));
     $questionAmountConfigModePerTest = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_test'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST);
     $questionAmountConfigMode->addOption($questionAmountConfigModePerTest);
     $questionAmountConfigModePerPool = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_pool'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL);
     $questionAmountConfigMode->addOption($questionAmountConfigModePerPool);
     $questionAmountConfigMode->setRequired(true);
     $this->addItem($questionAmountConfigMode);
     // question amount per test
     $questionAmountPerTest = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_test'), 'quest_amount_per_test');
     $questionAmountPerTest->setRequired(true);
     $questionAmountPerTest->setMinValue(0);
     $questionAmountPerTest->allowDecimals(false);
     $questionAmountPerTest->setMinvalueShouldBeGreater(true);
     $questionAmountPerTest->setSize(4);
     $questionAmountPerTest->setValue($this->questionSetConfig->getQuestionAmountPerTest());
     $questionAmountConfigModePerTest->addSubItem($questionAmountPerTest);
     if ($this->testOBJ->participantDataExist()) {
         $requirePoolsQuestionsHomoScored->setDisabled(true);
         $questionAmountConfigMode->setDisabled(true);
         $questionAmountPerTest->setDisabled(true);
     }
 }
Beispiel #2
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;
 }