From 9d9a1d64bc5971efdf82378a5ff0dc8372fce46a Mon Sep 17 00:00:00 2001 From: Nils Haagen Date: Wed, 12 Jul 2023 16:08:51 +0200 Subject: [PATCH] TA: QuestionList in mainbar - remove toggle button - show always as mainbar-tools - translate 'Dashboard', remove SideListGUI - move title, username and test-id into header --- .../class.ilTestPlayerLayoutProvider.php | 94 +++--- .../class.ilTestNavigationToolbarGUI.php | 38 --- .../Test/classes/class.ilTestOutputGUI.php | 65 +++-- .../classes/class.ilTestPlayerAbstractGUI.php | 144 ++++------ .../class.ilTestQuestionSideListGUI.php | 271 ------------------ .../Test/classes/class.ilTestServiceGUI.php | 7 + .../default/tpl.il_as_tst_kiosk_head.html | 16 -- .../test/ilTestNavigationToolbarGUITest.php | 9 - .../test/ilTestQuestionSideListGUITest.php | 80 ------ lang/ilias_de.lang | 1 + lang/ilias_en.lang | 5 +- 11 files changed, 174 insertions(+), 556 deletions(-) delete mode 100644 Modules/Test/classes/class.ilTestQuestionSideListGUI.php delete mode 100644 Modules/Test/templates/default/tpl.il_as_tst_kiosk_head.html delete mode 100644 Modules/Test/test/ilTestQuestionSideListGUITest.php diff --git a/Modules/Test/classes/Screen/class.ilTestPlayerLayoutProvider.php b/Modules/Test/classes/Screen/class.ilTestPlayerLayoutProvider.php index 5fe0046113bb..ffcc3a1e516e 100644 --- a/Modules/Test/classes/Screen/class.ilTestPlayerLayoutProvider.php +++ b/Modules/Test/classes/Screen/class.ilTestPlayerLayoutProvider.php @@ -22,6 +22,7 @@ use ILIAS\GlobalScreen\Scope\Layout\Factory\LogoModification; use ILIAS\GlobalScreen\Scope\Layout\Factory\MainBarModification; use ILIAS\GlobalScreen\Scope\Layout\Factory\MetaBarModification; +use ILIAS\GlobalScreen\Scope\Layout\Factory\TitleModification; use ILIAS\GlobalScreen\Scope\Layout\Factory\ShortTitleModification; use ILIAS\GlobalScreen\Scope\Layout\Factory\ViewTitleModification; use ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider; @@ -44,8 +45,10 @@ class ilTestPlayerLayoutProvider extends AbstractModificationProvider implements ModificationProvider { public const TEST_PLAYER_KIOSK_MODE_ENABLED = 'test_player_kiosk_mode_enabled'; - public const TEST_PLAYER_TITLE = 'test_player_kiosk_mode_title'; - public const TEST_PLAYER_SHORT_TITLE = 'test_player_kiosk_mode_instance_name'; + public const TEST_PLAYER_TITLE = 'test_player_title'; + public const TEST_PLAYER_VIEW_TITLE = 'test_player_view_title'; + public const TEST_PLAYER_SHORT_TITLE = 'test_player_instance_name'; + public const TEST_PLAYER_QUESTIONLIST = 'test_player_questionlist'; public function isInterestedInContexts(): ContextCollection @@ -53,49 +56,54 @@ public function isInterestedInContexts(): ContextCollection return $this->context_collection->repository(); } - public function getLogoModification(CalledContexts $called_contexts): ?LogoModification + public function getMainBarModification(CalledContexts $called_contexts): ?MainBarModification { - if ($this->isKioskModeEnabled($called_contexts)) { - $logo = $this->globalScreen()->layout()->factory()->logo(); - - $logo = $logo->withModification(function (?Image $current): ?Image { - return null; - }); + $mainbar = $this->globalScreen()->layout()->factory()->mainbar(); + $additionalData = $called_contexts->current()->getAdditionalData(); + $has_question_list = $additionalData->exists(self::TEST_PLAYER_QUESTIONLIST); + $is_kiosk_mode = $this->isKioskModeEnabled($called_contexts); - return $logo->withHighPriority(); + if (! $is_kiosk_mode && ! $has_question_list) { + return null; } - return null; - } + if ($is_kiosk_mode && ! $has_question_list) { + $mainbar_modification = static fn(?MainBar $mainbar): ?MainBar => null; + } - public function getResponsiveLogoModification(CalledContexts $called_contexts): ?LogoModification - { - if ($this->isKioskModeEnabled($called_contexts)) { - $logo = $this->globalScreen()->layout()->factory()->logo(); + if ($has_question_list) { + $f = $this->dic->ui()->factory(); + $r = $this->dic->ui()->renderer(); + $lng = $this->dic->language(); + $question_listing = $called_contexts->current()->getAdditionalData()->get(self::TEST_PLAYER_QUESTIONLIST); - $logo = $logo->withModification(function (?Image $current): ?Image { - return null; - }); + $mainbar_modification = static function (?MainBar $mainbar) use ($f, $r, $lng, $question_listing, $is_kiosk_mode): ?MainBar { + if ($is_kiosk_mode) { + $mainbar = $mainbar->withClearedEntries(); + } - return $logo->withHighPriority(); - } + $icon = $f->symbol()->icon()->standard('tst', $lng->txt("more")); + $tools_button = $f->button()->bulky($icon, $lng->txt("tools"), "#") + ->withEngagedState(true); - return null; - } + $question_listing = $f->legacy($r->render($question_listing)); - public function getMainBarModification(CalledContexts $called_contexts): ?MainBarModification - { - if ($this->isKioskModeEnabled($called_contexts)) { - $mainBar = $this->globalScreen()->layout()->factory()->mainbar(); + $label = $lng->txt('mainbar_button_label_questionlist'); + $entry = $f->maincontrols()->slate()->legacy( + $label, + $f->symbol()->icon()->standard("tst", $label), + $question_listing + ); - $mainBar = $mainBar->withModification(function (?MainBar $current): ?MainBar { - return null; - }); - - return $mainBar->withHighPriority(); + return $mainbar + ->withToolsButton($tools_button) + ->withAdditionalToolEntry('questionlist', $entry); + }; } - return null; + return $mainbar + ->withModification($mainbar_modification) + ->withHighPriority(); } public function getMetaBarModification(CalledContexts $called_contexts): ?MetaBarModification @@ -157,6 +165,26 @@ function (?string $content) use ($title): ?string { public function getViewTitleModification(CalledContexts $called_contexts): ?ViewTitleModification { if ($this->isKioskModeEnabled($called_contexts)) { + $title = $called_contexts->current()->getAdditionalData()->get(self::TEST_PLAYER_VIEW_TITLE); + if ($title == null) { + $title = ''; + } + return $this->globalScreen()->layout()->factory()->view_title() + ->withModification( + function (?string $content) use ($title): ?string { + return $title; + } + ) + ->withHighPriority(); + } + return null; + } + + public function getTitleModification(CalledContexts $called_contexts): ?TitleModification + { + $additionalData = $called_contexts->current()->getAdditionalData(); + $has_title = $additionalData->exists(self::TEST_PLAYER_TITLE); + if ($has_title) { $title = $called_contexts->current()->getAdditionalData()->get(self::TEST_PLAYER_TITLE); if ($title == null) { $title = ''; diff --git a/Modules/Test/classes/class.ilTestNavigationToolbarGUI.php b/Modules/Test/classes/class.ilTestNavigationToolbarGUI.php index 1dd9d0c9adfc..67f242408689 100644 --- a/Modules/Test/classes/class.ilTestNavigationToolbarGUI.php +++ b/Modules/Test/classes/class.ilTestNavigationToolbarGUI.php @@ -138,22 +138,6 @@ public function setQuestionListButtonEnabled($questionListButtonEnabled) $this->questionListButtonEnabled = $questionListButtonEnabled; } - /** - * @return boolean - */ - public function isQuestionTreeButtonEnabled(): bool - { - return $this->questionTreeButtonEnabled; - } - - /** - * @param boolean $questionTreeButtonEnabled - */ - public function setQuestionTreeButtonEnabled($questionTreeButtonEnabled) - { - $this->questionTreeButtonEnabled = $questionTreeButtonEnabled; - } - /** * @return boolean */ @@ -249,10 +233,6 @@ public function setDisabledStateEnabled($disabledStateEnabled) public function build() { - if ($this->isQuestionTreeButtonEnabled()) { - $this->addQuestionTreeButton(); - } - if ($this->isQuestionListButtonEnabled()) { $this->addQuestionListButton(); } @@ -320,24 +300,6 @@ private function addQuestionSelectionButton() $this->addButtonInstance($btn); } - private function addQuestionTreeButton() - { - $btn = ilTestPlayerNavButton::getInstance(); - $btn->setNextCommand(ilTestPlayerCommands::TOGGLE_SIDE_LIST); - $btn->setUrl($this->ctrl->getLinkTarget( - $this->playerGUI, - ilTestPlayerCommands::TOGGLE_SIDE_LIST - )); - if ($this->isQuestionTreeVisible()) { - $btn->setCaption('tst_hide_side_list'); - } else { - $btn->setCaption('tst_show_side_list'); - } - //$btn->setDisabled($this->isDisabledStateEnabled()); - $btn->addCSSClass('ilTstNavElem'); - $this->addButtonInstance($btn); - } - private function addFinishTestButton(): void { if ($this->userHasAttemptsLeft()) { diff --git a/Modules/Test/classes/class.ilTestOutputGUI.php b/Modules/Test/classes/class.ilTestOutputGUI.php index 2529c6edd813..4b4b80ca910c 100755 --- a/Modules/Test/classes/class.ilTestOutputGUI.php +++ b/Modules/Test/classes/class.ilTestOutputGUI.php @@ -55,23 +55,6 @@ public function executeCommand() $this->initAssessmentSettings(); - $this->global_screen->tool()->context()->current()->addAdditionalData( - ilTestPlayerLayoutProvider::TEST_PLAYER_KIOSK_MODE_ENABLED, - $this->object->getKioskMode() - ); - $this->global_screen->tool()->context()->current()->addAdditionalData( - ilTestPlayerLayoutProvider::TEST_PLAYER_TITLE, - $this->object->getTitle() - ); - $instance_name = $this->settings->get('short_inst_name') ?? ''; - if (trim($instance_name) === '') { - $instance_name = 'ILIAS'; - } - $this->global_screen->tool()->context()->current()->addAdditionalData( - ilTestPlayerLayoutProvider::TEST_PLAYER_SHORT_TITLE, - $instance_name - ); - $testSessionFactory = new ilTestSessionFactory($this->object, $this->db, $this->user); $this->test_session = $testSessionFactory->getSession($this->testrequest->int('active_id')); @@ -92,6 +75,29 @@ public function executeCommand() $this->handlePasswordProtectionRedirect(); + + $instance_name = $this->settings->get('short_inst_name') ?? ''; + if (trim($instance_name) === '') { + $instance_name = 'ILIAS'; + } + $this->global_screen->tool()->context()->current()->addAdditionalData( + ilTestPlayerLayoutProvider::TEST_PLAYER_SHORT_TITLE, + $instance_name + ); + $this->global_screen->tool()->context()->current()->addAdditionalData( + ilTestPlayerLayoutProvider::TEST_PLAYER_KIOSK_MODE_ENABLED, + $this->object->getKioskMode() + ); + $this->global_screen->tool()->context()->current()->addAdditionalData( + ilTestPlayerLayoutProvider::TEST_PLAYER_VIEW_TITLE, + $this->object->getTitle() + ); + $this->global_screen->tool()->context()->current()->addAdditionalData( + ilTestPlayerLayoutProvider::TEST_PLAYER_TITLE, + $this->getTestPlayerTitle() + ); + + $cmd = $this->getCommand($cmd); switch ($next_class) { @@ -967,4 +973,29 @@ protected function handlePrimaryButton(ilTestNavigationToolbarGUI $navigationToo return $isNextPrimary; } + + protected function getTestPlayerTitle(): string + { + $test_title = $this->object->getShowKioskModeTitle() ? $this->object->getTitle() : ''; + $user_name = $this->object->getShowKioskModeParticipant() ? $this->user->getFullname() : ''; + $exam_id = ''; + if ($this->object->isShowExamIdInTestPassEnabled()) { + $exam_id = $this->lng->txt("exam_id") + . ' ' + . ilObjTest::buildExamId( + $this->test_session->getActiveId(), + $this->test_session->getPass(), + $this->object->getId() + ); + } + + $layout = $this->ui_factory->layout()->alignment()->vertical( + $this->ui_factory->legacy($test_title), + $this->ui_factory->layout()->alignment()->horizontal()->dynamicallyDistributed( + $this->ui_factory->legacy($user_name), + $this->ui_factory->legacy($exam_id) + ) + ); + return $this->ui_renderer->render($layout); + } } diff --git a/Modules/Test/classes/class.ilTestPlayerAbstractGUI.php b/Modules/Test/classes/class.ilTestPlayerAbstractGUI.php index ebc5f5e70822..1a1d4dd0589f 100755 --- a/Modules/Test/classes/class.ilTestPlayerAbstractGUI.php +++ b/Modules/Test/classes/class.ilTestPlayerAbstractGUI.php @@ -608,13 +608,6 @@ protected function submitIntermediateSolutionCmd() $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION); } - public function toggleSideListCmd(): void - { - $show_side_list = $this->user->getPref('side_list_of_questions'); - $this->user->writePref('side_list_of_questions', (string) !$show_side_list); - $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION); - } - protected function markQuestionAndSaveIntermediateCmd(): void { $this->handleIntermediateSubmit(); @@ -824,45 +817,6 @@ public function showFinalStatementCmd() $this->tpl->setVariable($this->getContentBlockName(), $template->get()); } - public function getKioskHead(): string - { - /** - * this is an abomination for release_8 + release_9! - * @todo Implement proper "kiosk-handling" for ILIAS 10. - */ - $this->tpl->addCSS('Modules/Test/templates/default/test_kiosk_header.css'); - //end of hack - - $template = new ilTemplate('tpl.il_as_tst_kiosk_head.html', true, true, 'Modules/Test'); - if ($this->object->getShowKioskModeTitle()) { - $template->setCurrentBlock("kiosk_show_title"); - $template->setVariable("TEST_TITLE", $this->object->getTitle()); - $template->parseCurrentBlock(); - } - if ($this->object->getShowKioskModeParticipant()) { - $template->setCurrentBlock("kiosk_show_participant"); - $template->setVariable("PARTICIPANT_NAME_TXT", $this->lng->txt("login_as")); - $template->setVariable("PARTICIPANT_NAME", $this->user->getFullname()); - $template->setVariable("PARTICIPANT_LOGIN", $this->user->getLogin()); - $template->setVariable("PARTICIPANT_MATRICULATION", $this->user->getMatriculation()); - $template->setVariable("PARTICIPANT_EMAIL", $this->user->getEmail()); - $template->parseCurrentBlock(); - } - if ($this->object->isShowExamIdInTestPassEnabled()) { - $exam_id = ilObjTest::buildExamId( - $this->test_session->getActiveId(), - $this->test_session->getPass(), - $this->object->getId() - ); - - $template->setCurrentBlock("kiosk_show_exam_id"); - $template->setVariable("EXAM_ID_TXT", $this->lng->txt("exam_id")); - $template->setVariable("EXAM_ID", $exam_id); - $template->parseCurrentBlock(); - } - return $template->get(); - } - protected function prepareTestPage($presentationMode, $sequenceElement, $questionId) { $this->navigation_history->addItem( @@ -891,12 +845,9 @@ protected function prepareTestPage($presentationMode, $sequenceElement, $questio return; } - if ($this->object->getKioskMode()) { - $this->populateKioskHead(); - } - $this->tpl->setVariable("TEST_ID", (string) $this->object->getTestId()); $this->tpl->setVariable("LOGIN", $this->user->getLogin()); + $this->tpl->setVariable("SEQ_ID", $sequenceElement); $this->tpl->setVariable("QUEST_ID", $questionId); @@ -981,7 +932,7 @@ protected function showQuestionEditable(assQuestionGUI $questionGui, $formAction $questionNavigationGUI->setDiscardSolutionButtonEnabled(true); // fau: testNav - set answere status in question header $questionGui->getQuestionHeaderBlockBuilder()->setQuestionAnswered(true); - // fau. + // fau. } elseif ($this->object->isPostponingEnabled()) { $questionNavigationGUI->setSkipQuestionLinkTarget( $this->ctrl->getLinkTarget($this, ilTestPlayerCommands::SKIP_QUESTION) @@ -1295,20 +1246,63 @@ public function checkWorkingTimeCmd(): void protected function showSideList($current_sequence_element): void { $side_list_active = $this->user->getPref('side_list_of_questions'); - if (!$side_list_active) { return; } + if ($side_list_active) { + $questionSummaryData = $this->service->getQuestionSummaryData($this->testSequence, false); + + //TODO + global $DIC; + $f = $DIC['ui.factory']; + $lng = $DIC['lng']; + $ctrl = $DIC['ilCtrl']; + $questions = []; + + $active = 0; + foreach ($questionSummaryData as $idx => $row) { + $title = ilLegacyFormElementsUtil::prepareFormOutput($row['title']); + if (strlen($row['description'])) { + $description = " title=\"" . htmlspecialchars($row['description']) . "\" "; + } else { + $description = ""; + } + + if (!$row['disabled']) { + $ctrl->setParameter($this, 'pmode', ''); + $ctrl->setParameter($this, 'sequence', $row['sequence']); + $action = $ctrl->getLinkTarget($this, ilTestPlayerCommands::SHOW_QUESTION); + $ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW); + $ctrl->setParameter($this, 'sequence', $this->getCurrentSequenceElement($current_sequence_element)); + } + + $status = ILIAS\UI\Component\Listing\Workflow\Step::NOT_STARTED; - $question_summary_data = $this->service->getQuestionSummaryData($this->testSequence, false); + if ($row['worked_through'] + || $row['isAnswered'] + //|| $row['sequence'] == $current_sequence_element - $question_side_list_gui = new ilTestQuestionSideListGUI($this->ctrl, $this->lng); - $question_side_list_gui->setTargetGUI($this); - $question_side_list_gui->setQuestionSummaryData($question_summary_data); - $question_side_list_gui->setCurrentSequenceElement($current_sequence_element); - $question_side_list_gui->setCurrentPresentationMode(ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW); - $question_side_list_gui->setDisabled(false); - $this->tpl->setVariable('LIST_OF_QUESTIONS', $question_side_list_gui->getHTML()); + ) { + $status = ILIAS\UI\Component\Listing\Workflow\Step::IN_PROGRESS; + } + + + $questions[] = $f->listing()->workflow()->step($title, $description, $action) + ->withStatus($status); + $active = $row['sequence'] == $current_sequence_element ? $idx : $active; + } + + $question_listing = $f->listing()->workflow()->linear( + $this->lng->txt('mainbar_button_label_questionlist'), + $questions + )->withActive($active); + + + $this->global_screen->tool()->context()->current()->addAdditionalData( + ilTestPlayerLayoutProvider::TEST_PLAYER_QUESTIONLIST, + $question_listing + ); + } } abstract protected function isQuestionSummaryFinishTestButtonRequired(); @@ -1339,16 +1333,6 @@ public function outQuestionSummaryCmd( $this->tpl->setOnScreenMessage('failure', $this->lng->txt('not_all_obligations_answered')); } - if ($this->object->getKioskMode() && $fullpage) { - $head = $this->getKioskHead(); - if (strlen($head)) { - $this->tpl->setCurrentBlock("kiosk_options"); - $this->tpl->setVariable("KIOSK_HEAD", $head); - $this->tpl->parseCurrentBlock(); - } - } - - $active_id = $this->test_session->getActiveId(); $questionSummaryData = $this->service->getQuestionSummaryData($this->testSequence, $obligationsFilter); @@ -1595,10 +1579,6 @@ protected function prepareSummaryPage() 'tpl.il_as_tst_question_summary.html', 'Modules/Test' ); - - if ($this->object->getKioskMode()) { - $this->populateKioskHead(); - } } protected function initTestPageTemplate() @@ -1629,17 +1609,6 @@ protected function initTestPageTemplate() ); } - protected function populateKioskHead() - { - $head = $this->getKioskHead(); - - if (strlen($head)) { - $this->tpl->setCurrentBlock("kiosk_options"); - $this->tpl->setVariable("KIOSK_HEAD", $head); - $this->tpl->parseCurrentBlock(); - } - } - protected function handlePasswordProtectionRedirect() { /** @@ -1782,13 +1751,9 @@ protected function populateHelperGuiContent($helperGui) protected function getTestNavigationToolbarGUI(): ilTestNavigationToolbarGUI { $navigation_toolbar = new ilTestNavigationToolbarGUI($this->ctrl, $this->lng, $this); - $navigation_toolbar->setSuspendTestButtonEnabled($this->object->getShowCancel()); - $navigation_toolbar->setQuestionTreeButtonEnabled($this->object->getListOfQuestions()); - $navigation_toolbar->setQuestionTreeVisible((bool) $this->user->getPref('side_list_of_questions')); $navigation_toolbar->setQuestionListButtonEnabled($this->object->getListOfQuestions()); $navigation_toolbar->setFinishTestCommand($this->getFinishTestCommand()); - return $navigation_toolbar; } @@ -2242,7 +2207,6 @@ protected function getQuestionInstance(int $question_id, bool $from_cache = true if ($from_cache && isset($this->cachedQuestionObjects[$question_id])) { return $this->cachedQuestionObjects[$question_id]; } - $question = assQuestion::_instantiateQuestion($question_id); $ass_settings = new ilSetting('assessment'); diff --git a/Modules/Test/classes/class.ilTestQuestionSideListGUI.php b/Modules/Test/classes/class.ilTestQuestionSideListGUI.php deleted file mode 100644 index 1a2c88927499..000000000000 --- a/Modules/Test/classes/class.ilTestQuestionSideListGUI.php +++ /dev/null @@ -1,271 +0,0 @@ - - * @version $Id$ - * - * @package Modules/Test - */ -class ilTestQuestionSideListGUI -{ - /** - * @var ilCtrl - */ - protected $ctrl; - - /** - * @var ilLanguage - */ - protected $lng; - - /** - * @var ilTestPlayerAbstractGUI - */ - private $targetGUI; - - /** - * @var array - */ - private $questionSummaryData; - - /** - * @var integer - */ - private $currentSequenceElement; - - /** - * @var string - */ - private $currentPresentationMode; - - /** - * @var bool - */ - private $disabled; - - /** - * @param ilCtrl $ctrl - * @param ilLanguage $lng - */ - public function __construct(ilCtrl $ctrl, ilLanguage $lng) - { - $this->ctrl = $ctrl; - $this->lng = $lng; - - $this->questionSummaryData = array(); - $this->currentSequenceElement = null; - $this->disabled = false; - } - - /** - * @return ilTestPlayerAbstractGUI - */ - public function getTargetGUI(): ilTestPlayerAbstractGUI - { - return $this->targetGUI; - } - - /** - * @param ilTestPlayerAbstractGUI $targetGUI - */ - public function setTargetGUI($targetGUI) - { - $this->targetGUI = $targetGUI; - } - - /** - * @return array - */ - public function getQuestionSummaryData(): array - { - return $this->questionSummaryData; - } - - /** - * @param array $questionSummaryData - */ - public function setQuestionSummaryData($questionSummaryData) - { - $this->questionSummaryData = $questionSummaryData; - } - - /** - * @return int - */ - public function getCurrentSequenceElement(): ?int - { - return $this->currentSequenceElement; - } - - /** - * @param int $currentSequenceElement - */ - public function setCurrentSequenceElement($currentSequenceElement) - { - $this->currentSequenceElement = $currentSequenceElement; - } - - /** - * @return string - */ - public function getCurrentPresentationMode(): string - { - return $this->currentPresentationMode; - } - - /** - * @param string $currentPresentationMode - */ - public function setCurrentPresentationMode($currentPresentationMode) - { - $this->currentPresentationMode = $currentPresentationMode; - } - - /** - * @return boolean - */ - public function isDisabled(): bool - { - return $this->disabled; - } - - /** - * @param boolean $disabled - */ - public function setDisabled($disabled) - { - $this->disabled = $disabled; - } - - /** - * @return ilPanelGUI - */ - private function buildPanel(): ilPanelGUI - { - $panel = ilPanelGUI::getInstance(); - $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_SUBHEADING); - $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY); - $panel->setHeading($this->lng->txt('list_of_questions')); - return $panel; - } - - /** - * @return string - */ - private function renderList(): string - { - $tpl = new ilTemplate('tpl.il_as_tst_list_of_questions_short.html', true, true, 'Modules/Test'); - - foreach ($this->getQuestionSummaryData() as $row) { - $title = ilLegacyFormElementsUtil::prepareFormOutput($row['title']); - - if (strlen($row['description'])) { - $description = " title=\"" . htmlspecialchars($row['description']) . "\" "; - } else { - $description = ""; - } - - $active = ($row['sequence'] == $this->getCurrentSequenceElement()) ? ' active' : ''; - - $class = ( - $row['worked_through'] ? 'answered' . $active : 'unanswered' . $active - ); - - $headerclass = ($row['sequence'] == $this->getCurrentSequenceElement()) ? 'bold' : ''; - - if ($row['marked']) { - $tpl->setCurrentBlock("mark_icon"); - $tpl->setVariable("ICON_SRC", ilUtil::getImagePath('marked.svg')); - $tpl->setVariable("ICON_TEXT", $this->lng->txt('tst_question_marked')); - $tpl->setVariable("ICON_CLASS", 'ilTestMarkQuestionIcon'); - $tpl->parseCurrentBlock(); - } - - if ($this->isDisabled() || $row['disabled']) { - $tpl->setCurrentBlock('disabled_entry'); - $tpl->setVariable('CLASS', $class); - $tpl->setVariable('HEADERCLASS', $headerclass); - $tpl->setVariable('ITEM', $title); - $tpl->setVariable('DESCRIPTION', $description); - $tpl->parseCurrentBlock(); - } else { - // fau: testNav - show mark icon in side list - // fau. - $tpl->setCurrentBlock('linked_entry'); - $tpl->setVariable('HREF', $this->buildLink($row['sequence'])); - $tpl->setVariable('NEXTCMD', ilTestPlayerCommands::SHOW_QUESTION); - $tpl->setVariable('NEXTSEQ', $row['sequence']); - $tpl->setVariable('HEADERCLASS', $headerclass); - $tpl->setVariable('CLASS', $class); - $tpl->setVariable('ITEM', $title); - $tpl->setVariable("DESCRIPTION", $description); - $tpl->parseCurrentBlock(); - } - - $tpl->setCurrentBlock('item'); - } - - return $tpl->get(); - } - - /** - * @return string - */ - public function getHTML(): string - { - $panel = $this->buildPanel(); - $panel->setBody($this->renderList()); - return $panel->getHTML(); - } - - /** - * @param $row - * @return string - */ - private function buildLink($sequenceElement): string - { - $this->ctrl->setParameter( - $this->getTargetGUI(), - 'pmode', - '' - ); - - $this->ctrl->setParameter( - $this->getTargetGUI(), - 'sequence', - $sequenceElement - ); - - $href = $this->ctrl->getLinkTarget($this->getTargetGUI(), ilTestPlayerCommands::SHOW_QUESTION); - - $this->ctrl->setParameter( - $this->getTargetGUI(), - 'pmode', - $this->getCurrentPresentationMode() - ); - $this->ctrl->setParameter( - $this->getTargetGUI(), - 'sequence', - $this->getCurrentSequenceElement() - ); - return $href; - } -} diff --git a/Modules/Test/classes/class.ilTestServiceGUI.php b/Modules/Test/classes/class.ilTestServiceGUI.php index 0f2d48634ac2..45c884e93dca 100755 --- a/Modules/Test/classes/class.ilTestServiceGUI.php +++ b/Modules/Test/classes/class.ilTestServiceGUI.php @@ -68,6 +68,13 @@ class ilTestServiceGUI protected HTTPServices $http; protected ilCtrl $ctrl; protected ilToolbarGUI $toolbar; + +/* + public ilLanguage $lng; + public ilGlobalTemplateInterface|ilTemplate $tpl; + public ilCtrl $ctrl; +*/ + protected ilTabsGUI $tabs; protected ilObjectDataCache $obj_cache; protected ilComponentRepository $component_repository; diff --git a/Modules/Test/templates/default/tpl.il_as_tst_kiosk_head.html b/Modules/Test/templates/default/tpl.il_as_tst_kiosk_head.html deleted file mode 100644 index 39abcfbf3b4e..000000000000 --- a/Modules/Test/templates/default/tpl.il_as_tst_kiosk_head.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
- -{TEST_TITLE} - -
-
- -{PARTICIPANT_NAME} - - -
-{EXAM_ID_TXT} {EXAM_ID} - -
-
\ No newline at end of file diff --git a/Modules/Test/test/ilTestNavigationToolbarGUITest.php b/Modules/Test/test/ilTestNavigationToolbarGUITest.php index 4712aa1a5913..1ee789738f59 100644 --- a/Modules/Test/test/ilTestNavigationToolbarGUITest.php +++ b/Modules/Test/test/ilTestNavigationToolbarGUITest.php @@ -62,15 +62,6 @@ public function testQuestionListButtonEnabled(): void $this->assertTrue($this->testObj->isQuestionListButtonEnabled()); } - public function testQuestionTreeButtonEnabled(): void - { - $this->testObj->setQuestionTreeButtonEnabled(false); - $this->assertFalse($this->testObj->isQuestionTreeButtonEnabled()); - - $this->testObj->setQuestionTreeButtonEnabled(true); - $this->assertTrue($this->testObj->isQuestionTreeButtonEnabled()); - } - public function testQuestionTreeVisible(): void { $this->testObj->setQuestionTreeVisible(false); diff --git a/Modules/Test/test/ilTestQuestionSideListGUITest.php b/Modules/Test/test/ilTestQuestionSideListGUITest.php deleted file mode 100644 index 01e74cca21f4..000000000000 --- a/Modules/Test/test/ilTestQuestionSideListGUITest.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ -class ilTestQuestionSideListGUITest extends ilTestBaseTestCase -{ - private ilTestQuestionSideListGUI $testObj; - - protected function setUp(): void - { - parent::setUp(); - - $this->testObj = new ilTestQuestionSideListGUI( - $this->createMock(ilCtrl::class), - $this->createMock(ilLanguage::class) - ); - } - - public function test_instantiateObject_shouldReturnInstance(): void - { - $this->assertInstanceOf(ilTestQuestionSideListGUI::class, $this->testObj); - } - - public function testTargetGUI(): void - { - $targetGui_mock = $this->createMock(ilTestPlayerAbstractGUI::class); - $this->testObj->setTargetGUI($targetGui_mock); - $this->assertEquals($targetGui_mock, $this->testObj->getTargetGUI()); - } - - public function testQuestionSummaryData(): void - { - $expected = [ - "test" => "Hello", - ]; - $this->testObj->setQuestionSummaryData($expected); - $this->assertEquals($expected, $this->testObj->getQuestionSummaryData()); - } - - public function testCurrentSequenceElement(): void - { - $this->testObj->setCurrentSequenceElement(125); - $this->assertEquals(125, $this->testObj->getCurrentSequenceElement()); - } - - public function testCurrentPresentationMode(): void - { - $this->testObj->setCurrentPresentationMode("test"); - $this->assertEquals("test", $this->testObj->getCurrentPresentationMode()); - } - - public function testDisabled(): void - { - $this->testObj->setDisabled(false); - $this->assertFalse($this->testObj->isDisabled()); - - $this->testObj->setDisabled(true); - $this->assertTrue($this->testObj->isDisabled()); - } -} diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index b0ea32d9fef8..3eebfc629b46 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -848,6 +848,7 @@ assessment#:#longmenu_answeroptions_differ#:#Diese Frage funktioniert nicht rich assessment#:#longmenu_text#:#‘Long Menu’-Text assessment#:#mailnottype#:#Ein Versand findet auch beim Beenden einzelner Testdurchläufe statt assessment#:#mailnottype_desc#:#Der Besitzer des Tests wird auch dann benachrichtigt, wenn die Anzahl Durchläufe nicht beschränkt ist. +assessment#:#mainbar_button_label_questionlist#:#Fragenliste assessment#:#maintenance#:#Wartung assessment#:#manscoring#:#Manuelle Bewertung assessment#:#manscoring_done#:#Bereits bewertete Teilnehmer diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 1505545892f2..ff89f65e1ae7 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -848,6 +848,7 @@ assessment#:#longmenu_answeroptions_differ#:#This question does not work correct assessment#:#longmenu_text#:#Long Menu Text assessment#:#mailnottype#:#Send a notification every time a test attempt is completed. assessment#:#mailnottype_desc#:#Notify the owner of the test even if the number of test attempts has not been limited. +assessment#:#mainbar_button_label_questionlist#:#Questionlist assessment#:#maintenance#:#Maintenance assessment#:#manscoring#:#Manual Scoring assessment#:#manscoring_done#:#Scored Participants @@ -1077,8 +1078,8 @@ assessment#:#question_marking#:#Flagging Questions assessment#:#question_marking_description#:#Participants are given the option to flag test questions for themselves. The flags are shown in the ‘List of Questions’, if that feature it has been activated. assessment#:#question_not_answered#:#The question was not answered assessment#:#question_saved_for_upload#:#The question was saved automatically in order to reserve hard disk space to store the uploaded file. If you cancel this form now, be aware that you must delete the question in the question pool if you do not want to keep it! -assessment#:#question_summary#:#Dashboard -assessment#:#question_summary_btn#:#Dashboard +assessment#:#question_summary#:#Test Pass Overview +assessment#:#question_summary_btn#:#Test Pass Overview assessment#:#question_title#:#Question Title assessment#:#question_type#:#Question Type assessment#:#questionpool_not_entered#:#Please enter a name for a question pool!