53 $this->
ctrl = $DIC->ctrl();
54 $this->tpl =
$DIC->ui()->mainTemplate();
57 $this->manual_activation =
false;
58 $this->subtab_manual_activation =
false;
59 $this->temp_var =
"TABS";
60 $this->sub_tabs =
false;
61 $this->back_title =
"";
62 $this->back_target =
"";
63 $this->back_2_target =
"";
64 $this->back_2_title =
"";
69 $this->setup_mode = $a_val;
82 $this->back_title = $a_title;
83 $this->back_target = $a_target;
84 $this->back_frame = $a_frame;
92 $this->back_2_title = $a_title;
93 $this->back_2_target = $a_target;
94 $this->back_2_frame = $a_frame;
99 $this->force_one_tab = $a_val;
104 return $this->force_one_tab;
117 string $a_frame =
"",
118 bool $a_activate =
false,
119 bool $a_dir_text =
false
122 $a_cmdClass = array();
124 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
127 $this->manual_activation =
true;
129 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
130 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
131 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
143 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
144 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
152 foreach ($this->target as
$key => $target) {
153 if ($target[
'id'] == $a_id) {
154 unset($this->target[
$key]);
164 foreach ($this->sub_target as
$i => $sub_target) {
165 if ($this->sub_target[
$i][
'id'] == $a_id) {
166 unset($this->sub_target[
$i]);
181 for (
$i = 0, $iMax = count($this->target);
$i < $iMax;
$i++) {
182 if ($this->target[
$i][
'id'] == $a_old_id) {
183 $this->target[
$i] = array(
189 "cmdClass" => array());
201 $ilHelp =
$DIC[
"ilHelp"] ??
null;
203 if (!$this->getSetupMode()) {
204 $ilHelp->setScreenIdComponent(
"");
207 $this->target = array();
208 $this->sub_target = array();
209 $this->non_tabbed_link = array();
210 $this->back_title =
"";
211 $this->back_target =
"";
212 $this->back_2_target =
"";
213 $this->back_2_title =
"";
214 $this->setTabActive(
"");
215 $this->setSubTabActive(
"");
228 string $a_frame =
"",
229 bool $a_activate =
false,
230 bool $a_dir_text =
false
233 $a_cmdClass = array();
235 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
236 #$a_cmdClass = strtolower($a_cmdClass);
239 $this->subtab_manual_activation =
true;
241 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
242 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
243 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
252 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
253 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
261 foreach ($this->target as
$key => $target) {
262 $this->target[
$key][
'activate'] = $this->target[
$key][
'id'] === $a_id;
265 $this->manual_activation =
true;
267 $this->manual_activation =
false;
273 $this->setTabActive($a_id);
281 for (
$i = 0, $iMax = count($this->sub_target);
$i < $iMax;
$i++) {
282 $this->sub_target[
$i][
'activate'] = $this->sub_target[
$i][
'id'] === $a_text;
284 $this->subtab_manual_activation =
true;
289 $this->setSubTabActive($a_id);
294 $this->sub_target = array();
297 public function getHTML(
bool $a_after_tabs_anchor =
false): string
299 return $this->__getHTML(
false, $a_after_tabs_anchor);
304 return $this->__getHTML(
true);
313 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
314 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
319 $this->non_tabbed_link = [];
322 private function __getHTML(
323 bool $a_get_sub_tabs,
324 bool $a_after_tabs_anchor =
false
334 $ilHelp =
$DIC[
"ilHelp"] ??
null;
336 $ilCtrl = $this->ctrl;
339 if (isset(
$DIC[
"ilUser"])) {
342 $component_factory =
$DIC[
"component.factory"] ??
null;
345 if ($component_factory && !$this->getSetupMode()) {
346 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
347 $gui_class =
$plugin->getUIClassInstance();
348 $resp = $gui_class->modifyGUI(
350 $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
351 array(
"tabs" => $this)
358 if (!$this->getSetupMode()) {
359 $cmd = $ilCtrl->getCmd();
360 $cmdClass = $ilCtrl->getCmdClass();
363 if ($a_get_sub_tabs) {
364 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
369 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
370 if ($a_after_tabs_anchor) {
371 $tpl->touchBlock(
"after_tabs");
376 if ($this->back_2_title !==
"") {
377 $tpl->setCurrentBlock(
"back_2_tab");
380 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
381 if ($this->back_2_frame !==
"") {
382 $tpl->setVariable(
"BACK_2_TAB_TARGET",
' target="' . $this->back_2_frame .
'" ');
385 $tpl->parseCurrentBlock();
389 if ($this->back_title !==
"") {
390 $tpl->setCurrentBlock(
"back_tab");
393 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
394 if ($this->back_frame !==
"") {
395 $tpl->setVariable(
"BACK_TAB_TARGET",
' target="' . $this->back_frame .
'" ');
397 $tpl->parseCurrentBlock();
401 $targets = $a_get_sub_tabs ? $this->sub_target : $this->target;
406 if ((count($targets) > 1 || $this->force_one_tab) || ($this->back_title !==
"" && !$a_get_sub_tabs)
407 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs)) {
408 foreach ($targets as $target) {
411 if (isset($target[
'cmd'])) {
412 if (!is_array($target[
'cmd'])) {
413 $target[
'cmd'] = [$target[
'cmd']];
419 if ($this->isTabActive($a_get_sub_tabs, $target, $cmd, $cmdClass)) {
420 $tabtype = $pre .
"tabactive";
422 $tabtype = $pre .
"tabinactive";
425 if (($a_get_sub_tabs ? $this->subtab_manual_activation : $this->manual_activation) && ($target[
"activate"] ??
false)) {
426 $tabtype = $pre .
"tabactive";
429 if ($tabtype ===
"tabactive" || $tabtype ===
"subtabactive") {
430 $tpl->setCurrentBlock(
"sel_text");
431 $tpl->setVariable(
"TXT_SELECTED",
$lng->txt(
"stat_selected"));
432 $tpl->parseCurrentBlock();
434 if (!$this->getSetupMode()) {
435 if ($a_get_sub_tabs) {
440 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
444 $tpl->setCurrentBlock($pre .
"tab");
445 $tpl->setVariable(
"ID", $pre .
"tab_" . $target[
"id"]);
448 if (!$this->getSetupMode()) {
449 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
452 $pre .
"tab_" . $target[
"id"],
463 $tabtype = in_array($tabtype, array(
"tabactive",
"subtabactive"))
468 $tpl->setVariable($pre2 .
"TAB_TYPE", $tabtype);
470 $tpl->setVariable($pre2 .
"TAB_LINK", $target[
"link"] . $hash);
471 if ($target[
"dir_text"]) {
472 $tpl->setVariable($pre2 .
"TAB_TEXT", $target[
"text"]);
474 $tpl->setVariable($pre2 .
"TAB_TEXT",
$lng->txt($target[
"text"]));
476 if ($target[
"frame"] !=
"") {
477 $tpl->setVariable($pre2 .
"TAB_TARGET",
' target="' . $target[
"frame"] .
'" ');
479 $tpl->parseCurrentBlock();
482 if ($a_get_sub_tabs) {
483 $tpl->setVariable(
"TXT_SUBTABS", $this->getTabTextOfId($this->getActiveTab()) .
": " .
$lng->txt(
"subtabs"));
485 $tpl->setVariable(
"TXT_TABS",
$lng->txt(
"tabs"));
486 $tpl->setVariable(
"LAST_TAB_LABEL",
$lng->txt(
"show_more"));
489 foreach ($this->non_tabbed_link as $link) {
490 $tpl->setCurrentBlock(
"tab");
491 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
493 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
494 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
495 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
496 $tpl->setVariable(
"ID",
"nontab_" . $link[
"id"]);
497 $tpl->parseCurrentBlock();
500 if (!$this->getSetupMode()) {
501 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
504 "nontab_" . $link[
"id"],
524 foreach ($this->target as
$i => $target) {
525 if ($this->target[
$i][
'id'] ==
$id) {
526 if ($target[
"dir_text"]) {
527 return $target[
"text"];
529 return $this->
lng->txt($target[
"text"]);
538 foreach ($this->target as
$i => $target) {
539 if ($this->target[
$i][
'activate'] ??
null) {
540 return $this->target[
$i][
'id'];
548 return $this->target !== [];
551 private function isTabActive(
bool $isSubTabsContext, array $target, ?
string $cmd, ?
string $cmdClass): bool
553 if (($isSubTabsContext && $this->subtab_manual_activation) || (!$isSubTabsContext && $this->manual_activation)) {
557 $cmdClass = (string) $cmdClass;
558 $cmd = (string) $cmd;
560 $targetMatchesCmdClass = (
561 !$target[
'cmdClass'] ||
562 in_array(strtolower($cmdClass), array_map(
'strtolower', $target[
'cmdClass']),
true)
565 $targetMatchesCmd = (
566 in_array(strtolower($cmd), array_map(
'strtolower', $target[
'cmd']),
true) ||
567 (count($target[
'cmd']) === 1 && $target[
'cmd'][0] ===
'')
570 return $targetMatchesCmd && $targetMatchesCmdClass;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ilCtrl provides processing control methods.
static get(string $a_glyph, string $a_text="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setBack2Target(string $a_title, string $a_target, string $a_frame="")
addTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
Add a Tab.
getHTML(bool $a_after_tabs_anchor=false)
removeTab(string $a_id)
Remove a tab identified by its id.
bool $subtab_manual_activation
replaceTab(string $a_old_id, string $a_new_id, string $a_text, string $a_link, string $a_frame='')
Replace a tab.
getForcePresentationOfSingleTab()
ilGlobalTemplateInterface $tpl
setBackTarget(string $a_title, string $a_target, string $a_frame="")
setForcePresentationOfSingleTab(bool $a_val)
addNonTabbedLink(string $a_id, string $a_text, string $a_link, string $a_frame="")
setTabActive(string $a_id)
addTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
activateSubTab(string $a_id)
clearTargets()
clear all targets
setSetupMode(bool $a_val)
activateTab(string $a_id)
isTabActive(bool $isSubTabsContext, array $target, ?string $cmd, ?string $cmdClass)
getTabTextOfId(string $id)
setSubTabActive(string $a_text)
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
removeSubTab(string $a_id)
Remove a subtab identified by its id.
addSubTabTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)
special template class to simplify handling of ITX/PEAR
static secureUrl(string $url)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc