55 $this->
ctrl = $DIC->ctrl();
56 $this->tpl = $DIC->ui()->mainTemplate();
57 $lng = $DIC->language();
59 $this->manual_activation =
false;
60 $this->subtab_manual_activation =
false;
61 $this->temp_var =
"TABS";
62 $this->sub_tabs =
false;
63 $this->back_title =
"";
64 $this->back_target =
"";
65 $this->back_2_target =
"";
66 $this->back_2_title =
"";
69 protected function symbol(): \
ILIAS\Repository\Symbol\SymbolAdapterGUI
72 return $DIC->repository()->internal()->gui()->symbol();
77 $this->setup_mode = $a_val;
90 $this->back_title = $a_title;
91 $this->back_target = $a_target;
92 $this->back_frame = $a_frame;
100 $this->back_2_title = $a_title;
101 $this->back_2_target = $a_target;
102 $this->back_2_frame = $a_frame;
107 $this->force_one_tab = $a_val;
125 string $a_frame =
"",
126 bool $a_activate =
false,
127 bool $a_dir_text =
false 130 $a_cmdClass = array();
132 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
135 $this->manual_activation =
true;
137 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
138 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
139 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
151 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
152 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
160 foreach ($this->target as
$key => $target) {
161 if ($target[
'id'] == $a_id) {
162 unset($this->target[
$key]);
172 foreach ($this->sub_target as $i => $sub_target) {
173 if ($this->sub_target[$i][
'id'] == $a_id) {
174 unset($this->sub_target[$i]);
189 for ($i = 0, $iMax = count($this->target); $i < $iMax; $i++) {
190 if ($this->target[$i][
'id'] == $a_old_id) {
191 $this->target[$i] = array(
197 "cmdClass" => array());
209 $ilHelp = $DIC[
"ilHelp"] ?? null;
212 $ilHelp->setScreenIdComponent(
"");
215 $this->target = array();
216 $this->sub_target = array();
217 $this->non_tabbed_link = array();
218 $this->back_title =
"";
219 $this->back_target =
"";
220 $this->back_2_target =
"";
221 $this->back_2_title =
"";
236 string $a_frame =
"",
237 bool $a_activate =
false,
238 bool $a_dir_text =
false 241 $a_cmdClass = array();
243 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
244 #$a_cmdClass = strtolower($a_cmdClass); 247 $this->subtab_manual_activation =
true;
249 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
250 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
251 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
260 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
261 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
269 foreach ($this->target as
$key => $target) {
270 $this->target[
$key][
'activate'] = $this->target[
$key][
'id'] === $a_id;
273 $this->manual_activation =
true;
275 $this->manual_activation =
false;
289 for ($i = 0, $iMax = count($this->sub_target); $i < $iMax; $i++) {
290 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] === $a_text;
292 $this->subtab_manual_activation =
true;
302 $this->sub_target = array();
305 public function getHTML(
bool $a_after_tabs_anchor =
false): string
307 return $this->__getHTML(
false, $a_after_tabs_anchor);
312 return $this->__getHTML(
true);
321 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
322 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
327 $this->non_tabbed_link = [];
330 private function __getHTML(
331 bool $a_get_sub_tabs,
332 bool $a_after_tabs_anchor =
false 342 $ilHelp = $DIC[
"ilHelp"] ?? null;
347 if (isset($DIC[
"ilUser"])) {
348 $ilUser = $DIC->user();
350 $component_factory = $DIC[
"component.factory"] ?? null;
354 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
355 $gui_class =
$plugin->getUIClassInstance();
356 $resp = $gui_class->modifyGUI(
358 $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
359 array(
"tabs" => $this)
367 $cmd = $ilCtrl->getCmd();
368 $cmdClass = $ilCtrl->getCmdClass();
371 if ($a_get_sub_tabs) {
372 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
377 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
378 if ($a_after_tabs_anchor) {
384 if ($this->back_2_title !==
"") {
388 $tpl->
setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
389 if ($this->back_2_frame !==
"") {
390 $tpl->
setVariable(
"BACK_2_TAB_TARGET",
' target="' . $this->back_2_frame .
'" ');
397 if ($this->back_title !==
"") {
401 $tpl->
setVariable(
"BACK_TAB_TEXT", $this->back_title);
402 if ($this->back_frame !==
"") {
403 $tpl->
setVariable(
"BACK_TAB_TARGET",
' target="' . $this->back_frame .
'" ');
409 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
414 if ((count($targets) > 1 || $this->force_one_tab) || ($this->back_title !==
"" && !$a_get_sub_tabs)
415 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs)) {
416 foreach ($targets as $target) {
419 if (isset($target[
'cmd'])) {
420 if (!is_array($target[
'cmd'])) {
421 $target[
'cmd'] = [$target[
'cmd']];
427 if ($this->
isTabActive($a_get_sub_tabs, $target, $cmd, $cmdClass)) {
428 $tabtype = $pre .
"tabactive";
430 $tabtype = $pre .
"tabinactive";
433 if (($a_get_sub_tabs ? $this->subtab_manual_activation : $this->manual_activation) && ($target[
"activate"] ??
false)) {
434 $tabtype = $pre .
"tabactive";
437 if ($tabtype ===
"tabactive" || $tabtype ===
"subtabactive") {
443 if ($a_get_sub_tabs) {
448 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
453 $tpl->
setVariable(
"ID", $pre .
"tab_" . $target[
"id"]);
457 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
460 $pre .
"tab_" . $target[
"id"],
471 $tabtype = in_array($tabtype, array(
"tabactive",
"subtabactive"))
478 $tpl->
setVariable($pre2 .
"TAB_LINK", $target[
"link"] . $hash);
479 if ($target[
"dir_text"]) {
480 $tpl->
setVariable($pre2 .
"TAB_TEXT", $target[
"text"]);
482 $tpl->
setVariable($pre2 .
"TAB_TEXT", $lng->
txt($target[
"text"]));
484 if ($target[
"frame"] !=
"") {
485 $tpl->
setVariable($pre2 .
"TAB_TARGET",
' target="' . $target[
"frame"] .
'" ');
490 if ($a_get_sub_tabs) {
497 foreach ($this->non_tabbed_link as $link) {
509 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
512 "nontab_" . $link[
"id"],
532 foreach ($this->target as $i => $target) {
533 if ($this->target[$i][
'id'] == $id) {
534 if ($target[
"dir_text"]) {
535 return $target[
"text"];
537 return $this->
lng->txt($target[
"text"]);
546 foreach ($this->target as $i => $target) {
547 if ($this->target[$i][
'activate'] ?? null) {
548 return $this->target[$i][
'id'];
556 return $this->target !== [];
559 private function isTabActive(
bool $isSubTabsContext, array $target, ?
string $cmd, ?
string $cmdClass): bool
561 if (($isSubTabsContext && $this->subtab_manual_activation) || (!$isSubTabsContext && $this->manual_activation)) {
565 $cmdClass = (string) $cmdClass;
566 $cmd = (string) $cmd;
568 $targetMatchesCmdClass = (
569 !$target[
'cmdClass'] ||
570 in_array(strtolower($cmdClass), array_map(
'strtolower', $target[
'cmdClass']),
true)
573 $targetMatchesCmd = (
574 in_array(strtolower($cmd), array_map(
'strtolower', $target[
'cmd']),
true) ||
575 (count($target[
'cmd']) === 1 && $target[
'cmd'][0] ===
'')
578 return $targetMatchesCmd && $targetMatchesCmdClass;
removeSubTab(string $a_id)
Remove a subtab identified by its id.
setBack2Target(string $a_title, string $a_target, string $a_frame="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
addTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
touchBlock(string $block)
overwrites ITX::touchBlock.
Class ChatMainBarProvider .
activateSubTab(string $a_id)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
addNonTabbedLink(string $a_id, string $a_text, string $a_link, string $a_frame="")
static secureUrl(string $url)
getForcePresentationOfSingleTab()
getHTML(bool $a_after_tabs_anchor=false)
setTabActive(string $a_id)
addSubTabTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
replaceTab(string $a_old_id, string $a_new_id, string $a_text, string $a_link, string $a_frame='')
Replace a tab.
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
setBackTarget(string $a_title, string $a_target, string $a_frame="")
getTabTextOfId(string $id)
bool $subtab_manual_activation
clearTargets()
clear all targets
ilGlobalTemplateInterface $tpl
setSetupMode(bool $a_val)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
activateTab(string $a_id)
removeTab(string $a_id)
Remove a tab identified by its id.
setForcePresentationOfSingleTab(bool $a_val)
setSubTabActive(string $a_text)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
isTabActive(bool $isSubTabsContext, array $target, ?string $cmd, ?string $cmdClass)
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.