/** * Save random test settings */ protected function saveRandom() { $this->ctrl->saveParameter($this, 'objective_id'); $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']); $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']); $this->test_type = (int) $_REQUEST['tt']; $form = $this->initFormRandom(); if ($form->checkInput()) { $qst = $this->__initQuestionObject((int) $_GET['objective_id']); $qst->deleteByTestType($this->test_type == ilLOSettings::TYPE_TEST_INITIAL ? ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT : ilCourseObjectiveQuestion::TYPE_FINAL_TEST); $ref_id = $this->getSettings()->getTestByType($this->test_type); include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php'; $rnd = new ilLORandomTestQuestionPools($this->course_obj->getId(), (int) $_REQUEST['objective_id'], $this->test_type); $rnd->delete(); $rnd->setLimit($form->getInput('per')); $rnd->setQplSequence($form->getInput('qpl')); $rnd->setTestId(ilObject::_lookupObjId($ref_id)); $rnd->create(); } else { $form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_check_input')); return $this->showRandomTestAssignment(); } ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); if ($this->test_type == ilLOSettings::TYPE_TEST_QUALIFIED) { $this->ctrl->returnToParent($this); } else { $this->ctrl->redirect($this, 'finalTestAssignment'); } }