private function saveEditSourcePoolDefinitionFormCmd() { $this->questionSetConfig->loadFromDb(); $defId = $this->fetchSingleSourcePoolDefinitionIdParameter(); $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId); $availableTaxonomyIds = ilObjTaxonomy::getUsageOfObject($sourcePoolDefinition->getPoolId()); $form = $this->buildEditSourcePoolDefinitionFormGUI(); $form->build($sourcePoolDefinition, $availableTaxonomyIds); $errors = !$form->checkInput(); // ALWAYS CALL BEFORE setValuesByPost() $form->setValuesByPost(); // NEVER CALL THIS BEFORE checkInput() if ($errors) { return $this->showSourcePoolDefinitionListCmd($form); } $form->applySubmit($sourcePoolDefinition, $availableTaxonomyIds); $sourcePoolDefinition->saveToDb(); $this->sourcePoolDefinitionList->loadDefinitions(); $this->stagingPool->rebuild($this->sourcePoolDefinitionList); $this->questionSetConfig->setLastQuestionSyncTimestamp(time()); $this->questionSetConfig->saveToDb(); $this->sourcePoolDefinitionList->saveDefinitions(); $this->testOBJ->saveCompleteStatus($this->questionSetConfig); ilUtil::sendSuccess($this->lng->txt("tst_msg_random_question_set_config_modified"), true); $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST); }
public function save() { $this->questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired($this->getItemByPostVar('quest_points_equal_per_pool')->getChecked()); switch ($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()) { case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST: $this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()); $this->questionSetConfig->setQuestionAmountPerTest($this->getItemByPostVar('quest_amount_per_test')->getValue()); break; case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL: $this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()); $this->questionSetConfig->setQuestionAmountPerTest(null); break; } return $this->questionSetConfig->saveToDb($this->testOBJ->getTestId()); }