ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestTabsManager.php
Go to the documentation of this file.
1 <?php
2 
26 {
31  public const TAB_ID_QUESTIONS = 'assQuestions';
32  public const SUBTAB_ID_QST_LIST_VIEW = 'qst_list_view';
33  public const SUBTAB_ID_QST_PAGE_VIEW = 'qst_page_view';
34 
35  public const TAB_ID_INFOSCREEN = 'info_short';
36  public const TAB_ID_SETTINGS = 'settings';
37  public const SUBTAB_ID_GENERAL_SETTINGS = 'general';
38  public const TAB_ID_LEARNING_PROGRESS = 'learning_progress';
39  public const TAB_ID_MANUAL_SCORING = 'manscoring';
40  public const TAB_ID_CORRECTION = 'scoringadjust';
41  public const TAB_ID_STATISTICS = 'statistics';
42  public const TAB_ID_HISTORY = 'history';
43  public const TAB_ID_META_DATA = 'meta_data';
44  public const TAB_ID_EXPORT = 'export';
45  public const TAB_ID_PERMISSIONS = 'perm_settings';
46 
47  public const TAB_ID_EXAM_DASHBOARD = 'dashboard_tab';
48  public const SUBTAB_ID_FIXED_PARTICIPANTS = 'fixedparticipants';
49  public const SUBTAB_ID_TIME_EXTENSION = 'timeextension';
50 
51  public const TAB_ID_RESULTS = 'results';
52  public const SUBTAB_ID_PARTICIPANTS_RESULTS = 'participantsresults';
53  public const SUBTAB_ID_MY_RESULTS = 'myresults';
54  public const SUBTAB_ID_LO_RESULTS = 'loresults';
55  public const SUBTAB_ID_HIGHSCORE = 'highscore';
56  public const SUBTAB_ID_SKILL_RESULTS = 'skillresults';
57  public const SUBTAB_ID_MY_SOLUTIONS = 'mysolutions';
58  private \ILIAS\Test\InternalRequestService $testrequest;
59 
63  protected $tabs;
64 
68  protected $access;
69 
73  protected $testAccess;
74 
78  protected $objectiveParent;
79 
83  protected $lng;
84 
88  protected $testOBJ;
89 
93  protected $testSession;
94 
99 
103  protected $parentBackHref;
104 
108  protected $parentBackLabel;
109 
113  protected $hiddenTabs;
114 
119  {
120  $this->testAccess = $testAccess;
121  $this->objectiveParent = $objectiveParent;
122 
123  global $DIC; /* @var ILIAS\DI\Container $DIC */
124  $this->testrequest = $DIC->test()->internal()->request();
125  $this->tabs = $DIC['ilTabs'];
126  $this->access = $DIC['ilAccess'];
127  $this->lng = $DIC['lng'];
128  }
129 
133  public function activateTab($tabId)
134  {
135  switch ($tabId) {
136  case self::TAB_ID_EXAM_DASHBOARD:
137  case self::TAB_ID_RESULTS:
138 
139  $this->tabs->activateTab($tabId);
140  }
141  }
142 
146  public function activateSubTab($subTabId)
147  {
148  switch ($subTabId) {
149  case self::SUBTAB_ID_FIXED_PARTICIPANTS:
150  case self::SUBTAB_ID_TIME_EXTENSION:
151 
152  case self::SUBTAB_ID_PARTICIPANTS_RESULTS:
153  case self::SUBTAB_ID_MY_RESULTS:
154  case self::SUBTAB_ID_LO_RESULTS:
155  case self::SUBTAB_ID_HIGHSCORE:
156  case self::SUBTAB_ID_SKILL_RESULTS:
157  case self::SUBTAB_ID_MY_SOLUTIONS:
158 
159  case self::SUBTAB_ID_QST_LIST_VIEW:
160  case self::SUBTAB_ID_QST_PAGE_VIEW:
161 
162  $this->tabs->activateSubTab($subTabId);
163  }
164  }
165 
169  public function getTestOBJ(): ilObjTest
170  {
171  return $this->testOBJ;
172  }
173 
177  public function setTestOBJ(ilObjTest $testOBJ)
178  {
179  $this->testOBJ = $testOBJ;
180  }
181 
185  public function getTestSession(): ilTestSession
186  {
187  return $this->testSession;
188  }
189 
193  public function setTestSession($testSession)
194  {
195  $this->testSession = $testSession;
196  }
197 
202  {
204  }
205 
210  {
211  $this->testQuestionSetConfig = $testQuestionSetConfig;
212  }
213 
217  public function getHiddenTabs(): array
218  {
219  return $this->hiddenTabs;
220  }
221 
225  public function setHiddenTabs($hiddenTabs)
226  {
227  $this->hiddenTabs = $hiddenTabs;
228  }
229 
233  public function resetHiddenTabs()
234  {
235  $this->hiddenTabs = array();
236  }
237 
241  public function getParentBackLabel(): ?string
242  {
243  return $this->parentBackLabel;
244  }
245 
250  {
251  $this->parentBackLabel = $parentBackLabel;
252  }
253 
257  public function getParentBackHref(): ?string
258  {
259  return $this->parentBackHref;
260  }
261 
266  {
267  $this->parentBackHref = $parentBackHref;
268  }
269 
273  public function hasParentBackLink()
274  {
275  if (!is_string($this->getParentBackHref()) || !strlen($this->getParentBackHref())) {
276  return false;
277  }
278 
279  if (!is_string($this->getParentBackLabel()) || !strlen($this->getParentBackLabel())) {
280  return false;
281  }
282 
283  return true;
284  }
285 
288  public function initSettingsTemplate()
289  {
290  $this->resetHiddenTabs();
291 
292  if ($this->getTestOBJ()->getTemplate()) {
293  require_once 'Services/Administration/classes/class.ilSettingsTemplate.php';
294 
295  $template = new ilSettingsTemplate(
296  $this->getTestOBJ()->getTemplate(),
298  );
299 
300  $this->setHiddenTabs($template->getHiddenTabs());
301  }
302  }
303 
308  protected function isHiddenTab($tabId): bool
309  {
310  return in_array($tabId, $this->getHiddenTabs());
311  }
312 
316  protected function isReadAccessGranted(): bool
317  {
318  return $this->access->checkAccess('read', '', $this->getTestOBJ()->getRefId());
319  }
320 
324  protected function isWriteAccessGranted(): bool
325  {
326  return $this->access->checkAccess('write', '', $this->getTestOBJ()->getRefId());
327  }
328 
332  protected function isStatisticsAccessGranted(): bool
333  {
334  return $this->access->checkAccess('tst_statistics', '', $this->getTestOBJ()->getRefId());
335  }
336 
340  protected function isPermissionsAccessGranted(): bool
341  {
342  return $this->access->checkAccess('edit_permission', '', $this->getTestOBJ()->getRefId());
343  }
344 
348  protected function isLpAccessGranted(): bool
349  {
350  include_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
351  return ilLearningProgressAccess::checkAccess($this->getTestOBJ()->getRefId());
352  }
353 
357  protected function checkDashboardTabAccess(): bool
358  {
359  if ($this->testAccess->checkManageParticipantsAccess()) {
360  return true;
361  }
362 
363  return false;
364  }
365 
369  protected function checkScoreParticipantsTabAccess(): bool
370  {
371  return $this->testAccess->checkScoreParticipantsAccess();
372  }
373 
377  protected function checkStatisticsTabAccess(): bool
378  {
379  return $this->testAccess->checkStatisticsAccess();
380  }
381 
384  public function perform()
385  {
386  if ($this->isTabsConfigSetupRequired()) {
387  $this->setupTabsGuiConfig();
388  }
389  }
390 
391  protected function isTabsConfigSetupRequired(): bool
392  {
393  global $DIC; /* @var ILIAS\DI\Container $DIC */
394 
395  if (preg_match('/^ass(.*?)gui$/i', $DIC->ctrl()->getNextClass($this))) {
396  return false;
397  }
398 
399  if ($DIC->ctrl()->getNextClass($this) == 'ilassquestionpagegui') {
400  return false;
401  }
402 
403  if ($DIC->ctrl()->getCmdClass() == 'iltestoutputgui') {
404  return false;
405  }
406 
407  if ($DIC->ctrl()->getCmdClass() == 'iltestevaluationgui') {
408  return in_array($DIC->ctrl()->getCmd(), array(
409  '', 'outUserResultsPassOverview', 'outUserListOfAnswerPasses', 'outEvaluation', 'eval_a', 'singleResults', 'detailedEvaluation'
410  ));
411  }
412 
413  return true;
414  }
415 
416  protected function setupTabsGuiConfig()
417  {
418  global $DIC; /* @var ILIAS\DI\Container $DIC */
419 
420  if ($this->hasParentBackLink()) {
421  $this->tabs->setBack2Target($this->getParentBackLabel(), $this->getParentBackHref());
422  }
423 
424  switch (strtolower($DIC->ctrl()->getCmdClass())) {
425  case 'ilmarkschemagui':
426  case 'ilobjtestsettingsgeneralgui':
427  case 'ilobjtestsettingsscoringresultsgui':
428 
429  if ($this->isWriteAccessGranted()) {
430  $this->getSettingsSubTabs();
431  }
432 
433  break;
434  }
435 
436  switch ($DIC->ctrl()->getCmd()) {
437  case "resume":
438  case "previous":
439  case "next":
440  case "summary":
441  case "directfeedback":
442  case "finishTest":
443  case "outCorrectSolution":
444  case "passDetails":
445  case "showAnswersOfUser":
446  case "backFromSummary":
447  case "show_answers":
448  case "setsolved":
449  case "resetsolved":
450  case "confirmFinish":
451  case "outTestSummary":
452  case "outQuestionSummary":
453  case "gotoQuestion":
454  case "selectImagemapRegion":
455  case "confirmSubmitAnswers":
456  case "finalSubmission":
457  case "postpone":
458  case "outUserPassDetails":
459  case "checkPassword":
460  case "exportCertificate":
461  case "finishListOfAnswers":
462  case "backConfirmFinish":
463  case "showFinalStatement":
464  return;
465  break;
466  case "browseForQuestions":
467  case "filter":
468  case "resetFilter":
469  case "resetTextFilter":
470  case "insertQuestions":
471  $classes = array(
472  'iltestdashboardgui',
473  'iltestresultsgui',
474  "illearningprogressgui" // #8497: resetfilter is also used in lp
475  );
476  if (!in_array($DIC->ctrl()->getNextClass($this), $classes)) {
477  $this->getBrowseForQuestionsTab();
478  return;
479  }
480  break;
481  case "scoring":
482  case "certificate":
483  case "certificateservice":
484  case "certificateImport":
485  case "certificateUpload":
486  case "certificateEditor":
487  case "certificateDelete":
488  case "certificateSave":
489  case "defaults":
490  case "deleteDefaults":
491  case "addDefaults":
492  case "applyDefaults":
493  case "inviteParticipants":
494  case "searchParticipants":
495  if ($this->isWriteAccessGranted() && in_array(strtolower($DIC->ctrl()->getCmdClass()), array('ilobjtestgui', 'ilcertificategui'))) {
496  $this->getSettingsSubTabs();
497  }
498  break;
499  case "export":
500  case "print":
501  break;
502  case "statistics":
503  case "eval_a":
504  case "detailedEvaluation":
505  case "outEvaluation":
506  case "singleResults":
507  case "exportEvaluation":
508  case "evalUserDetail":
509  case "outStatisticsResultsOverview":
510  case "statisticsPassDetails":
511  $this->getStatisticsSubTabs();
512  break;
513  }
514 
515  // questions tab
516  if ($this->isWriteAccessGranted() && !$this->isHiddenTab('assQuestions')) {
517  $force_active = ($this->testrequest->raw("up") != "" || $this->testrequest->raw("down") != "")
518  ? true
519  : false;
520  if (!$force_active) {
521  if ($this->testrequest->raw("browse") == 1) {
522  $force_active = true;
523  }
524  }
525 
526  if ($this->getTestOBJ()->isFixedTest()) {
527  $target = $DIC->ctrl()->getLinkTargetByClass(
528  'ilObjTestGUI',
529  'questions'
530  );
531  }
532 
533  if ($this->getTestOBJ()->isRandomTest()) {
534  $target = $DIC->ctrl()->getLinkTargetByClass('ilTestRandomQuestionSetConfigGUI');
535  }
536 
537  if ($this->getTestOBJ()->isDynamicTest()) {
538  $target = $DIC->ctrl()->getLinkTargetByClass('ilObjTestDynamicQuestionSetConfigGUI');
539  }
540 
541  $this->tabs->addTarget(
542  "assQuestions",
543  $target,
544  array("questions", "browseForQuestions", "questionBrowser", "createQuestion",
545  "randomselect", "filter", "resetFilter", "insertQuestions",
546  "back", "createRandomSelection", "cancelRandomSelect",
547  "insertRandomSelection", "removeQuestions", "moveQuestions",
548  "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions",
549  "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion",
550  "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode", "print",
551  "addsource", "removesource", "randomQuestions"),
552  "",
553  "",
554  $force_active
555  );
556  }
557 
558  // info tab
559  if ($this->isReadAccessGranted() && !$this->isHiddenTab('info_short')) {
560  $this->tabs->addTarget(
561  "info_short",
562  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'infoScreen'),
563  array("infoScreen", "outIntroductionPage", "showSummary",
564  "setAnonymousId", "redirectToInfoScreen")
565  );
566  }
567 
568  // settings tab
569  if ($this->isWriteAccessGranted()) {
570  if (!$this->isHiddenTab('settings')) {
571  $settingsCommands = array(
572  "marks", "showMarkSchema","addMarkStep", "deleteMarkSteps", "resetToSimpleMarkSchema", "saveMarks",
573  "certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
574  "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport",
575  "scoring", "defaults", "addDefaults", "deleteDefaults", "applyDefaults",
576  "inviteParticipants", "saveFixedParticipantsStatus", "searchParticipants", "addParticipants" // ARE THEY RIGHT HERE
577  );
578 
579  require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
580  $reflection = new ReflectionClass('ilObjTestSettingsGeneralGUI');
581  foreach ($reflection->getConstants() as $name => $value) {
582  if (substr($name, 0, 4) == 'CMD_') {
583  $settingsCommands[] = $value;
584  }
585  }
586 
587  require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
588  $reflection = new ReflectionClass('ilObjTestSettingsScoringResultsGUI');
589  foreach ($reflection->getConstants() as $name => $value) {
590  if (substr($name, 0, 4) == 'CMD_') {
591  $settingsCommands[] = $value;
592  }
593  }
594 
595  $settingsCommands[] = ""; // DO NOT KNOW WHAT THIS IS DOING, BUT IT'S REQUIRED
596 
597  $this->tabs->addTarget(
598  "settings",
599  $DIC->ctrl()->getLinkTargetByClass('ilObjTestSettingsGeneralGUI'),
600  $settingsCommands,
601  array("ilmarkschemagui", "ilobjtestsettingsgeneralgui", "ilobjtestsettingsscoringresultsgui", "ilobjtestgui", "ilcertificategui")
602  );
603  }
604 
605  // skill service
606  if ($this->getTestOBJ()->isSkillServiceToBeConsidered()) {
607  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
608 
609  $link = $DIC->ctrl()->getLinkTargetByClass(
610  array('ilTestSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'),
612  );
613 
614  $this->tabs->addTarget('tst_tab_competences', $link, array(), array());
615  }
616  }
617 
618  if ($this->needsDashboardTab()) {
619  $this->tabs->addTab(
620  self::TAB_ID_EXAM_DASHBOARD,
621  $DIC->language()->txt('dashboard_tab'),
622  $this->getDashboardTabTarget()
623  );
624  }
625 
626  if ($this->needsResultsTab()) {
627  $this->tabs->addTab(
628  self::TAB_ID_RESULTS,
629  $DIC->language()->txt('results_tab'),
630  $this->getResultsTabTarget()
631  );
632  }
633 
634  if ($this->isLpAccessGranted() && !$this->isHiddenTab(self::TAB_ID_LEARNING_PROGRESS)) {
635  $this->tabs->addTarget(
636  self::TAB_ID_LEARNING_PROGRESS,
637  $DIC->ctrl()->getLinkTargetByClass(array('illearningprogressgui'), ''),
638  '',
639  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
640  );
641  }
642 
643  if ($this->checkScoreParticipantsTabAccess() && !$this->isHiddenTab(self::TAB_ID_MANUAL_SCORING)) {
644  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
646  if (count($scoring)) {
647  // scoring tab
648  $this->tabs->addTarget(
649  self::TAB_ID_MANUAL_SCORING,
650  $DIC->ctrl()->getLinkTargetByClass('ilTestScoringByQuestionsGUI', 'showManScoringByQuestionParticipantsTable'),
651  array(
652  'showManScoringParticipantsTable', 'applyManScoringParticipantsFilter', 'resetManScoringParticipantsFilter', 'showManScoringParticipantScreen',
653  'showManScoringByQuestionParticipantsTable', 'applyManScoringByQuestionFilter', 'resetManScoringByQuestionFilter', 'saveManScoringByQuestion'
654 
655  ),
656  ''
657  );
658  }
659  }
660 
661  // NEW CORRECTIONS TAB
662  $setting = new ilSetting('assessment');
663  $scoring_adjust_active = (bool) $setting->get('assessment_adjustments_enabled', '0');
664  if ($this->isWriteAccessGranted() && $scoring_adjust_active && !$this->isHiddenTab(self::TAB_ID_CORRECTION)) {
665  $this->tabs->addTab(
666  self::TAB_ID_CORRECTION,
667  $DIC->language()->txt(self::TAB_ID_CORRECTION),
668  $DIC->ctrl()->getLinkTargetByClass('ilTestCorrectionsGUI')
669  );
670  }
671 
672  if ($this->checkStatisticsTabAccess() && !$this->isHiddenTab(self::TAB_ID_STATISTICS)) {
673  // statistics tab
674  $this->tabs->addTarget(
675  self::TAB_ID_STATISTICS,
676  $DIC->ctrl()->getLinkTargetByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilTestEvaluationGUI::class], "outEvaluation"),
677  array(
678  "statistics", "outEvaluation", "exportEvaluation", "detailedEvaluation", "eval_a", "evalUserDetail",
679  "passDetails", "outStatisticsResultsOverview", "statisticsPassDetails", "singleResults"
680  ),
681  ""
682  );
683  }
684 
685  if ($this->isWriteAccessGranted()) {
686  if (!$this->isHiddenTab(self::TAB_ID_HISTORY)) {
687 
688  // history
689  $this->tabs->addTarget(
690  self::TAB_ID_HISTORY,
691  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'history'),
692  "history",
693  ""
694  );
695  }
696 
697  if (!$this->isHiddenTab(self::TAB_ID_META_DATA)) {
698  // meta data
699  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
700  $mdgui = new ilObjectMetaDataGUI($this->getTestOBJ());
701  $mdtab = $mdgui->getTab();
702  if ($mdtab) {
703  $this->tabs->addTarget(
704  self::TAB_ID_META_DATA,
705  $mdtab,
706  "",
707  "ilmdeditorgui"
708  );
709  }
710  }
711 
712  if (!$this->isHiddenTab(self::TAB_ID_EXPORT)) {
713  // export tab
714  $this->tabs->addTarget(
715  self::TAB_ID_EXPORT,
716  $DIC->ctrl()->getLinkTargetByClass('iltestexportgui', ''),
717  '',
718  array('iltestexportgui')
719  );
720  }
721  }
722 
723  if ($this->isPermissionsAccessGranted() && !$this->isHiddenTab(self::TAB_ID_PERMISSIONS)) {
724  $this->tabs->addTarget(
725  self::TAB_ID_PERMISSIONS,
726  $DIC->ctrl()->getLinkTargetByClass(array('ilObjTestGUI','ilpermissiongui'), "perm"),
727  array("perm","info","owner"),
728  'ilpermissiongui'
729  );
730  }
731 
732  if ($this->getTestQuestionSetConfig()->areDepenciesBroken()) {
733  $hideTabs = $this->getTestQuestionSetConfig()->getHiddenTabsOnBrokenDepencies();
734 
735  foreach ($hideTabs as $tabId) {
736  $this->tabs->removeTab($tabId);
737  }
738  }
739  }
740 
741  protected function getBrowseForQuestionsTab()
742  {
743  global $DIC; /* @var ILIAS\DI\Container $DIC */
744 
745  if ($this->isWriteAccessGranted()) {
746  $DIC->ctrl()->saveParameterByClass($DIC->ctrl()->getCmdClass(), 'q_id');
747  // edit page
748  $this->tabs->setBackTarget($this->lng->txt("backtocallingtest"), $DIC->ctrl()->getLinkTargetByClass($DIC->ctrl()->getCmdClass(), "questions"));
749  $this->tabs->addTarget(
750  "tst_browse_for_questions",
751  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', "browseForQuestions"),
752  array("browseForQuestions", "filter", "resetFilter", "resetTextFilter", "insertQuestions"),
753  "",
754  "",
755  true
756  );
757  }
758  }
759 
760  protected function getRandomQuestionsTab()
761  {
762  global $DIC; /* @var ILIAS\DI\Container $DIC */
763 
764  if ($this->isWriteAccessGranted()) {
765  // edit page
766  $this->tabs->setBackTarget($this->lng->txt("backtocallingtest"), $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', "questions"));
767  $this->tabs->addTarget(
768  "random_selection",
769  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', "randomQuestions"),
770  array("randomQuestions"),
771  "",
772  ""
773  );
774  }
775  }
776 
777  public function getQuestionsSubTabs()
778  {
779  global $DIC; /* @var ILIAS\DI\Container $DIC */
780 
781  if ($this->testOBJ->isDynamicTest()) {
782  return;
783  }
784 
785  $this->tabs->activateTab(self::TAB_ID_QUESTIONS);
786 
787  /*
788  if (!$this->getTestOBJ()->isRandomTest()) {
789  $this->tabs->addSubTab(
790  self::SUBTAB_ID_QST_PAGE_VIEW,
791  $DIC->language()->txt('questions_per_page_view'),
792  $DIC->ctrl()->getLinkTargetByClass('iltestexpresspageobjectgui', 'showPage')
793  );
794  }
795  */
796 
797  //include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
798  //$template = new ilSettingsTemplate($this->getTestOBJ()->getTemplate(), ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
799 
800  if (!$this->isHiddenTab('questions')) {
801  $this->tabs->addSubTab(
802  self::SUBTAB_ID_QST_LIST_VIEW,
803  $DIC->language()->txt('edit_test_questions'),
804  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'questions')
805  );
806  }
807 
808  // print view subtab
809  if (!$this->getTestOBJ()->isRandomTest()) {
810  $this->tabs->addSubTabTarget(
811  "print_view",
812  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'print'),
813  "print",
814  "",
815  "",
816  $DIC->ctrl()->getCmd() == 'print'
817  );
818  $this->tabs->addSubTabTarget(
819  'review_view',
820  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'review'),
821  'review',
822  '',
823  '',
824  $DIC->ctrl()->getCmd() == 'review'
825  );
826  }
827  }
828 
829  protected function getStatisticsSubTabs()
830  {
831  global $DIC; /* @var ILIAS\DI\Container $DIC */
832 
833  // user results subtab
834  $this->tabs->addSubTabTarget(
835  "eval_all_users",
836  $DIC->ctrl()->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"),
837  array("outEvaluation", "detailedEvaluation", "exportEvaluation", "evalUserDetail", "passDetails",
838  "outStatisticsResultsOverview", "statisticsPassDetails"),
839  ""
840  );
841 
842  // aggregated results subtab
843  $this->tabs->addSubTabTarget(
844  "tst_results_aggregated",
845  $DIC->ctrl()->getLinkTargetByClass("iltestevaluationgui", "eval_a"),
846  array("eval_a"),
847  "",
848  ""
849  );
850 
851  // question export
852  $this->tabs->addSubTabTarget(
853  "tst_single_results",
854  $DIC->ctrl()->getLinkTargetByClass("iltestevaluationgui", "singleResults"),
855  array("singleResults"),
856  "",
857  ""
858  );
859  }
860 
861  public function getSettingsSubTabs()
862  {
863  global $DIC; /* @var ILIAS\DI\Container $DIC */
864 
865  if ($this->testOBJ->isDynamicTest()) {
866  return;
867  }
868 
869  // general subtab
870  $this->tabs->addSubTabTarget(
871  'general',
872  $DIC->ctrl()->getLinkTargetByClass('ilObjTestSettingsGeneralGUI'),
873  '', // auto activation regardless from cmd
874  array('ilobjtestsettingsgeneralgui') // auto activation for ilObjTestSettingsGeneralGUI
875  );
876 
877  if (!$this->isHiddenTab('mark_schema')) {
878  $this->tabs->addSubTabTarget(
879  'mark_schema',
880  $DIC->ctrl()->getLinkTargetByClass('ilmarkschemagui', 'showMarkSchema'),
881  '',
882  array('ilmarkschemagui')
883  );
884  }
885 
886  // scoring subtab
887  $this->tabs->addSubTabTarget(
888  'scoring',
889  $DIC->ctrl()->getLinkTargetByClass('ilObjTestSettingsScoringResultsGUI'),
890  '', // auto activation regardless from cmd
891  array('ilobjtestsettingsscoringresultsgui') // auto activation for ilObjTestSettingsScoringResultsGUI
892  );
893 
894  // certificate subtab
895  $validator = new ilCertificateActiveValidator();
896  if (!$this->isHiddenTab('certificate') && true === $validator->validate()) {
897  $this->tabs->addSubTabTarget(
898  "certificate",
899  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', 'certificate'),
900  array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
901  "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport"),
902  array("", "ilobjtestgui", "ilcertificategui")
903  );
904  }
905 
906  if (!$this->isHiddenTab('defaults')) {
907  // defaults subtab
908  $this->tabs->addSubTabTarget(
909  "tst_default_settings",
910  $DIC->ctrl()->getLinkTargetByClass('ilObjTestGUI', "defaults"),
911  array("defaults", "deleteDefaults", "addDefaults", "applyDefaults"),
912  array("", "ilobjtestgui", "ilcertificategui")
913  );
914  }
915 
916  $lti_settings = new ilLTIProviderObjectSettingGUI($this->testOBJ->getRefId());
917  if ($lti_settings->hasSettingsAccess()) {
918  $this->tabs->addSubTabTarget(
919  'lti_provider',
920  $DIC->ctrl()->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class),
921  '',
922  [ilLTIProviderObjectSettingGUI::class]
923  );
924  }
925  }
926 
930  protected function needsDashboardTab(): bool
931  {
932  if ($this->isHiddenTab(self::TAB_ID_EXAM_DASHBOARD)) {
933  return false;
934  }
935 
936  if (!$this->checkDashboardTabAccess()) {
937  return false;
938  }
939 
940  return true;
941  }
942 
946  protected function needsTimeExtensionSubTab(): bool
947  {
948  if (!($this->getTestOBJ()->getProcessingTimeInSeconds() > 0)) {
949  return false;
950  }
951 
952  if ($this->getTestOBJ()->getNrOfTries() != 1) {
953  return false;
954  }
955 
956  if ($this->getTestQuestionSetConfig()->areDepenciesBroken()) {
957  return false;
958  }
959 
960  return true;
961  }
962 
966  protected function getDashboardTabTarget(): string
967  {
968  global $DIC; /* @var ILIAS\DI\Container $DIC */
969 
970  return $DIC->ctrl()->getLinkTargetByClass(array('ilTestDashboardGUI', 'ilTestParticipantsGUI'));
971  }
972 
973  public function getDashboardSubTabs()
974  {
975  global $DIC; /* @var ILIAS\DI\Container $DIC */
976 
977  if (!$this->testAccess->checkManageParticipantsAccess()) {
978  return;
979  }
980 
981  $this->tabs->addSubTab(
982  self::SUBTAB_ID_FIXED_PARTICIPANTS,
984  $DIC->ctrl()->getLinkTargetByClass('ilTestParticipantsGUI')
985  );
986 
987  if ($this->needsTimeExtensionSubTab()) {
988  $this->tabs->addSubTab(
989  self::SUBTAB_ID_TIME_EXTENSION,
990  $DIC->language()->txt('timing'),
991  $DIC->ctrl()->getLinkTargetByClass('ilTestParticipantsTimeExtensionGUI')
992  );
993  }
994  }
995 
996  protected function getDashbardParticipantsSubTabLabel(): string
997  {
998  global $DIC; /* @var \ILIAS\DI\Container $DIC */
999 
1000  if ($this->getTestOBJ()->getFixedParticipants()) {
1001  return $DIC->language()->txt('fixedparticipants_subtab');
1002  }
1003 
1004  return $DIC->language()->txt('autoparticipants_subtab');
1005  }
1006 
1010  protected function needsResultsTab(): bool
1011  {
1012  return $this->needsParticipantsResultsSubTab() || $this->testOBJ->isScoreReportingEnabled() || $this->needsMySolutionsSubTab();
1013  }
1014 
1018  protected function getResultsTabTarget(): string
1019  {
1020  global $DIC; /* @var ILIAS\DI\Container $DIC */
1021 
1022  if ($this->needsParticipantsResultsSubTab()) {
1023  return $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilParticipantsTestResultsGUI'));
1024  }
1025 
1026  if ($this->needsLoResultsSubTab()) {
1027  return $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilTestEvalObjectiveOrientedGUI'));
1028  }
1029 
1030  if ($this->needsMyResultsSubTab()) {
1031  return $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilMyTestResultsGUI', 'ilTestEvaluationGUI'));
1032  }
1033 
1034  if ($this->needsMySolutionsSubTab()) {
1035  return $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilMyTestSolutionsGUI', 'ilTestEvaluationGUI'));
1036  }
1037 
1038  return $DIC->ctrl()->getLinkTargetByClass('ilTestResultsGUI');
1039  }
1040 
1044  public function needsMyResultsSubTab(): bool
1045  {
1046  return $this->getTestSession()->reportableResultsAvailable($this->getTestOBJ());
1047  }
1048 
1052  public function needsLoResultsSubTab(): bool
1053  {
1054  if (!$this->needsMyResultsSubTab()) {
1055  return false;
1056  }
1057 
1058  return $this->objectiveParent->isObjectiveOrientedPresentationRequired();
1059  }
1060 
1064  public function needsParticipantsResultsSubTab(): bool
1065  {
1066  if ($this->testAccess->checkParticipantsResultsAccess()) {
1067  return true;
1068  }
1069 
1070  return false;
1071  }
1072 
1076  public function needsHighSoreSubTab(): bool
1077  {
1078  if (!$this->needsMyResultsSubTab()) {
1079  return false;
1080  }
1081 
1082  return $this->getTestOBJ()->getHighscoreEnabled();
1083  }
1084 
1088  public function needsSkillResultsSubTab(): bool
1089  {
1090  if (!$this->needsMyResultsSubTab()) {
1091  return false;
1092  }
1093 
1094  return $this->getTestOBJ()->isSkillServiceToBeConsidered();
1095  }
1096 
1097  public function needsMySolutionsSubTab(): bool
1098  {
1099  return $this->getTestOBJ()->canShowSolutionPrintview($this->getTestSession()->getUserId());
1100  }
1101 
1102  public function getResultsSubTabs()
1103  {
1104  global $DIC; /* @var ILIAS\DI\Container $DIC */
1105 
1106  if ($this->needsParticipantsResultsSubTab()) {
1107  $this->tabs->addSubTab(
1108  self::SUBTAB_ID_PARTICIPANTS_RESULTS,
1109  $DIC->language()->txt('participants_results_subtab'),
1110  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilParticipantsTestResultsGUI'))
1111  );
1112  }
1113 
1114  if ($this->needsLoResultsSubTab()) {
1115  $this->tabs->addSubTab(
1116  self::SUBTAB_ID_LO_RESULTS,
1117  $DIC->language()->txt('tst_tab_results_objective_oriented'),
1118  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilTestEvalObjectiveOrientedGUI'))
1119  );
1120  }
1121 
1122  if ($this->needsMyResultsSubTab()) {
1123  $myResultsLabel = $DIC->language()->txt('tst_show_results');
1124 
1125  if ($this->needsLoResultsSubTab()) {
1126  $myResultsLabel = $DIC->language()->txt('tst_tab_results_pass_oriented');
1127  }
1128 
1129  $this->tabs->addSubTab(
1130  self::SUBTAB_ID_MY_RESULTS,
1131  $myResultsLabel,
1132  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilMyTestResultsGUI', 'ilTestEvaluationGUI'))
1133  // 'ilTestEvaluationGUI' => 'outUserResultsOverview'
1134  );
1135  }
1136 
1137  if ($this->needsSkillResultsSubTab()) {
1138  $this->tabs->addSubTab(
1139  self::SUBTAB_ID_SKILL_RESULTS,
1140  $DIC->language()->txt('tst_show_comp_results'),
1141  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilTestSkillEvaluationGUI'))
1142  );
1143  }
1144 
1145  if ($this->needsHighSoreSubTab()) {
1146  $this->tabs->addSubTab(
1147  self::SUBTAB_ID_HIGHSCORE,
1148  $DIC->language()->txt('tst_show_toplist'),
1149  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilTestToplistGUI'), 'outResultsToplist')
1150  );
1151  }
1152 
1153  if ($this->needsMySolutionsSubTab()) {
1154  $this->tabs->addSubTab(
1155  self::SUBTAB_ID_MY_SOLUTIONS,
1156  $DIC->language()->txt('tst_list_of_answers_show'),
1157  $DIC->ctrl()->getLinkTargetByClass(array('ilTestResultsGUI', 'ilMyTestSolutionsGUI', 'ilTestEvaluationGUI'))
1158  );
1159  }
1160  }
1161 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTestQuestionSetConfig(ilTestQuestionSetConfig $testQuestionSetConfig)
ILIAS Test InternalRequestService $testrequest
__construct(ilTestAccess $testAccess, ilTestObjectiveOrientedContainer $objectiveParent)
ilTestTabsManager constructor.
const TAB_ID_QUESTIONS
(Sub-)Tab ID constants
setParentBackHref($parentBackHref)
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
setTestOBJ(ilObjTest $testOBJ)
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getManualScoring()
Retrieve the manual scoring settings.
setParentBackLabel($parentBackLabel)
Settings template application class.