ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\GlobalScreen\GUI\Tabs\Tabs Class Reference
+ Collaboration diagram for ILIAS\GlobalScreen\GUI\Tabs\Tabs:

Public Member Functions

 __construct (private Translator $translator, private \ilCtrlInterface $ctrl, private \ilTabsGUI $tabs_gui, private Flow $flow,)
 
 activate (string $tab_id)
 
 build (string $id, string $language_key, array|URI $target, ?Tab $parent=null, ?string $handling_class=null,)
 
 show ()
 
 structure ()
 
 add (Tab ... $tab)
 
 backToMainTab ()
 

Private Attributes

Structure $structure
 
string $active_tab = null
 
string $active_subtab = null
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 31 of file Tabs.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::__construct ( private Translator  $translator,
private \ilCtrlInterface  $ctrl,
private \ilTabsGUI  $tabs_gui,
private Flow  $flow 
)

Definition at line 37 of file Tabs.php.

42 {
43 $this->structure = new Structure();
44 }

References ILIAS\GlobalScreen\GUI\Tabs\Tabs\structure().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::activate ( string  $tab_id)

Definition at line 46 of file Tabs.php.

46 : void
47 {
48 $tab = $this->structure->getById($tab_id);
49 if ($tab === null) {
50 return;
51 }
52 if ($tab->getParent() === null) {
53 $this->active_tab = $tab_id;
54 } else {
55 $this->active_subtab = $tab_id;
56 $this->active_tab = $tab->getParent()->getId();
57 }
58 }

References ILIAS\GlobalScreen\GUI\Tabs\Tabs\structure().

+ Here is the call graph for this function:

◆ add()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::add ( Tab ...  $tab)

Definition at line 160 of file Tabs.php.

160 : void
161 {
162 foreach ($tab as $t) {
163 $this->structure->add($t);
164 }
165 }

References ILIAS\GlobalScreen\GUI\Tabs\Tabs\structure().

+ Here is the call graph for this function:

◆ backToMainTab()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::backToMainTab ( )

Definition at line 167 of file Tabs.php.

167 : void
168 {
169 $this->tabs_gui->clearTargets();
170
171 if (
173 && $this->ctrl->getCmdClass() === strtolower(ilFooterEntriesGUI::class)
174 ) {
175 $this->tabs_gui->setBackTarget(
176 $this->translator->translate('back'),
177 $this->ctrl->getLinkTargetByClass(
178 ilFooterEntriesGUI::class,
180 )
181 );
182 return;
183 }
184
185 $this->tabs_gui->setBackTarget(
186 $this->translator->translate('back'),
187 $this->ctrl->getLinkTargetByClass(
188 ilObjFooterAdministrationGUI::class,
190 )
191 );
192 }

References ilObjFooterAdministrationGUI\CMD_DEFAULT, ilFooterEntriesGUI\CMD_DEFAULT, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ build()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::build ( string  $id,
string  $language_key,
array|URI  $target,
?Tab  $parent = null,
?string  $handling_class = null 
)

Definition at line 60 of file Tabs.php.

66 : Tab {
67 if ($handling_class === null) {
68 if ($target instanceof URI) {
69 throw new \InvalidArgumentException('No handling class given');
70 }
71 if (is_array($target[0])) {
72 // get last element of array without changing the array
73 $handling_class = $target[0][count($target[0]) - 1];
74 } elseif (is_string($target[0])) {
75 $handling_class = $target[0];
76 } else {
77 throw new \InvalidArgumentException('No handling class given');
78 }
79 }
80
81 if ($handling_class === null) {
82 throw new \InvalidArgumentException('No handling class given');
83 }
84 if (!$target instanceof URI) {
85 $target_class = $target[0];
86 $command = $target[1] ?? null;
87 //
88 // if ($parent !== null && !is_array($target_class)) {
89 // $flow = $this->flow->getHereAsFlow();
90 // $flow[] = $target_class;
91 // } else {
92 // $flow = $target_class;
93 // }
94
95 $uri = $this->flow->getTargetURI($target_class, $command);
96 } else {
97 $uri = $target;
98 }
99
100 return new Tab(
101 $id,
102 $language_key,
103 $uri,
104 $handling_class,
105 $parent
106 );
107 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

◆ show()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::show ( )

Definition at line 109 of file Tabs.php.

109 : void
110 {
111 $this->tabs_gui->clearTargets();
112
113 $current_tab = $this->structure->getByHandlingClass(
114 $this->flow->getCurrentClass() ?? ''
115 );
116
117 if (
118 $current_tab !== null
119 && $current_tab->getParent() !== null
120 && $current_tab->getParent()->getParent() !== null
121 ) {
122 // add backtab
123 $this->tabs_gui->setBackTarget(
124 $this->translator->translate('back'),
125 $this->ctrl->getLinkTargetByClass(
126 $current_tab->getParent()->getHandlingClass()
127 )
128 );
129 return;
130 }
131
132 foreach ($this->structure->get() as $tab) {
133 if ($tab->getParent() === null) {
134 $this->tabs_gui->addTab(
135 $tab->getId(),
136 $this->translator->t($tab->getLanguageKey()),
137 (string) $tab->getTarget()
138 );
139 } elseif ($tab->getParent()->getId() === $this->active_tab) {
140 $this->tabs_gui->addSubTab(
141 $tab->getId(),
142 $this->translator->t($tab->getLanguageKey()),
143 (string) $tab->getTarget()
144 );
145 }
146 }
147 if ($this->active_tab !== null) {
148 $this->tabs_gui->activateTab($this->active_tab);
149 }
150 if ($this->active_subtab !== null) {
151 $this->tabs_gui->activateSubTab($this->active_subtab);
152 }
153 }

References ILIAS\GlobalScreen\GUI\Tabs\Tabs\structure().

+ Here is the call graph for this function:

◆ structure()

ILIAS\GlobalScreen\GUI\Tabs\Tabs::structure ( )

Field Documentation

◆ $active_subtab

string ILIAS\GlobalScreen\GUI\Tabs\Tabs::$active_subtab = null
private

Definition at line 35 of file Tabs.php.

◆ $active_tab

string ILIAS\GlobalScreen\GUI\Tabs\Tabs::$active_tab = null
private

Definition at line 34 of file Tabs.php.

◆ $structure

Structure ILIAS\GlobalScreen\GUI\Tabs\Tabs::$structure
private

Definition at line 33 of file Tabs.php.

Referenced by ILIAS\GlobalScreen\GUI\Tabs\Tabs\structure().


The documentation for this class was generated from the following file: