ILIAS  release_8 Revision v8.24
class.ilMMTabHandling.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 private int $ref_id;
28
30
32
34
35 protected ilCtrl $ctrl;
36
38
43 public function __construct(int $ref_id)
44 {
45 global $DIC;
46
47 $this->ref_id = $ref_id;
48 $this->tabs = $DIC['ilTabs'];
49 $this->lng = $DIC->language();
50 $this->lng->loadLanguageModule('mme');
51 $this->ctrl = $DIC['ilCtrl'];
52 $this->rbacsystem = $DIC['rbacsystem'];
53 $this->help = $DIC->help();
54 }
55
56 public function initTabs(
57 ?string $tab,
58 ?string $subtab = null,
59 bool $backtab = false,
60 ?string $calling_class = ""
61 ): void {
62 $this->tabs->clearTargets(); // clears Help-ID
63
64 // Help Screen-ID
65 $this->help->setScreenIdComponent('mme');
66 if ($tab !== null) {
67 $this->help->setScreenId($tab);
68 }
69 if ($subtab !== null) {
70 $this->help->setSubScreenId($subtab);
71 }
72
73 if ($this->rbacsystem->checkAccess('visible,read', $this->ref_id)) {
74 $this->tabs->addTab(
77 $this->ctrl->getLinkTargetByClass(ilObjMainMenuGUI::class, ilObjMainMenuGUI::TAB_MAIN)
78 );
80 switch ($tab) {
82 $this->tabs->addSubTab(
85 $this->ctrl->getLinkTargetByClass(ilMMTopItemGUI::class, ilMMTopItemGUI::CMD_VIEW_TOP_ITEMS)
86 );
87 $this->tabs->addSubTab(
90 $this->ctrl->getLinkTargetByClass(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_VIEW_SUB_ITEMS)
91 );
92 $this->tabs->activateSubTab($subtab);
93 break;
94 }
95 if ($subtab === null) {
97 }
98 $this->tabs->activateSubTab($subtab);
99 }
100 if ($this->rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
101 $this->tabs->addTab(
102 'perm_settings',
103 $this->lng->txt('perm_settings'),
104 $this->ctrl->getLinkTargetByClass(array(ilObjMainMenuGUI::class, ilPermissionGUI::class), 'perm')
105 );
106 }
107 if ($backtab) {
108 $this->tabs->clearTargets();
109 if ($calling_class == ilMMSubItemGUI::class) {
110 $this->tabs->setBackTarget($this->lng->txt('tab_back'), $this->ctrl->getLinkTargetByClass(ilMMSubItemGUI::class, $subtab));
111 } else {
112 $this->tabs->setBackTarget($this->lng->txt('tab_back'), $this->ctrl->getLinkTargetByClass(ilObjMainMenuGUI::class, $subtab));
113 }
114 }
115 $this->tabs->activateTab($tab);
116 }
117}
Class ilCtrl provides processing control methods.
Help GUI class.
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initTabs(?string $tab, ?string $subtab=null, bool $backtab=false, ?string $calling_class="")
__construct(int $ref_id)
ilMMTabHandling constructor.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28