public static function getReturnToPageLink($q_id = null) { $params = array(); $q_id = $q_id ? $q_id : $_REQUEST['q_id']; $params['baseClass'] = 'ilObjTestGUI'; if ($_REQUEST['calling_test']) { $params['ref_id'] = $_REQUEST['calling_test']; } else { if ($_REQUEST['test_ref_id']) { $params['ref_id'] = $_REQUEST['test_ref_id']; } else { $params['ref_id'] = $_REQUEST['ref_id']; } } $params['test_express_mode'] = 1; #$nodeParts = explode(':', $_REQUEST['cmdNode']); if ($_REQUEST['q_id']) { $params['cmd'] = 'edit'; $params['q_id'] = $q_id ? $q_id : (isset($_REQUEST['prev_qid']) ? $_REQUEST['prev_qid'] : $_REQUEST['q_id']); $params['cmdClass'] = 'iltestexpresspageobjectgui'; $params['cmdNode'] = ilTestExpressPage::getNodeId('ilobjtestgui') . ':' . ilTestExpressPage::getNodeId('iltestexpresspageobjectgui'); #ref_id=44&cmd=post&cmdClass=iltestexpresspageobjectgui&cmdNode=6o:61&baseClass=ilObjTestGUI } else { $params['cmd'] = 'showQuestionsPerPage'; $params['cmdNode'] = ilTestExpressPage::getNodeId('ilobjtestgui'); } return 'ilias.php?' . http_build_query($params); }
/** * Sets the ILIAS tabs for this question type * * @access public * * @todo: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI */ function setQuestionTabs() { global $rbacsystem, $ilTabs; $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $q_type = $this->object->getQuestionType(); if (strlen($q_type)) { $classname = $q_type . "GUI"; $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type); $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]); } if ($_GET["q_id"]) { if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) { // edit page $ilTabs->addTarget("edit_page", $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"), array("edit", "insert", "exec_pg"), "", "", $force_active); } // edit page $ilTabs->addTarget("preview", $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "preview"), array("preview"), "ilAssQuestionPageGUI", "", $force_active); } $force_active = false; if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) { $url = ""; if ($classname) { $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion"); } $commands = $_POST["cmd"]; if (is_array($commands)) { foreach ($commands as $key => $value) { if (preg_match("/^delete_.*/", $key, $matches)) { $force_active = true; } } } // edit question properties $ilTabs->addTarget("edit_question", $url, array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"), $classname, "", $force_active); } // add tab for question feedback within common class assQuestionGUI $this->addTab_QuestionFeedback($ilTabs); // add tab for question hint within common class assQuestionGUI $this->addTab_QuestionHints($ilTabs); if ($_GET["q_id"]) { $ilTabs->addTarget("solution_hint", $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"), array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel", "addSuggestedSolution", "cancelExplorer", "linkChilds", "removeSuggestedSolution"), $classname, ""); } // Assessment of questions sub menu entry if ($_GET["q_id"]) { $ilTabs->addTarget("statistics", $this->ctrl->getLinkTargetByClass($classname, "assessment"), array("assessment"), $classname, ""); } if ($_GET["calling_test"] > 0 || $_GET["test_ref_id"] > 0) { $ref_id = $_GET["calling_test"]; if (strlen($ref_id) == 0) { $ref_id = $_GET["test_ref_id"]; } global $___test_express_mode; if (!$_GET['test_express_mode'] && !$___test_express_mode) { $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id={$ref_id}"); } else { $link = ilTestExpressPage::getReturnToPageLink(); $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link); } } else { $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions")); } }
/** * @param ilTabsGUI $ilTabs */ protected function addBackTab(ilTabsGUI $ilTabs) { if ($_GET["calling_test"] > 0 || $_GET["test_ref_id"] > 0) { $ref_id = $_GET["calling_test"]; if (strlen($ref_id) == 0) { $ref_id = $_GET["test_ref_id"]; } if (!$_GET['test_express_mode'] && !$GLOBALS['___test_express_mode']) { $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id={$ref_id}"); } else { $link = ilTestExpressPage::getReturnToPageLink(); $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link); } } else { if (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) { $ref_id = (int) $_GET['calling_consumer']; $consumer = ilObjectFactory::getInstanceByRefId($ref_id); if ($consumer instanceof ilQuestionEditingFormConsumer) { $ilTabs->setBackTarget($consumer->getQuestionEditingFormBackTargetLabel(), $consumer->getQuestionEditingFormBackTarget($_GET['consumer_context'])); } else { require_once 'Services/Link/classes/class.ilLink.php'; $ilTabs->setBackTarget($this->lng->txt("qpl"), ilLink::_getLink($ref_id)); } } else { $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions")); } } }
private function redirectToQuestionEditPage($questionType, $qid, $prev_qid) { include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php'; $ref_id = $_GET['ref_id']; $sel_question_types = $questionType; $cmd = 'editQuestion'; $cmdClass = strtolower($questionType); $cmdNode = $_GET['cmdNode']; $baseClass = 'ilObjTestGUI'; $node = ilTestExpressPage::getNodeId(strtolower($questionType) . 'gui'); $cmdNodes = explode(':', $_GET['cmdNode']); $firstNode = $cmdNodes[0]; $linkParams = array('ref_id' => $_GET['ref_id'], 'sel_question_types' => $questionType, 'cmd' => 'editQuestion', 'cmdClass' => strtolower($questionType) . 'gui', 'cmdNode' => $firstNode . ':' . $node, 'baseClass' => 'ilObjTestGUI', 'test_ref_id' => $_GET['ref_id'], 'calling_test' => $_GET['ref_id'], 'q_id' => $qid, 'prev_qid' => $prev_qid); if ($_REQUEST['test_express_mode']) { $linkParams['test_express_mode'] = 1; } ilUtil::redirect('ilias.php?' . http_build_query($linkParams, 'null', '&')); }
/** * save question */ function saveReturn() { global $ilUser; $old_id = $_GET["q_id"]; $result = $this->writePostData(); if ($result == 0) { $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType()); $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType()); $this->object->saveToDb(); $originalexists = $this->object->_questionExistsInPool($this->object->original_id); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { $this->ctrl->redirect($this, "originalSyncForm"); return; } elseif ($_GET["calling_test"]) { require_once 'Modules/Test/classes/class.ilObjTest.php'; $test = new ilObjTest($_GET["calling_test"]); #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())); $q_id = $this->object->getId(); if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $_GET["ref_id"] = $_GET["calling_test"]; $test =& new ilObjTest($_GET["calling_test"], true); $new_id = $test->insertQuestion($this->object->getId()); $q_id = $new_id; if (isset($_REQUEST['prev_qid'])) { $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']); } $this->ctrl->setParameter($this, 'q_id', $new_id); $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']); #$this->ctrl->setParameter($this, 'test_ref_id', false); } if ($_REQUEST['test_express_mode']) { ilUtil::redirect(ilTestExpressPage::getReturnToPageLink($q_id)); } else { ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]); } } else { if ($this->object->getId() != $old_id) { $this->callNewIdListeners($this->object->getId()); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } if (strcmp($_SESSION["info"], "") != 0) { ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true); } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); } $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } } }