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