From c7656520fdb9282a41ed833dad92006807010c74 Mon Sep 17 00:00:00 2001 From: Stephan Winiker Date: Fri, 3 Jun 2022 15:38:29 +0200 Subject: [PATCH 1/3] Fix https://mantis.ilias.de/view.php?id=32824 --- ...lass.ilAssQuestionPageCommandForwarder.php | 55 +++++----- .../classes/class.assQuestion.php | 16 --- .../classes/class.assQuestionGUI.php | 15 --- .../class.ilAssQuestionFeedbackEditingGUI.php | 12 --- .../classes/class.ilObjQuestionPoolGUI.php | 102 ++++++++++++++---- 5 files changed, 107 insertions(+), 93 deletions(-) diff --git a/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php b/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php index b88e21382bc7..2602b8e38170 100644 --- a/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php +++ b/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php @@ -35,48 +35,47 @@ public function setTestObj($testObj) public function forward() { - global $DIC; /* @var ILIAS\DI\Container $DIC */ + global $DIC; + $ctrl = $DIC->ctrl(); + $lng = $DIC->language(); + $ui = $DIC->ui()->mainTemplate(); + + $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); + $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW); + $q_gui->setQuestionTabs(); + $q_gui->outAdditionalOutput(); + $q_gui->object->setObjId($this->getTestObj()->getId()); + $question = &$q_gui->object; - require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php"; - //echo $_REQUEST['prev_qid']; if ($_REQUEST['prev_qid']) { - $DIC->ctrl()->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); + $ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } - //global $___test_express_mode; - //$___test_express_mode = true; $_GET['calling_test'] = $this->getTestObj()->getRefId(); include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php"); - $DIC->ui()->mainTemplate()->setCurrentBlock("ContentStyle"); - $DIC->ui()->mainTemplate()->setVariable( + $ui->setCurrentBlock("ContentStyle"); + $ui->setVariable( "LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0) ); - $DIC->ui()->mainTemplate()->parseCurrentBlock(); + $ui->parseCurrentBlock(); // syntax style - $DIC->ui()->mainTemplate()->setCurrentBlock("SyntaxStyle"); - $DIC->ui()->mainTemplate()->setVariable( + $ui->setCurrentBlock("SyntaxStyle"); + $ui->setVariable( "LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath() ); - $DIC->ui()->mainTemplate()->parseCurrentBlock(); - require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; - $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); - $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW); - $q_gui->setQuestionTabs(); - $q_gui->outAdditionalOutput(); - $q_gui->object->setObjId($this->getTestObj()->getId()); - $question = &$q_gui->object; - $DIC->ctrl()->saveParameter($this, "q_id"); - $DIC->language()->loadLanguageModule("content"); - $DIC->ctrl()->setReturnByClass("ilAssQuestionPageGUI", "view"); - $DIC->ctrl()->setReturnByClass("ilObjTestGUI", "questions"); + $ui->parseCurrentBlock(); + $ctrl->saveParameter($this, "q_id"); + $lng->loadLanguageModule("content"); + $ctrl->setReturnByClass("ilAssQuestionPageGUI", "view"); + $ctrl->setReturnByClass("ilObjTestGUI", "questions"); $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]); $page_gui->setEditPreview(true); - if (strlen($DIC->ctrl()->getCmd()) == 0) { - $DIC->ctrl()->setCmdClass(get_class($page_gui)); - $DIC->ctrl()->setCmd("preview"); + if (strlen($ctrl->getCmd()) == 0) { + $ctrl->setCmdClass(get_class($page_gui)); + $ctrl->setCmd("preview"); } $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); @@ -84,7 +83,7 @@ public function forward() $page_gui->setHeader($question->getTitle()); $page_gui->setPresentationTitle($question->getTitle() . ' [' . $DIC->language()->txt('question_id_short') . ': ' . $question->getId() . ']'); - $html = $DIC->ctrl()->forwardCommand($page_gui); - $DIC->ui()->mainTemplate()->setContent($html); + $html = $ctrl->forwardCommand($page_gui); + $ui->setContent($html); } } diff --git a/Modules/TestQuestionPool/classes/class.assQuestion.php b/Modules/TestQuestionPool/classes/class.assQuestion.php index 511a4a87e4ad..27e9cc3428d3 100755 --- a/Modules/TestQuestionPool/classes/class.assQuestion.php +++ b/Modules/TestQuestionPool/classes/class.assQuestion.php @@ -5504,20 +5504,4 @@ public function isInActiveTest() : bool $res = $this->db->query($query); return $res->numRows() > 0; } - - public function getParentTestRefId() : ?int - { - $query = 'SELECT ref_id FROM object_reference ' . PHP_EOL - . 'JOIN tst_tests ON tst_tests.obj_fi = object_reference.obj_id' . PHP_EOL - . 'JOIN tst_test_question ON tst_test_question.test_fi = tst_tests.test_id ' . PHP_EOL - . 'JOIN qpl_questions ON qpl_questions.question_id = tst_test_question.question_fi ' . PHP_EOL - . 'WHERE qpl_questions.obj_fi = ' . $this->db->quote($this->getObjId(), 'integer'); - - $res = $this->db->query($query); - $row = $this->db->fetchAssoc($res); - if ($res->numRows() > 0) { - return (int) $row['ref_id']; - } - return null; - } } diff --git a/Modules/TestQuestionPool/classes/class.assQuestionGUI.php b/Modules/TestQuestionPool/classes/class.assQuestionGUI.php index b14c361387a6..c6532e1a495d 100755 --- a/Modules/TestQuestionPool/classes/class.assQuestionGUI.php +++ b/Modules/TestQuestionPool/classes/class.assQuestionGUI.php @@ -226,24 +226,9 @@ public function executeCommand() { global $DIC; $DIC['ilHelp']->setScreenIdComponent('qpl'); - $access = $DIC['ilAccess']; $cmd = $this->ctrl->getCmd("editQuestion"); - if (in_array($cmd, ['editQuestion', 'save'])) { - $parent_test_ref_id = $this->object->getParentTestRefId(); - if ($parent_test_ref_id && - !$access->checkAccess("write", "", $parent_test_ref_id) - ) { - ilUtil::sendFailure($this->lng->txt("no_permission"), true); - $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); - } - if ($this->object->isInActiveTest()) { - ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); - $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); - } - } - $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { diff --git a/Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php b/Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php index d982f09d88ee..b718152ef2e5 100644 --- a/Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php +++ b/Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php @@ -127,18 +127,6 @@ public function executeCommand() $this->setContentStyle(); - $parent_test_ref_id = $this->questionOBJ->getParentTestRefId(); - if ($parent_test_ref_id && - !$this->access->checkAccess("write", "", $parent_test_ref_id) - ) { - ilUtil::sendFailure($this->lng->txt("no_permission"), true); - $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); - } - if ($this->questionOBJ->isInActiveTest()) { - ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); - $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); - } - switch ($nextClass) { case 'ilassspecfeedbackpagegui': case 'ilassgenfeedbackpagegui': diff --git a/Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php b/Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php index e1c793a8112c..9023159dcdd8 100755 --- a/Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php +++ b/Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php @@ -161,7 +161,10 @@ public function executeCommand() break; case 'ilassquestionpreviewgui': - + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } + $this->ctrl->saveParameter($this, "q_id"); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php'; @@ -181,10 +184,14 @@ public function executeCommand() break; case "ilassquestionpagegui": - if($cmd == 'finishEditing') { - $this->ctrl->redirectByClass('ilassquestionpreviewgui','show'); + if ($cmd == 'finishEditing') { + $this->ctrl->redirectByClass('ilassquestionpreviewgui', 'show'); break; } + if ($cmd === 'edit' && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } + include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php"); $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); @@ -210,6 +217,12 @@ public function executeCommand() } $question = $q_gui->object; + + if ($question->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } + $this->ctrl->saveParameter($this, "q_id"); include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php"); $this->lng->loadLanguageModule("content"); @@ -263,7 +276,9 @@ public function executeCommand() break; case 'ilassquestionhintsgui': - + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } // set return target $this->ctrl->setReturn($this, "questions"); @@ -272,7 +287,12 @@ public function executeCommand() $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater()); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); - global $DIC; + + if ($questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } + $ilHelp = $DIC['ilHelp']; $ilHelp->setScreenIdComponent("qpl"); @@ -313,7 +333,10 @@ public function executeCommand() break; case 'ilassquestionfeedbackeditinggui': - + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } + // set return target $this->ctrl->setReturn($this, "questions"); @@ -322,7 +345,12 @@ public function executeCommand() $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater()); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); - global $DIC; + + if ($questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } + $ilHelp = $DIC['ilHelp']; $ilHelp->setScreenIdComponent("qpl"); @@ -395,24 +423,33 @@ public function executeCommand() break; default: + if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } + $this->ctrl->setReturn($this, "questions"); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; - $q_gui = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater()); - $q_gui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING); - $q_gui->object->setObjId($this->object->getId()); + $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $this->fetchAuthoringQuestionIdParamater()); + $questionGUI->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING); + $questionGUI->object->setObjId($this->object->getId()); + + if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } + if ($this->object->getType() == 'qpl') { - $q_gui->setTaxonomyIds($this->object->getTaxonomyIds()); - $this->object->addQuestionChangeListeners($q_gui->object); + $questionGUI->setTaxonomyIds($this->object->getTaxonomyIds()); + $this->object->addQuestionChangeListeners($questionGUI->object); if ($writeAccess) { - $q_gui->addHeaderAction(); + $questionGUI->addHeaderAction(); } } - $q_gui->setQuestionTabs(); - - global $DIC; + $questionGUI->setQuestionTabs(); + $ilHelp = $DIC['ilHelp']; $ilHelp->setScreenIdComponent("qpl"); - $ret = $this->ctrl->forwardCommand($q_gui); + $ret = $this->ctrl->forwardCommand($questionGUI); break; } @@ -423,6 +460,15 @@ public function executeCommand() } } + + protected function redirectAfterMissingWrite() + { + ilUtil::sendFailure($this->lng->txt("no_permission"), true); + $target_class = get_class($this->object) . "GUI"; + $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id); + $this->ctrl->redirectByClass($target_class); + } + /** * Gateway for exports initiated from workspace, as there is a generic * forward to {objTypeMainGUI}::export() @@ -996,8 +1042,14 @@ public function resetQuestionBrowserObject() $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId()); include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php"; - $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', false, false, - $taxIds, $this->isCommentingEnabled()); + $table_gui = new ilQuestionBrowserTableGUI( + $this, + 'questions', + false, + false, + $taxIds, + $this->isCommentingEnabled() + ); $table_gui->resetOffset(); $table_gui->resetFilter(); $this->questionsObject(); @@ -1338,7 +1390,7 @@ public function &editQuestionForTestObject() { global $DIC; include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; - $p_gui = new ilAssQuestionPreviewGUI($this->ctrl,$this->tabs_gui,$this->tpl,$this->lng,$DIC->database(),$DIC->user()); + $p_gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $DIC->database(), $DIC->user()); $this->ctrl->redirectByClass(get_class($p_gui), "show"); } @@ -1720,8 +1772,14 @@ private function buildQuestionBrowserTableGUI($taxIds) $writeAccess = $this->checkWriteAccess(); include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php"; - $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', $writeAccess, - false, $taxIds, $this->isCommentingEnabled()); + $table_gui = new ilQuestionBrowserTableGUI( + $this, + 'questions', + $writeAccess, + false, + $taxIds, + $this->isCommentingEnabled() + ); $table_gui->setEditable($writeAccess); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php'; From 1bb99b34fe23e84704a351cde92f9416859743f7 Mon Sep 17 00:00:00 2001 From: Stephan Winiker Date: Fri, 3 Jun 2022 16:48:00 +0200 Subject: [PATCH 2/3] And now the same thing for ilObjTestGUI --- ...lass.ilAssQuestionPageCommandForwarder.php | 6 +++ Modules/Test/classes/class.ilObjTestGUI.php | 43 ++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php b/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php index 2602b8e38170..5b7f18624611 100644 --- a/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php +++ b/Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php @@ -47,6 +47,12 @@ public function forward() $q_gui->object->setObjId($this->getTestObj()->getId()); $question = &$q_gui->object; + + if ($ctrl->getCmd() === 'edit' && $question->isInActiveTest()) { + ilUtil::sendFailure($lng->txt("question_is_part_of_running_test"), true); + $ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } + if ($_REQUEST['prev_qid']) { $ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']); } diff --git a/Modules/Test/classes/class.ilObjTestGUI.php b/Modules/Test/classes/class.ilObjTestGUI.php index 60776e970b54..2457c50fdc3f 100755 --- a/Modules/Test/classes/class.ilObjTestGUI.php +++ b/Modules/Test/classes/class.ilObjTestGUI.php @@ -665,8 +665,8 @@ public function executeCommand() break; case 'ilassquestionpreviewgui': - if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) { - $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); } $this->prepareOutput(); @@ -689,6 +689,9 @@ public function executeCommand() if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) { $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } + if ($cmd === 'edit' && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } $_GET['q_id'] = $this->fetchAuthoringQuestionIdParameter(); $this->prepareOutput(); require_once 'Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php'; @@ -748,8 +751,8 @@ public function executeCommand() break; case 'ilassquestionhintsgui': - if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) { - $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); } $this->prepareSubGuiOutput(); @@ -761,6 +764,11 @@ public function executeCommand() $questionGUI = assQuestionGUI::_getQuestionGUI('', $this->fetchAuthoringQuestionIdParameter()); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); + + if ($questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } // forward to ilAssQuestionHintsGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php'; @@ -775,8 +783,8 @@ public function executeCommand() break; case 'ilassquestionfeedbackeditinggui': - if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) { - $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); + if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); } $this->prepareSubGuiOutput(); @@ -788,6 +796,11 @@ public function executeCommand() $questionGUI = assQuestionGUI::_getQuestionGUI('', $this->fetchAuthoringQuestionIdParameter()); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); + + if ($questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } // forward to ilAssQuestionFeedbackGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php'; @@ -828,6 +841,9 @@ public function executeCommand() if ((!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))) { $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } + if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && !$ilAccess->checkAccess('write', '', $this->object->getRefId())) { + $this->redirectAfterMissingWrite(); + } // elba hack for storing question id for inserting new question after if ($_REQUEST['prev_qid']) { global $___prev_question_id; @@ -850,6 +866,11 @@ public function executeCommand() $questionGui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING); $questionGui->object->setObjId($this->object->getId()); + + if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGUI->object->isInActiveTest()) { + ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); + $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); + } $questionGuiClass = get_class($questionGui); $this->ctrl->setParameterByClass($questionGuiClass, 'prev_qid', $_REQUEST['prev_qid']); @@ -882,6 +903,14 @@ public function executeCommand() } } + protected function redirectAfterMissingWrite() + { + ilUtil::sendFailure($this->lng->txt("no_permission"), true); + $target_class = get_class($this->object) . "GUI"; + $this->ctrl->setParameterByClass($target_class, 'ref_id', $this->ref_id); + $this->ctrl->redirectByClass($target_class); + } + protected function trackTestObjectReadEvent() { /* @var ILIAS\DI\Container $DIC */ global $DIC; @@ -972,7 +1001,7 @@ private function testResultsGatewayObject() $gui = new ilParticipantsTestResultsGUI(); $gui->setTestObj($this->object); - $factory = new ilTestQuestionSetConfigFactory($this->tree,$DIC->database(),$ilPluginAdmin, $this->object); + $factory = new ilTestQuestionSetConfigFactory($this->tree, $DIC->database(), $ilPluginAdmin, $this->object); $gui->setQuestionSetConfig($factory->getQuestionSetConfig()); $gui->setObjectiveParent(new ilTestObjectiveOrientedContainer()); $gui->setTestAccess($this->getTestAccess()); From 7669cc1136a712fd9da74c4958598536ead81009 Mon Sep 17 00:00:00 2001 From: Stephan Winiker Date: Wed, 8 Jun 2022 16:01:25 +0200 Subject: [PATCH 3/3] Fix typo --- Modules/Test/classes/class.ilObjTestGUI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Test/classes/class.ilObjTestGUI.php b/Modules/Test/classes/class.ilObjTestGUI.php index 2457c50fdc3f..492ffc44bf8d 100755 --- a/Modules/Test/classes/class.ilObjTestGUI.php +++ b/Modules/Test/classes/class.ilObjTestGUI.php @@ -867,7 +867,7 @@ public function executeCommand() $questionGui->setEditContext(assQuestionGUI::EDIT_CONTEXT_AUTHORING); $questionGui->object->setObjId($this->object->getId()); - if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGUI->object->isInActiveTest()) { + if (in_array($cmd, ['editQuestion', 'save', 'suggestedsolution']) && $questionGui->object->isInActiveTest()) { ilUtil::sendFailure($this->lng->txt("question_is_part_of_running_test"), true); $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW); }