/** * execute command */ function executeCommand() { global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr, $tpl, $lng, $ilTabs, $ilPluginAdmin, $ilDB, $tree, $ilias, $ilUser; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } $cmd = $this->ctrl->getCmd("infoScreen"); $cmdsDisabledDueToOfflineStatus = array('resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses'); if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) { $cmd = 'infoScreen'; } $next_class = $this->ctrl->getNextClass($this); $this->ctrl->setReturn($this, "infoScreen"); if (method_exists($this->object, "getTestStyleLocation")) { $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen"); } // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst"); } if (!$this->getCreationMode()) { if (IS_PAYMENT_ENABLED) { require_once 'Services/Payment/classes/class.ilPaymentObject.php'; if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) { $this->setLocator(); $this->tpl->getStandardTemplate(); include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php'; $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']); $ret = $this->ctrl->forwardCommand($pp); $this->tpl->show(); exit; } } } // elba hack for storing question id for inserting new question after if ($_REQUEST['prev_qid']) { global $___prev_question_id; $___prev_question_id = $_REQUEST['prev_qid']; $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } if (!$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) { if (!$this->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) { $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen'); } } $this->determineObjectiveOrientedContainer(); switch ($next_class) { case 'iltestexportgui': if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilTestExportGUI.php'; $ilCtrl->forwardCommand(new ilTestExportGUI($this)); break; case "ilinfoscreengui": $this->prepareOutput(); $this->addHeaderAction(); $this->infoScreen(); // forwards command break; case 'ilmdeditorgui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } $this->prepareOutput(); $this->addHeaderAction(); require_once 'Services/MetaData/classes/class.ilMDEditorGUI.php'; $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType()); $md_gui->addObserver($this->object, 'MDUpdateListener', 'General'); $this->ctrl->forwardCommand($md_gui); break; case "iltestplayerfixedquestionsetgui": require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php"; if (!$this->object->getKioskMode()) { $this->prepareOutput(); } $gui = new ilTestPlayerFixedQuestionSetGUI($this->object); $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer()); $this->ctrl->forwardCommand($gui); break; case "iltestplayerrandomquestionsetgui": require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php"; if (!$this->object->getKioskMode()) { $this->prepareOutput(); } $gui = new ilTestPlayerRandomQuestionSetGUI($this->object); $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer()); $this->ctrl->forwardCommand($gui); break; case "iltestplayerdynamicquestionsetgui": require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php"; if (!$this->object->getKioskMode()) { $this->prepareOutput(); } $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object); $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer()); $this->ctrl->forwardCommand($gui); break; case "iltestevaluationgui": $this->forwardToEvaluationGUI(); break; case "iltestevalobjectiveorientedgui": $this->forwardToEvalObjectiveOrientedGUI(); break; case "iltestservicegui": $this->prepareOutput(); $this->addHeaderAction(); require_once "./Modules/Test/classes/class.ilTestServiceGUI.php"; $serviceGUI =& new ilTestServiceGUI($this->object); $this->ctrl->forwardCommand($serviceGUI); break; case 'ilpermissiongui': $this->prepareOutput(); $this->addHeaderAction(); include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui =& new ilPermissionGUI($this); $ret =& $this->ctrl->forwardCommand($perm_gui); break; case "illearningprogressgui": $this->prepareOutput(); $this->addHeaderAction(); require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php'; $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId()); $this->ctrl->forwardCommand($new_gui); break; case "ilcertificategui": $this->prepareOutput(); $this->addHeaderAction(); require_once "./Services/Certificate/classes/class.ilCertificateGUI.php"; require_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php"; $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object)); $this->ctrl->forwardCommand($output_gui); break; case "iltestscoringgui": $this->prepareOutput(); $this->addHeaderAction(); require_once "./Modules/Test/classes/class.ilTestScoringGUI.php"; $output_gui = new ilTestScoringGUI($this->object); $this->ctrl->forwardCommand($output_gui); break; case 'ilmarkschemagui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true); $this->ctrl->redirect($this, 'infoScreen'); } $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php'; $mark_schema_gui = new ilMarkSchemaGUI($this->object); $this->ctrl->forwardCommand($mark_schema_gui); break; case 'iltestscoringbyquestionsgui': $this->prepareOutput(); $this->addHeaderAction(); include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php'; $output_gui = new ilTestScoringByQuestionsGUI($this->object); $this->ctrl->forwardCommand($output_gui); break; case 'ilobjtestsettingsgeneralgui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php'; $gui = new ilObjTestSettingsGeneralGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $ilUser, $this); $this->ctrl->forwardCommand($gui); break; case 'ilobjtestsettingsscoringresultsgui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php'; $gui = new ilObjTestSettingsScoringResultsGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $this); $this->ctrl->forwardCommand($gui); break; case 'ilobjtestdynamicquestionsetconfiggui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php'; $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object); $this->ctrl->forwardCommand($gui); break; case 'iltestrandomquestionsetconfiggui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php'; $gui = new ilTestRandomQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object); $this->ctrl->forwardCommand($gui); break; case 'iltestquestionbrowsertablegui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php'; $gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object); $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id)); $gui->init(); $this->ctrl->forwardCommand($gui); break; case 'iltestskilladministrationgui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php'; $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id); $this->ctrl->forwardCommand($gui); break; case 'iltestskillevaluationgui': $this->prepareOutput(); $this->addHeaderAction(); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php'; if ($this->object->isDynamicTest()) { require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php'; $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object); $dynamicQuestionSetConfig->loadFromDb(); $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin); $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId()); $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS); } else { $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin); $questionList->setParentObjId($this->object->getId()); $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES); } $questionList->load(); require_once 'Modules/Test/classes/class.ilTestSessionFactory.php'; $testSessionFactory = new ilTestSessionFactory($this->object); $testSession = $testSessionFactory->getSession(); $testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true); require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php'; $gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(), $this->object->getRefId(), $this->object->getId()); $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer()); $gui->setQuestionList($questionList); $gui->setTestSession($testSession); $gui->setTestResults($testResults); $this->ctrl->forwardCommand($gui); break; case 'ilobjectcopygui': $this->prepareOutput(); $this->addHeaderAction(); require_once './Services/Object/classes/class.ilObjectCopyGUI.php'; $cp = new ilObjectCopyGUI($this); $cp->setType('tst'); $this->ctrl->forwardCommand($cp); break; case 'ilrepositorysearchgui': $this->prepareOutput(); $this->addHeaderAction(); require_once './Services/Search/classes/class.ilRepositorySearchGUI.php'; $rep_search =& new ilRepositorySearchGUI(); $rep_search->setCallback($this, 'addParticipantsObject', array()); // Set tabs $this->ctrl->setReturn($this, 'participants'); $ret =& $this->ctrl->forwardCommand($rep_search); $this->tabs_gui->setTabActive('participants'); break; case 'ilpageeditorgui': case 'iltestexpresspageobjectgui': require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php'; $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB); $incompleteQuestionPurger->setOwnerId($ilUser->getId()); $incompleteQuestionPurger->purge(); $qid = $_REQUEST['q_id']; // :FIXME: does not work // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode'); if (!$qid || $qid == 'Array') { $questions = $this->object->getQuestionTitlesAndIndexes(); if (!is_array($questions)) { $questions = array(); } $keys = array_keys($questions); $qid = $keys[0]; $_REQUEST['q_id'] = $qid; $_GET['q_id'] = $qid; $_POST['q_id'] = $qid; } $this->prepareOutput(); if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) { $this->buildPageViewToolbar($qid); } if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) { require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php"; $pageObject = new ilTestExpressPageObjectGUI(0); $pageObject->test_object = $this->object; $ret =& $this->ctrl->forwardCommand($pageObject); break; } require_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $qid); if (!$q_gui instanceof assQuestionGUI) { $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', ''); $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd()); } $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $question = $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); #$this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view"); $this->ctrl->setReturn($this, "questions"); require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php"; require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php"; $page_gui = new ilTestExpressPageObjectGUI($qid); $page_gui->test_object = $this->object; $page_gui->setEditPreview(true); $page_gui->setEnabledTabs(false); if (strlen($this->ctrl->getCmd()) == 0) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview'); $page_gui->setHeader($question->getTitle()); $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile")); $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen")); $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this)); $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']'); $ret =& $this->ctrl->forwardCommand($page_gui); global $ilTabs; $ilTabs->activateTab('assQuestions'); $this->tpl->setContent($ret); break; case 'ilassquestionpreviewgui': $this->prepareOutput(); $this->ctrl->saveParameter($this, "q_id"); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php'; $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB); $gui->initQuestion((int) $_GET['q_id'], $this->object->getId()); $gui->initPreviewSettings($this->object->getRefId()); $gui->initPreviewSession($ilUser->getId(), (int) $_GET['q_id']); $gui->initHintTracking(); $gui->initStyleSheets(); $this->ctrl->forwardCommand($gui); break; case 'ilassquestionpagegui': require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php"; //echo $_REQUEST['prev_qid']; if ($_REQUEST['prev_qid']) { $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } $this->prepareOutput(); //global $___test_express_mode; //$___test_express_mode = true; $_GET['calling_test'] = $this->object->getRefId(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); $q_gui->setQuestionTabs(); $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $question =& $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); $this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view"); $this->ctrl->setReturn($this, "questions"); $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]); $page_gui->setEditPreview(true); if (strlen($this->ctrl->getCmd()) == 0) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview'); $page_gui->setHeader($question->getTitle()); $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']'); $ret =& $this->ctrl->forwardCommand($page_gui); $this->tpl->setContent($ret); break; case 'ilassspecfeedbackpagegui': require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php"; $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]); $this->ctrl->forwardCommand($pg_gui); break; case 'ilassgenfeedbackpagegui': require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php"; $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]); $this->ctrl->forwardCommand($pg_gui); break; case 'illocalunitconfigurationgui': $this->prepareSubGuiOutput(); // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php'; require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php'; $gui = new ilLocalUnitConfigurationGUI(new ilUnitConfigurationRepository((int) $_GET['q_id'])); $this->ctrl->forwardCommand($gui); break; case "ilcommonactiondispatchergui": require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; case 'ilassquestionhintsgui': $this->prepareSubGuiOutput(); // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI =& assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); // forward to ilAssQuestionHintsGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php'; $gui = new ilAssQuestionHintsGUI($questionGUI); $ilCtrl->forwardCommand($gui); break; case 'ilassquestionfeedbackeditinggui': $this->prepareSubGuiOutput(); // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); // forward to ilAssQuestionFeedbackGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php'; $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng); $ilCtrl->forwardCommand($gui); break; case 'iltesttoplistgui': $this->prepareOutput(); require_once './Modules/Test/classes/class.ilTestToplistGUI.php'; $gui = new ilTestToplistGUI($this); $this->ctrl->forwardCommand($gui); break; case 'ilscoringadjustmentgui': $this->prepareOutput(); require_once './Modules/Test/classes/class.ilScoringAdjustmentGUI.php'; $gui = new ilScoringAdjustmentGUI($this->object); $this->ctrl->forwardCommand($gui); break; case '': case 'ilobjtestgui': $this->prepareOutput(); $this->addHeaderAction(); if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) { $this->questionBrowser(); return; } if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) { $this->questionsObject(); return; } $cmd .= "Object"; $ret =& $this->{$cmd}(); break; default: // elba hack for storing question id for inserting new question after if ($_REQUEST['prev_qid']) { global $___prev_question_id; $___prev_question_id = $_REQUEST['prev_qid']; $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']); $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']); } $this->create_question_mode = true; $this->prepareOutput(); $this->ctrl->setReturn($this, "questions"); require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]); $q_gui->object->setObjId($this->object->getId()); if (!$_GET['sel_question_types']) { $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']); } else { $qType = $_GET['sel_question_types']; } $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']); $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']); $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']); if ($_REQUEST['test_express_mode']) { $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1); } #global $___test_express_mode; #$___test_express_mode = true; if (!$q_gui->isSaveCommand()) { $_GET['calling_test'] = $this->object->getRefId(); } $q_gui->setQuestionTabs(); #unset($___test_express_mode); $ret =& $this->ctrl->forwardCommand($q_gui); break; } if (!in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) && $this->getCreationMode() != true) { $this->tpl->show(); } }
/** * @deprecated */ function _getGUIClassNameForId($a_q_id) { include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_type = assQuestion::getQuestionTypeFromDb($a_q_id); $class_name = assQuestionGUI::_getClassNameForQType($q_type); return $class_name; }
/** * execute command */ function executeCommand() { global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"])) { global $ilias; $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } $cmd = $this->ctrl->getCmd("properties"); $cmdsDisabledDueToOfflineStatus = array('resume', 'start', 'outUserResultsOverview', 'outUserListOfAnswerPasses'); if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) { $cmd = 'infoScreen'; } $next_class = $this->ctrl->getNextClass($this); $this->ctrl->setReturn($this, "properties"); if (method_exists($this->object, "getTestStyleLocation")) { $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen"); } // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst"); } if (!$this->getCreationMode()) { if (IS_PAYMENT_ENABLED) { include_once 'Services/Payment/classes/class.ilPaymentObject.php'; if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) { $this->setLocator(); $this->tpl->getStandardTemplate(); include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php'; $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']); $ret = $this->ctrl->forwardCommand($pp); $this->tpl->show(); exit; } } } // elba hack for storing question id for inserting new question after if ($_REQUEST['prev_qid']) { global $___prev_question_id; $___prev_question_id = $_REQUEST['prev_qid']; $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } switch ($next_class) { case "ilinfoscreengui": $this->prepareOutput(); $this->addHeaderAction(); $this->infoScreen(); // forwards command break; case 'ilmdeditorgui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } $this->prepareOutput(); $this->addHeaderAction(); include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php'; $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType()); $md_gui->addObserver($this->object, 'MDUpdateListener', 'General'); $this->ctrl->forwardCommand($md_gui); break; case "iltestoutputgui": include_once "./Modules/Test/classes/class.ilTestOutputGUI.php"; if (!$this->object->getKioskMode()) { $this->prepareOutput(); } $output_gui =& new ilTestOutputGUI($this->object); $this->ctrl->forwardCommand($output_gui); break; case "iltestevaluationgui": $this->prepareOutput(); $this->addHeaderAction(); include_once "./Modules/Test/classes/class.ilTestEvaluationGUI.php"; $evaluation_gui =& new ilTestEvaluationGUI($this->object); $this->ctrl->forwardCommand($evaluation_gui); break; case "iltestservicegui": $this->prepareOutput(); $this->addHeaderAction(); include_once "./Modules/Test/classes/class.ilTestServiceGUI.php"; $serviceGUI =& new ilTestServiceGUI($this->object); $this->ctrl->forwardCommand($serviceGUI); break; case 'ilpermissiongui': $this->prepareOutput(); $this->addHeaderAction(); include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui =& new ilPermissionGUI($this); $ret =& $this->ctrl->forwardCommand($perm_gui); break; case "illearningprogressgui": $this->prepareOutput(); $this->addHeaderAction(); include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php'; $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY, $this->object->getRefId()); $this->ctrl->forwardCommand($new_gui); break; case "ilcertificategui": $this->prepareOutput(); $this->addHeaderAction(); include_once "./Services/Certificate/classes/class.ilCertificateGUI.php"; include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php"; $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object)); $this->ctrl->forwardCommand($output_gui); break; case "iltestscoringgui": $this->prepareOutput(); $this->addHeaderAction(); include_once "./Modules/Test/classes/class.ilTestScoringGUI.php"; $output_gui = new ilTestScoringGUI($this->object); $this->ctrl->forwardCommand($output_gui); break; case 'ilobjectcopygui': $this->prepareOutput(); $this->addHeaderAction(); include_once './Services/Object/classes/class.ilObjectCopyGUI.php'; $cp = new ilObjectCopyGUI($this); $cp->setType('tst'); $this->ctrl->forwardCommand($cp); break; case 'ilrepositorysearchgui': $this->prepareOutput(); $this->addHeaderAction(); include_once './Services/Search/classes/class.ilRepositorySearchGUI.php'; $rep_search =& new ilRepositorySearchGUI(); $rep_search->setCallback($this, 'addParticipantsObject', array()); // Set tabs $this->ctrl->setReturn($this, 'participants'); $ret =& $this->ctrl->forwardCommand($rep_search); $this->tabs_gui->setTabActive('participants'); break; case 'ilpageeditorgui': case 'iltestexpresspageobjectgui': $qid = $_REQUEST['q_id']; // :FIXME: does not work // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode'); if (!$qid || $qid == 'Array') { $questions = $this->object->getQuestionTitlesAndIndexes(); if (!is_array($questions)) { $questions = array(); } $keys = array_keys($questions); $qid = $keys[0]; $_REQUEST['q_id'] = $qid; $_GET['q_id'] = $qid; $_POST['q_id'] = $qid; } $this->prepareOutput(); if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) { $this->buildPageViewToolbar($qid); } if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) { include_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php"; $pageObject = new ilTestExpressPageObjectGUI("qpl", 0); $pageObject->test_object = $this->object; $ret =& $this->ctrl->forwardCommand($pageObject); break; } include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui =& assQuestionGUI::_getQuestionGUI("", $qid); $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $question =& $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); #$this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view"); $this->ctrl->setReturn($this, "questions"); //$page =& new ilPageObject("qpl", $_GET["q_id"]); include_once "./Services/COPage/classes/class.ilPageObject.php"; include_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php"; $page_gui =& new ilTestExpressPageObjectGUI("qpl", $qid); $page_gui->test_object = $this->object; $page_gui->setEditPreview(true); $page_gui->setEnabledTabs(false); $page_gui->setEnabledInternalLinks(false); if (strlen($this->ctrl->getCmd()) == 0) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview'); $page_gui->setHeader($question->getTitle()); $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile")); $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen")); $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this)); $page_gui->setPresentationTitle($question->getTitle()); $ret =& $this->ctrl->forwardCommand($page_gui); global $ilTabs; $ilTabs->activateTab('assQuestions'); $this->tpl->setContent($ret); break; case 'ilpageobjectgui': include_once "./Services/COPage/classes/class.ilPageObjectGUI.php"; //echo $_REQUEST['prev_qid']; if ($_REQUEST['prev_qid']) { $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } $this->prepareOutput(); //global $___test_express_mode; //$___test_express_mode = true; $_GET['calling_test'] = $this->object->getRefId(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui =& assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); $q_gui->setQuestionTabs(); $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $question =& $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); include_once "./Services/COPage/classes/class.ilPageObject.php"; include_once "./Services/COPage/classes/class.ilPageObjectGUI.php"; $this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilPageObjectGUI", "view"); $this->ctrl->setReturn($this, "questions"); //$page =& new ilPageObject("qpl", $_GET["q_id"]); $page_gui =& new ilPageObjectGUI("qpl", $_GET["q_id"]); $page_gui->setEditPreview(true); $page_gui->setEnabledTabs(false); $page_gui->setEnabledInternalLinks(false); if (strlen($this->ctrl->getCmd()) == 0) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } //$page_gui->setQuestionXML($question->toXML(false, false, true)); $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview'); $page_gui->setHeader($question->getTitle()); $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile")); $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen")); $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this)); $page_gui->setPresentationTitle($question->getTitle()); $ret =& $this->ctrl->forwardCommand($page_gui); $this->tpl->setContent($ret); break; case "ilcommonactiondispatchergui": include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; case 'ilassquestionhintsgui': $this->prepareSubGuiOutput(); // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI =& assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); // forward to ilAssQuestionHintsGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php'; $gui = new ilAssQuestionHintsGUI($questionGUI); $ilCtrl->forwardCommand($gui); break; case 'iltesttoplistgui': $this->prepareOutput(); require_once 'Modules/Test/classes/class.ilTestToplistGUI.php'; $gui = new ilTestToplistGUI($this); $this->ctrl->forwardCommand($gui); break; case '': case 'ilobjtestgui': $this->prepareOutput(); $this->addHeaderAction(); if (preg_match("/deleteqpl_\\d+/", $cmd)) { $cmd = "randomQuestions"; } if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) { $this->questionBrowser(); return; } if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) { $this->questionsObject(); return; } $cmd .= "Object"; $ret =& $this->{$cmd}(); break; default: // elba hack for storing question id for inserting new question after if ($_REQUEST['prev_qid']) { global $___prev_question_id; $___prev_question_id = $_REQUEST['prev_qid']; $this->ctrl->setParameterByClass('ilpageobjectgui', 'prev_qid', $_REQUEST['prev_qid']); $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']); } $this->create_question_mode = true; $this->prepareOutput(); $this->ctrl->setReturn($this, "questions"); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]); $q_gui->object->setObjId($this->object->getId()); if (!$_GET['sel_question_types']) { $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']); } else { $qType = $_GET['sel_question_types']; } $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']); $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']); $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']); if ($_REQUEST['test_express_mode']) { $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1); } #global $___test_express_mode; #$___test_express_mode = true; if (!$q_gui->isSaveCommand()) { $_GET['calling_test'] = $this->object->getRefId(); } $q_gui->setQuestionTabs(); #unset($___test_express_mode); $ret =& $this->ctrl->forwardCommand($q_gui); break; } if (strtolower($_GET["baseClass"]) != "iladministrationgui" && $this->getCreationMode() != true) { $this->tpl->show(); } }