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);
 }
예제 #2
0
 /**
  * Insert questions from the questionbrowser into the test 
  *
  * @access	public
  */
 function insertQuestionsObject()
 {
     $selected_array = is_array($_POST['q_id']) ? $_POST['q_id'] : array();
     if (!count($selected_array)) {
         ilUtil::sendInfo($this->lng->txt("tst_insert_missing_question"), true);
         $this->ctrl->redirect($this, "browseForQuestions");
     } else {
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         $manscoring = FALSE;
         foreach ($selected_array as $key => $value) {
             $this->object->insertQuestion($this->testQuestionSetConfigFactory->getQuestionSetConfig(), $value);
             if (!$manscoring) {
                 $manscoring = $manscoring | assQuestion::_needsManualScoring($value);
             }
         }
         $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
         if ($manscoring) {
             ilUtil::sendInfo($this->lng->txt("manscoring_hint"), TRUE);
         } else {
             ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), TRUE);
         }
         $this->ctrl->redirect($this, "questions");
         return;
     }
 }
예제 #3
0
 /**
  * Remove questions from the test after confirmation
  */
 public function confirmRemoveQuestionsObject()
 {
     $checked_questions = $_POST["q_id"];
     $questions = $this->object->getQuestionTitlesAndIndexes();
     $deleted = array();
     foreach ((array) $checked_questions as $value) {
         $this->object->removeQuestion($value);
         $deleted[] = $value;
     }
     $this->object->saveCompleteStatus($this->testQuestionSetConfigFactory->getQuestionSetConfig());
     ilUtil::sendSuccess($this->lng->txt("tst_questions_removed"));
     if ($_REQUEST['test_express_mode']) {
         $prev = null;
         $return_to = null;
         $deleted_tmp = $deleted;
         $first = array_shift($deleted_tmp);
         foreach ((array) $questions as $key => $value) {
             if (!in_array($key, $deleted)) {
                 $prev = $key;
                 if (!$first) {
                     $return_to = $prev;
                     break;
                 } else {
                     continue;
                 }
             } else {
                 if ($key == $first) {
                     if ($prev) {
                         $return_to = $prev;
                         break;
                     }
                     $first = array_shift($deleted_tmp);
                 }
             }
         }
         if (count($questions) == count($checked_questions) || !$return_to) {
             $this->ctrl->setParameter($this, 'q_id', '');
             $this->ctrl->redirect($this, 'showPage');
         }
         $this->ctrl->setParameter($this, 'q_id', $return_to);
         $this->ctrl->redirect($this, "showPage");
     } else {
         $this->ctrl->setParameter($this, 'q_id', '');
         $this->ctrl->redirect($this, 'questions');
     }
 }
 /**
  * command method that checks the question set config form
  * 
  * if form is valid it gets saved to the database,
  * otherwise it will be reprinted with alerts
  */
 public function saveFormCmd()
 {
     $form = $this->buildForm();
     if ($this->testOBJ->participantDataExist()) {
         ilUtil::sendFailure($this->lng->txt("tst_msg_cannot_modify_dynamic_question_set_conf_due_to_part"), true);
         return $this->showFormCmd($form);
     }
     $errors = !$form->checkInput();
     // ALWAYS CALL BEFORE setValuesByPost()
     $form->setValuesByPost();
     // NEVER CALL THIS BEFORE checkInput()
     if ($errors) {
         ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
         return $this->showFormCmd($form);
     }
     $this->performSaveForm($form);
     $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
     ilUtil::sendSuccess($this->lng->txt("tst_msg_dynamic_question_set_config_modified"), true);
     $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
 }
 /**
  * Save the mark schema
  *
  * Save the mark schema
  *
  * @access	public
  */
 function saveMarksObject()
 {
     try {
         $this->saveMarkSchemaFormData();
         $mark_check = $this->object->checkMarks();
     } catch (Exception $ex) {
         $mark_check = $this->lng->txt('mark_schema_invalid');
     }
     if ($mark_check !== true) {
         ilUtil::sendFailure($mark_check);
     } elseif ($_POST["chbECTS"] && (strcmp($_POST["ects_grade_a"], "") == 0 or strcmp($_POST["ects_grade_b"], "") == 0 or strcmp($_POST["ects_grade_c"], "") == 0 or strcmp($_POST["ects_grade_d"], "") == 0 or strcmp($_POST["ects_grade_e"], "") == 0)) {
         ilUtil::sendInfo($this->lng->txt("ects_fill_out_all_values"), true);
     } elseif ($_POST["ects_grade_a"] > 100 or $_POST["ects_grade_a"] < 0) {
         ilUtil::sendInfo($this->lng->txt("ects_range_error_a"), true);
     } elseif ($_POST["ects_grade_b"] > 100 or $_POST["ects_grade_b"] < 0) {
         ilUtil::sendInfo($this->lng->txt("ects_range_error_b"), true);
     } elseif ($_POST["ects_grade_c"] > 100 or $_POST["ects_grade_c"] < 0) {
         ilUtil::sendInfo($this->lng->txt("ects_range_error_c"), true);
     } elseif ($_POST["ects_grade_d"] > 100 or $_POST["ects_grade_d"] < 0) {
         ilUtil::sendInfo($this->lng->txt("ects_range_error_d"), true);
     } elseif ($_POST["ects_grade_e"] > 100 or $_POST["ects_grade_e"] < 0) {
         ilUtil::sendInfo($this->lng->txt("ects_range_error_e"), true);
     } else {
         $this->object->mark_schema->saveToDb($this->object->getTestId());
         $this->object->saveCompleteStatus();
         if ($this->object->getReportingDate()) {
             $fxpercent = "";
             if ($_POST["chbUseFX"]) {
                 $fxpercent = ilUtil::stripSlashes($_POST["percentFX"]);
             }
             $this->object->saveECTSStatus($_POST["chbECTS"], $fxpercent, ilUtil::stripSlashes($this->object->ects_grades["A"]), ilUtil::stripSlashes($this->object->ects_grades["B"]), ilUtil::stripSlashes($this->object->ects_grades["C"]), ilUtil::stripSlashes($this->object->ects_grades["D"]), ilUtil::stripSlashes($this->object->ects_grades["E"]));
         }
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
     }
     $this->marksObject();
 }