ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
TabsManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
33{
38 public const TAB_ID_QUESTIONS = 'assQuestions';
39 public const SUBTAB_ID_QST_LIST_VIEW = 'qst_list_view';
40 public const SUBTAB_ID_QST_PAGE_VIEW = 'qst_page_view';
41
42 public const TAB_ID_TEST = 'test';
43 public const TAB_ID_INFOSCREEN = 'info_short';
44 public const TAB_ID_SETTINGS = 'settings';
45 public const SUBTAB_ID_GENERAL_SETTINGS = 'general';
46 public const TAB_ID_LEARNING_PROGRESS = 'learning_progress';
47 public const TAB_ID_MANUAL_SCORING = 'manscoring';
48 public const TAB_ID_CORRECTION = 'scoringadjust';
49 public const TAB_ID_HISTORY = 'history';
50 public const TAB_ID_META_DATA = 'meta_data';
51 public const TAB_ID_EXPORT = 'export';
52 public const TAB_ID_PERMISSIONS = 'perm_settings';
53
54 public const TAB_ID_PARTICIPANTS = 'participants';
55
56 public const TAB_ID_YOUR_RESULTS = 'your_results';
57 public const SUBTAB_ID_MY_RESULTS = 'myresults';
58 public const SUBTAB_ID_LO_RESULTS = 'loresults';
59 public const SUBTAB_ID_HIGHSCORE = 'highscore';
60 public const SUBTAB_ID_SKILL_RESULTS = 'skillresults';
61 public const SUBTAB_ID_MY_SOLUTIONS = 'mysolutions';
62
63 private const SETTINGS_SUBTAB_ID_GENERAL = 'general';
64 public const SETTINGS_SUBTAB_ID_MARK_SCHEMA = 'mark_schema';
65 public const SETTINGS_SUBTAB_ID_SCORING = 'scoring';
66 public const SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE = 'edit_introduction';
67 public const SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE = 'edit_concluding_remarks';
68 private const SETTINGS_SUBTAB_ID_CERTIFICATE = 'certificate';
69 public const SETTINGS_SUBTAB_ID_ASSIGN_SKILL_TRESHOLDS = 'tst_skl_sub_tab_thresholds';
70 public const SETTINGS_SUBTAB_ID_ASSIGN_SKILLS_TO_QUESTIONS = 'qpl_skl_sub_tab_quest_assign';
71 private const SETTINGS_SUBTAB_ID_PERSONAL_DEFAULT_SETTINGS = 'personal_settings_templates_available';
72
73 private const QUESTIONS_SUBTAB_ID_RANDOM_SETTINGS = 'tst_rnd_quest_cfg_tab_general';
74 private const QUESTIONS_SUBTAB_ID_RANDOM_POOLS = 'tst_rnd_quest_cfg_tab_pool';
75
76 protected ?string $parent_back_href = null;
77 protected ?string $parent_back_label = null;
78
79 public function __construct(
80 private readonly \ilTabsGUI $tabs,
81 private readonly \ilLanguage $lng,
82 private readonly \ilCtrlInterface $ctrl,
83 private readonly \ilAccess $access,
84 private readonly \ilTestAccess $test_access,
85 private readonly \ilObjTest $test_object,
86 private readonly \ilTestObjectiveOrientedContainer $objective_parent,
87 private readonly \ilTestSession $test_session
88 ) {
89 }
90
91 public function activateTab(string $tab_id): void
92 {
93 switch ($tab_id) {
107 $this->tabs->activateTab($tab_id);
108 }
109 }
110
111 public function activateSubTab(string $sub_tab_id): void
112 {
113 switch ($sub_tab_id) {
119
124
134 $this->tabs->activateSubTab($sub_tab_id);
135 }
136 }
137
138 public function resetTabsAndAddBacklink(string $back_link_target): void
139 {
140 $this->tabs->clearTargets();
141 $this->tabs->setBackTarget($this->lng->txt('back'), $back_link_target);
142 }
143
144 public function getParentBackLabel(): ?string
145 {
147 }
148
149 public function setParentBackLabel(?string $parent_back_label)
150 {
151 $this->parent_back_label = $parent_back_label;
152 }
153
154 public function getParentBackHref(): ?string
155 {
157 }
158
159 public function setParentBackHref(?string $parent_back_href): void
160 {
161 $this->parent_back_href = $parent_back_href;
162 }
163
164 public function hasParentBackLink(): bool
165 {
166 if ($this->getParentBackHref() === null) {
167 return false;
168 }
169
170 if ($this->getParentBackLabel() === null) {
171 return false;
172 }
173
174 return true;
175 }
176
177 protected function isReadAccessGranted(): bool
178 {
179 return $this->access->checkAccess('read', '', $this->test_object->getRefId());
180 }
181
182 protected function isWriteAccessGranted(): bool
183 {
184 return $this->access->checkAccess('write', '', $this->test_object->getRefId());
185 }
186
187 protected function isHistoryAccessGranted(): bool
188 {
189 return $this->test_object->getTestLogger()->isLoggingEnabled()
190 && $this->access->checkAccess('tst_history_read', '', $this->test_object->getRefId());
191 }
192
193 protected function isPermissionsAccessGranted(): bool
194 {
195 return $this->access->checkAccess('edit_permission', '', $this->test_object->getRefId());
196 }
197
198 protected function isLpAccessGranted(): bool
199 {
200 if (!$this->test_access->getAccess()->checkAccess('read', '', $this->test_object->getRefId())) {
201 return false;
202 }
203
204 return \ilLearningProgressAccess::checkAccess($this->test_object->getRefId());
205 }
206
207 protected function checkParticipantsTabAccess(): bool
208 {
209 if ($this->test_access->checkManageParticipantsAccess()
210 || $this->test_access->checkParticipantsResultsAccess()) {
211 return true;
212 }
213
214 return false;
215 }
216
217 protected function checkScoreParticipantsTabAccess(): bool
218 {
219 return $this->test_access->checkScoreParticipantsAccess()
220 || $this->test_access->checkScoreParticipantsAccessAnon();
221 }
222
223 public function perform(): void
224 {
225 if ($this->isTabsConfigSetupRequired()) {
226 $this->setupTabsGuiConfig();
227 }
228 }
229
230 protected function isTabsConfigSetupRequired(): bool
231 {
232 if (preg_match('/^ass(.*?)gui$/i', $this->ctrl->getNextClass($this))) {
233 return false;
234 }
235
236 if ($this->ctrl->getNextClass($this) == 'ilassquestionpagegui') {
237 return false;
238 }
239
240 if ($this->ctrl->getCmdClass() == 'iltestoutputgui') {
241 return false;
242 }
243
244 if ($this->ctrl->getCmdClass() == 'iltestevaluationgui') {
245 return in_array($this->ctrl->getCmd(), [
246 '', 'outUserResultsPassOverview', 'outUserListOfAnswerPasses', 'singleResults'
247 ]);
248 }
249
250 return true;
251 }
252
253 protected function setupTabsGuiConfig(): void
254 {
255 if ($this->hasParentBackLink()) {
256 $this->tabs->setBack2Target($this->getParentBackLabel(), $this->getParentBackHref());
257 }
258
259 $class_path = $this->ctrl->getCurrentClassPath();
260
261 switch (array_pop($class_path)) {
262 case MarkSchemaGUI::class:
263 case SettingsMainGUI::class:
264 case SettingsScoringGUI::class:
265
266 if ($this->isWriteAccessGranted()) {
267 $this->getSettingsSubTabs();
268 }
269
270 break;
271 }
272
273 switch ($this->ctrl->getCmd()) {
274 case 'resume':
275 case 'previous':
276 case 'next':
277 case 'summary':
278 case 'directfeedback':
279 case 'finishTest':
280 case 'outCorrectSolution':
281 case 'showAnswersOfUser':
282 case 'backFromSummary':
283 case 'show_answers':
284 case 'setsolved':
285 case 'resetsolved':
286 case 'confirmFinish':
287 case 'outTestSummary':
288 case 'outQuestionSummary':
289 case 'gotoQuestion':
290 case 'selectImagemapRegion':
291 case 'confirmSubmitAnswers':
292 case 'finalSubmission':
293 case 'postpone':
294 case 'outUserPassDetails':
295 case 'checkPassword':
296 case 'exportCertificate':
297 case 'finishListOfAnswers':
298 case 'backConfirmFinish':
299 case 'showFinalStatement':
300 return;
301 case 'browseForQuestions':
302 case 'filter':
303 case 'resetFilter':
304 case 'resetTextFilter':
305 case 'insertQuestions':
306 $classes = [
307 'iltestdashboardgui',
308 'iltestresultsgui',
309 'illearningprogressgui' // #8497: resetfilter is also used in lp
310 ];
311 if (!in_array($this->ctrl->getNextClass($this), $classes)) {
313 }
314 break;
315 case 'scoring':
316 case 'certificate':
317 case 'certificateservice':
318 case 'certificateImport':
319 case 'certificateUpload':
320 case 'certificateEditor':
321 case 'certificateDelete':
322 case 'certificateSave':
323 case 'showTemplates':
324 case 'createTemplate':
325 case 'inviteParticipants':
326 case 'searchParticipants':
327 if ($this->isWriteAccessGranted() && in_array(strtolower($this->ctrl->getCmdClass()), ['ilobjtestgui', 'ilcertificategui'])) {
328 $this->getSettingsSubTabs();
329 }
330 break;
331 case 'export':
332 case 'print':
333 break;
334 }
335
336 // test tab
337 if ($this->isReadAccessGranted()) {
338 $this->tabs->addTab(
339 self::TAB_ID_TEST,
340 $this->lng->txt('test'),
341 $this->ctrl->getLinkTargetByClass(
342 [
343 \ilObjTestGUI::class, TestScreenGUI::class],
345 )
346 );
347 }
348
349 // info tab
350 if ($this->isReadAccessGranted()
351 && !$this->test_object->getMainSettings()->getAdditionalSettings()->getHideInfoTab()) {
352 $this->tabs->addTarget(
353 'info_short',
354 $this->ctrl->getLinkTargetByClass(
355 [
356 \ilRepositoryGUI::class,
357 \ilObjTestGUI::class,
358 \ilInfoScreenGUI::class
359 ]
360 ),
361 ['', 'outIntroductionPage', 'setAnonymousId', 'redirectToInfoScreen']
362 );
363 }
364
365 // settings tab
366 if ($this->isWriteAccessGranted()) {
367 $settingsCommands = [
368 'marks', 'showMarkSchema','addMarkStep', 'deleteMarkSteps',
369 'resetToSimpleMarkSchema', 'saveMarks', 'certificate',
370 'certificateEditor', 'certificateSave',
371 'certificatePreview', 'certificateDelete', 'certificateUpload', 'certificateImport',
372 'scoring', 'showTemplates', 'createTemplate',
373 'inviteParticipants', 'saveFixedParticipantsStatus', 'searchParticipants', 'addParticipants' // ARE THEY RIGHT HERE
374 ];
375
376 $reflection = new \ReflectionClass(SettingsMainGUI::class);
377 foreach ($reflection->getConstants() as $name => $value) {
378 if (substr($name, 0, 4) === 'CMD_') {
379 $settingsCommands[] = $value;
380 }
381 }
382
383 $reflection = new \ReflectionClass(SettingsScoringGUI::class);
384 foreach ($reflection->getConstants() as $name => $value) {
385 if (substr($name, 0, 4) === 'CMD_') {
386 $settingsCommands[] = $value;
387 }
388 }
389
390 $settingsCommands[] = ''; // DO NOT KNOW WHAT THIS IS DOING, BUT IT'S REQUIRED
391
392 $this->tabs->addTarget(
393 'settings',
394 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, SettingsMainGUI::class]),
395 $settingsCommands,
396 [
397 'ilmarkschemagui',
398 'ilobjtestsettingsmaingui',
399 'ilobjtestsettingsscoringresultsgui',
400 'ilobjtestgui',
401 'ilcertificategui'
402 ]
403 );
404 }
405
406 if ($this->test_object->isFixedTest()) {
407 $target = $this->ctrl->getLinkTargetByClass(
408 \ilObjTestGUI::class,
410 );
411 }
412
413 if ($this->test_object->isRandomTest()) {
414 $target = $this->ctrl->getLinkTargetByClass(\ilTestRandomQuestionSetConfigGUI::class);
415 }
416
417 if ($this->isWriteAccessGranted()) {
418 $this->tabs->addTarget(
419 'assQuestions',
420 $target,
421 [
422 'showQuestions', 'browseForQuestions', 'questionBrowser', 'createQuestion',
423 'filter', 'resetFilter', 'insertQuestions', 'back',
424 'executeCreateQuestion', 'cancelCreateQuestion',
425 'addQuestionpool', 'saveRandomQuestions', 'saveQuestionSelectionMode', 'print',
426 'addsource', 'removesource', 'randomQuestions'
427 ],
428 );
429 }
430
431 if ($this->needsParticipantsTab()) {
432 $this->tabs->addTab(
433 self::TAB_ID_PARTICIPANTS,
434 $this->lng->txt('participants'),
435 $this->getParticipantsTabTarget()
436 );
437 }
438
439 if ($this->needsYourResultsTab()) {
440 $this->tabs->addTab(
441 self::TAB_ID_YOUR_RESULTS,
442 $this->lng->txt('your_results'),
443 $this->getYourResultsTabTarget()
444 );
445 }
446
447 if ($this->checkScoreParticipantsTabAccess()) {
448 if ($this->test_object->getGlobalSettings()->isManualScoringEnabled()) {
449 // scoring tab
450 $this->tabs->addTarget(
451 self::TAB_ID_MANUAL_SCORING,
452 $this->ctrl->getLinkTargetByClass(
453 [\ilObjTestGUI::class, ConsecutiveScoringGUI::class],
455 ),
456 '',
457 [ConsecutiveScoringGUI::class]
458 );
459 }
460 }
461
462 if ($this->isHistoryAccessGranted()) {
463 $this->tabs->addTarget(
464 self::TAB_ID_HISTORY,
465 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, 'history'),
466 'history',
467 ''
468 );
469 }
470
471 if ($this->isLpAccessGranted()) {
472 $this->tabs->addTarget(
473 self::TAB_ID_LEARNING_PROGRESS,
474 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilLearningProgressGUI::class], ''),
475 '',
476 [
477 'illplistofobjectsgui',
478 'illplistofsettingsgui',
479 'illearningprogressgui',
480 'illplistofprogressgui'
481 ]
482 );
483 }
484
485 if ($this->isWriteAccessGranted()) {
486 $mdgui = new \ilObjectMetaDataGUI($this->test_object);
487 $mdtab = $mdgui->getTab(\ilObjTestGUI::class);
488 if ($mdtab) {
489 $this->tabs->addTarget(
490 self::TAB_ID_META_DATA,
491 $mdtab,
492 '',
493 'ilmdeditorgui'
494 );
495 }
496
497 $this->tabs->addTarget(
498 self::TAB_ID_EXPORT,
499 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestExportGUI::class], ''),
500 '',
501 ['iltestexportgui']
502 );
503 }
504
505 if ($this->isPermissionsAccessGranted()) {
506 $this->tabs->addTarget(
507 self::TAB_ID_PERMISSIONS,
508 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilPermissionGUI::class], 'perm'),
509 ['perm','info','owner'],
510 'ilpermissiongui'
511 );
512 }
513 }
514
515 protected function getBrowseForQuestionsTab(): void
516 {
517 if ($this->isWriteAccessGranted()) {
518 $this->ctrl->saveParameterByClass($this->ctrl->getCmdClass(), 'q_id');
519 // edit page
520 $this->tabs->setBackTarget(
521 $this->lng->txt('backtocallingtest'),
522 $this->ctrl->getLinkTargetByClass($this->ctrl->getCmdClass(), \ilObjTestGUI::SHOW_QUESTIONS_CMD)
523 );
524 $this->tabs->addTarget(
525 'tst_browse_for_questions',
526 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, 'browseForQuestions'),
527 ['browseForQuestions', 'filter', 'resetFilter', 'resetTextFilter', 'insertQuestions'],
528 '',
529 '',
530 true
531 );
532 }
533 }
534
535 protected function getRandomQuestionsTab(): void
536 {
537 if ($this->isWriteAccessGranted()) {
538 // edit page
539 $this->tabs->setBackTarget(
540 $this->lng->txt('backtocallingtest'),
541 $this->ctrl->getLinkTargetByClass(\ilTestRandomQuestionSetConfigGUI::class, \ilObjTestGUI::SHOW_QUESTIONS_CMD)
542 );
543 $this->tabs->addTarget(
544 'random_selection',
545 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, 'randomQuestions'),
546 ['randomQuestions'],
547 '',
548 ''
549 );
550 }
551 }
552
553 public function getQuestionsSubTabs(): void
554 {
555 if (!$this->isWriteAccessGranted()) {
556 return;
557 }
558
559 $this->tabs->activateTab(self::TAB_ID_QUESTIONS);
560
561 if ($this->test_object->isRandomTest()) {
562 $this->tabs->addSubTabTarget(
563 self::QUESTIONS_SUBTAB_ID_RANDOM_SETTINGS,
564 $this->ctrl->getLinkTargetByClass(
565 \ilTestRandomQuestionSetConfigGUI::class,
567 ),
568 ['', 'showGeneralConfigForm', 'saveGeneralConfigForm']
569 );
570
571 $this->tabs->addSubTabTarget(
572 self::QUESTIONS_SUBTAB_ID_RANDOM_POOLS,
573 $this->ctrl->getLinkTargetByClass(
574 \ilTestRandomQuestionSetConfigGUI::class,
576 ),
577 ['showSourcePoolDefinitionList']
578 );
579 }
580
581 $this->tabs->addSubTab(
582 self::SUBTAB_ID_QST_LIST_VIEW,
583 $this->lng->txt('edit_test_questions'),
584 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, \ilObjTestGUI::SHOW_QUESTIONS_CMD)
585 );
586
587 if ($this->test_object->isSkillServiceToBeConsidered()) {
588 $this->tabs->addSubTabTarget(
589 self::SETTINGS_SUBTAB_ID_ASSIGN_SKILLS_TO_QUESTIONS,
590 $this->ctrl->getLinkTargetByClass(
591 [
592 \ilTestSkillAdministrationGUI::class,
593 \ilAssQuestionSkillAssignmentsGUI::class
594 ],
596 ),
597 [
600 ]
601 );
602 }
603 }
604
605 public function getSettingsSubTabs(): void
606 {
607 $this->tabs->addSubTabTarget(
608 self::SETTINGS_SUBTAB_ID_GENERAL,
609 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, SettingsMainGUI::class]),
610 '',
611 [SettingsMainGUI::class]
612 );
613
614 $this->tabs->addSubTabTarget(
615 self::SETTINGS_SUBTAB_ID_MARK_SCHEMA,
616 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, MarkSchemaGUI::class], 'showMarkSchema'),
617 '',
618 [MarkSchemaGUI::class]
619 );
620
621 $this->tabs->addSubTabTarget(
622 self::SETTINGS_SUBTAB_ID_SCORING,
623 $this->ctrl->getLinkTargetByClass(
624 [\ilObjTestGUI::class, SettingsScoringGUI::class],
626 ),
627 '',
628 [SettingsScoringGUI::class]
629 );
630
631 $this->ctrl->setParameterByClass(\ilTestPageGUI::class, 'page_type', 'introductionpage');
632 $this->tabs->addSubTabTarget(
633 self::SETTINGS_SUBTAB_ID_EDIT_INTRODUCTION_PAGE,
634 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestPageGUI::class], 'preview'),
635 ['iltestpagegui']
636 );
637
638 $this->ctrl->setParameterByClass(\ilTestPageGUI::class, 'page_type', 'concludingremarkspage');
639 $this->tabs->addSubTabTarget(
640 self::SETTINGS_SUBTAB_ID_EDIT_CONCLUSION_PAGE,
641 $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestPageGUI::class], 'preview'),
642 ['iltestpagegui']
643 );
644 $this->ctrl->clearParameterByClass(\ilTestPageGUI::class, 'page_type');
645
646 $validator = new \ilCertificateActiveValidator();
647 if ($validator->validate() === true) {
648 $this->tabs->addSubTabTarget(
649 self::SETTINGS_SUBTAB_ID_CERTIFICATE,
650 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, 'certificate'),
651 ['certificate', 'certificateEditor', 'certificateRemoveBackground', 'certificateSave',
652 'certificatePreview', 'certificateDelete', 'certificateUpload', 'certificateImport'],
653 ['', 'ilobjtestgui', 'ilcertificategui']
654 );
655 }
656
657 if ($this->test_object->isSkillServiceToBeConsidered()) {
658 $this->tabs->addSubTabTarget(
659 self::SETTINGS_SUBTAB_ID_ASSIGN_SKILL_TRESHOLDS,
660 $this->ctrl->getLinkTargetByClass(
661 [
662 \ilTestSkillAdministrationGUI::class,
663 \ilTestSkillLevelThresholdsGUI::class
664 ],
666 ),
668 );
669 }
670
671 $this->tabs->addSubTabTarget(
672 self::SETTINGS_SUBTAB_ID_PERSONAL_DEFAULT_SETTINGS,
673 $this->ctrl->getLinkTargetByClass(\ilObjTestGUI::class, 'showTemplates'),
674 ['showTemplates', 'createTemplate'],
675 ['', 'ilobjtestgui', 'ilcertificategui']
676 );
677
678 $lti_settings = new \ilLTIProviderObjectSettingGUI($this->test_object->getRefId());
679 if ($lti_settings->hasSettingsAccess()) {
680 $this->tabs->addSubTabTarget(
681 'lti_provider',
682 $this->ctrl->getLinkTargetByClass(\ilLTIProviderObjectSettingGUI::class),
683 '',
684 [\ilLTIProviderObjectSettingGUI::class]
685 );
686 }
687 }
688
689 protected function needsParticipantsTab(): bool
690 {
691 if (!$this->checkParticipantsTabAccess()) {
692 return false;
693 }
694
695 return true;
696 }
697
698 protected function needsTimeExtensionSubTab(): bool
699 {
700 if (!($this->test_object->getProcessingTimeInSeconds() > 0)) {
701 return false;
702 }
703
704 if ($this->test_object->getNrOfTries() != 1) {
705 return false;
706 }
707
708 return true;
709 }
710
711 protected function getParticipantsTabTarget(): string
712 {
713 return $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestParticipantsGUI::class]);
714 }
715
716 public function needsYourResultsTab(): bool
717 {
718 return $this->test_session->reportableResultsAvailable($this->test_object)
719 || (
720 $this->test_session->getActiveId() !== 0
721 && $this->test_object->canShowSolutionPrintview($this->test_session->getUserId())
722 );
723 }
724
725 protected function getYourResultsTabTarget(): string
726 {
727 if ($this->needsLoResultsSubTab()) {
728 return $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestResultsGUI::class, \ilTestEvalObjectiveOrientedGUI::class]);
729 }
730
731 if ($this->needsYourSolutionsSubTab()) {
732 return $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestSolutionsGUI::class, \ilTestEvaluationGUI::class]);
733 }
734
735 return $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestResultsGUI::class, \ilTestEvaluationGUI::class]);
736 }
737
738 protected function needsYourResultsSubTab(): bool
739 {
740 return $this->test_object->isScoreReportingEnabled();
741 }
742
743 public function needsLoResultsSubTab(): bool
744 {
745 if (!$this->test_object->isScoreReportingEnabled()) {
746 return false;
747 }
748
749 return $this->objective_parent->isObjectiveOrientedPresentationRequired();
750 }
751
752 public function needsHighSoreSubTab(): bool
753 {
754 if (!$this->test_object->isScoreReportingEnabled()) {
755 return false;
756 }
757
758 return $this->test_object->getHighscoreEnabled();
759 }
760
761 public function needsSkillResultsSubTab(): bool
762 {
763 if (!$this->test_object->isScoreReportingEnabled()) {
764 return false;
765 }
766
767 return $this->test_object->isSkillServiceToBeConsidered();
768 }
769
770 public function needsYourSolutionsSubTab(): bool
771 {
772 return $this->test_object->canShowSolutionPrintview($this->test_session->getUserId());
773 }
774
775 public function getYourResultsSubTabs(): void
776 {
777 if ($this->needsLoResultsSubTab()) {
778 $this->tabs->addSubTab(
779 self::SUBTAB_ID_LO_RESULTS,
780 $this->lng->txt('tst_tab_results_objective_oriented'),
781 $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilTestEvalObjectiveOrientedGUI::class])
782 );
783 }
784
785 if ($this->needsYourResultsSubTab()) {
786 $myResultsLabel = $this->lng->txt('tst_show_results');
787
788 if ($this->needsLoResultsSubTab()) {
789 $myResultsLabel = $this->lng->txt('tst_tab_results_pass_oriented');
790 }
791
792 $this->tabs->addSubTab(
793 self::SUBTAB_ID_MY_RESULTS,
794 $myResultsLabel,
795 $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestResultsGUI::class, \ilTestEvaluationGUI::class])
796 );
797 }
798
799 if ($this->needsSkillResultsSubTab()) {
800 $this->tabs->addSubTab(
801 self::SUBTAB_ID_SKILL_RESULTS,
802 $this->lng->txt('tst_show_comp_results'),
803 $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilTestSkillEvaluationGUI::class])
804 );
805 }
806
807 if ($this->needsHighSoreSubTab()) {
808 $this->tabs->addSubTab(
809 self::SUBTAB_ID_HIGHSCORE,
810 $this->lng->txt('tst_show_toplist'),
811 $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilTestToplistGUI::class], 'outResultsToplist')
812 );
813 }
814
815 if ($this->needsYourSolutionsSubTab()) {
816 $this->tabs->addSubTab(
817 self::SUBTAB_ID_MY_SOLUTIONS,
818 $this->lng->txt('tst_list_of_answers_show'),
819 $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestSolutionsGUI::class, \ilTestEvaluationGUI::class])
820 );
821 }
822 }
823}
__construct(private readonly \ilTabsGUI $tabs, private readonly \ilLanguage $lng, private readonly \ilCtrlInterface $ctrl, private readonly \ilAccess $access, private readonly \ilTestAccess $test_access, private readonly \ilObjTest $test_object, private readonly \ilTestObjectiveOrientedContainer $objective_parent, private readonly \ilTestSession $test_session)
Definition: TabsManager.php:79
activateSubTab(string $sub_tab_id)
resetTabsAndAddBacklink(string $back_link_target)
setParentBackLabel(?string $parent_back_label)
const TAB_ID_QUESTIONS
(Sub-)Tab ID constants
Definition: TabsManager.php:38
setParentBackHref(?string $parent_back_href)
@ilCtrl_Calls ILIAS\Test\Settings\MainSettings\SettingsMainGUI: ilPropertyFormGUI @ilCtrl_Calls ILIAS...
Class ilAccessHandler Checks access for ILIAS objects.
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Test session handler.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:31