private function insertQuestionsCmd() { $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, self::CMD_BROWSE_QUESTIONS); } include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $testQuestionSetConfig = $this->buildTestQuestionSetConfig(); $manscoring = FALSE; foreach ($selected_array as $key => $value) { $last_question_id = $this->testOBJ->insertQuestion($testQuestionSetConfig, $value); if (!$manscoring) { $manscoring = $manscoring | assQuestion::_needsManualScoring($value); } } $this->testOBJ->saveCompleteStatus($testQuestionSetConfig); if ($manscoring) { ilUtil::sendInfo($this->lng->txt("manscoring_hint"), TRUE); } else { ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), TRUE); } //$this->ctrl->setParameter($this, 'q_id', $last_question_id); // for page view ? $this->ctrl->redirectByClass($this->getBackTargetCmdClass(), $this->getBackTargetCommand()); }
function insertQuestions() { $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; global $tree, $ilDB, $ilPluginAdmin; require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php'; $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $this->test_object); $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig(); foreach ($selected_array as $key => $value) { $last_question_id = $this->test_object->insertQuestion($testQuestionSetConfig, $value); if (!$manscoring) { $manscoring = $manscoring | assQuestion::_needsManualScoring($value); } } $this->test_object->saveCompleteStatus($testQuestionSetConfig); if ($manscoring) { ilUtil::sendInfo($this->lng->txt("manscoring_hint"), TRUE); } else { ilUtil::sendSuccess($this->lng->txt("tst_questions_inserted"), TRUE); } $this->ctrl->setParameter($this, 'q_id', $last_question_id); $this->ctrl->redirect($this, "showPage"); return; } }
/** * 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; } }