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