From d3700e0a440295e25a9acde1890279c7675d72fd Mon Sep 17 00:00:00 2001 From: Matheus Zych Date: Tue, 6 Jan 2026 14:07:38 +0100 Subject: [PATCH] Fixes redirect to blank page when resuming a test and error that a started test pass does not contain any questions --- .../Objectives/class.ilLOTestQuestionAdapter.php | 12 ++++++++---- .../Test/src/Presentation/class.TestScreenGUI.php | 14 ++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/components/ILIAS/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php b/components/ILIAS/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php index 28b08c62673b..5f168ae418b0 100755 --- a/components/ILIAS/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php +++ b/components/ILIAS/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php @@ -1,4 +1,5 @@ updateQuestions($a_test_session, $a_test_sequence); - if ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::MARK_PASSED_OBJECTIVE_QST) { - $this->setQuestionsOptional($a_test_sequence); - } elseif ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) { - $this->hideQuestions($a_test_sequence); + if ($this->getSettings()->getQualifiedTest() === $a_test_session->getRefId()) { + $passed_objective_mode = $this->getSettings()->getPassedObjectiveMode(); + if ($passed_objective_mode === ilLOSettings::MARK_PASSED_OBJECTIVE_QST) { + $this->setQuestionsOptional($a_test_sequence); + } elseif ($passed_objective_mode === ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) { + $this->hideQuestions($a_test_sequence); + } } $this->storeTestRun(); diff --git a/components/ILIAS/Test/src/Presentation/class.TestScreenGUI.php b/components/ILIAS/Test/src/Presentation/class.TestScreenGUI.php index fd353703c0c7..d4ef0c548762 100755 --- a/components/ILIAS/Test/src/Presentation/class.TestScreenGUI.php +++ b/components/ILIAS/Test/src/Presentation/class.TestScreenGUI.php @@ -291,8 +291,11 @@ private function getLauncher(): Launcher private function getResumeLauncherLink(): Link { - $url = $this->ctrl->getLinkTarget( - (new \ilTestPlayerFactory($this->object))->getPlayerGUI(), + $class = $this->object->isFixedTest() + ? \ilTestPlayerFixedQuestionSetGUI::class + : \ilTestPlayerRandomQuestionSetGUI::class; + $url = $this->ctrl->getLinkTargetByClass( + [\ilRepositoryGUI::class, \ilObjTestGUI::class, $class], \ilTestPlayerCommands::RESUME_PLAYER ); return $this->data_factory->link($this->lng->txt('tst_resume_test'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url)); @@ -391,8 +394,11 @@ private function getModalLauncherMessageBox(): ?MessageBox private function getStartLauncherLink(): Link { - $url = $this->ctrl->getLinkTarget( - (new \ilTestPlayerFactory($this->object))->getPlayerGUI(), + $class = $this->object->isFixedTest() + ? \ilTestPlayerFixedQuestionSetGUI::class + : \ilTestPlayerRandomQuestionSetGUI::class; + $url = $this->ctrl->getLinkTargetByClass( + [\ilRepositoryGUI::class, \ilObjTestGUI::class, $class], \ilTestPlayerCommands::INIT_TEST ); return $this->data_factory->link($this->lng->txt('tst_exam_start'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));