ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMMTabHandling.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  private ilTabsGUI $tabs;
30 
31  private ilLanguage $lng;
32 
33  protected ilCtrl $ctrl;
34 
35  private ilHelpGUI $help;
36 
41  public function __construct(private int $ref_id)
42  {
43  global $DIC;
44  $this->tabs = $DIC['ilTabs'];
45  $this->lng = $DIC->language();
46  $this->lng->loadLanguageModule('mme');
47  $this->ctrl = $DIC['ilCtrl'];
48  $this->rbacsystem = $DIC['rbacsystem'];
49  $this->help = $DIC->help();
50  }
51 
52  public function initTabs(
53  ?string $tab,
54  ?string $subtab = null,
55  bool $backtab = false,
56  ?string $calling_class = ""
57  ): void {
58  $this->tabs->clearTargets(); // clears Help-ID
59 
60  // Help Screen-ID
61  $this->help->setScreenIdComponent('mme');
62  if ($tab !== null) {
63  $this->help->setScreenId($tab);
64  }
65  if ($subtab !== null) {
66  $this->help->setSubScreenId($subtab);
67  }
68 
69  if ($this->rbacsystem->checkAccess('visible,read', $this->ref_id)) {
70  $this->tabs->addTab(
72  $this->lng->txt(ilObjMainMenuGUI::TAB_MAIN),
73  $this->ctrl->getLinkTargetByClass(ilObjMainMenuGUI::class, ilObjMainMenuGUI::TAB_MAIN)
74  );
75  if ($tab === ilObjMainMenuGUI::TAB_MAIN) {
76  $this->tabs->addSubTab(
79  $this->ctrl->getLinkTargetByClass(ilMMTopItemGUI::class, ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS)
80  );
81  $this->tabs->addSubTab(
84  $this->ctrl->getLinkTargetByClass(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS)
85  );
86  $this->tabs->activateSubTab($subtab);
87  }
88  if ($subtab === null) {
90  }
91  $this->tabs->activateSubTab($subtab);
92  }
93  if ($this->rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
94  $this->tabs->addTab(
95  'perm_settings',
96  $this->lng->txt('perm_settings'),
97  $this->ctrl->getLinkTargetByClass([ilObjMainMenuGUI::class, ilPermissionGUI::class], 'perm')
98  );
99  }
100  if ($backtab) {
101  $this->tabs->clearTargets();
102  if ($calling_class == ilMMSubItemGUI::class) {
103  $this->tabs->setBackTarget($this->lng->txt('tab_back'), $this->ctrl->getLinkTargetByClass(ilMMSubItemGUI::class, $subtab));
104  } else {
105  $this->tabs->setBackTarget($this->lng->txt('tab_back'), $this->ctrl->getLinkTargetByClass(ilObjMainMenuGUI::class, $subtab));
106  }
107  }
108  $this->tabs->activateTab($tab);
109  }
110 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private int $ref_id)
ilMMTabHandling constructor.
Help GUI class.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilMMTabHandling.
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
initTabs(?string $tab, ?string $subtab=null, bool $backtab=false, ?string $calling_class="")