40 $this->ctrl = $DIC->ctrl();
42 $lng = $DIC->language();
46 $this->manual_activation =
false;
47 $this->subtab_manual_activation =
false;
48 $this->temp_var =
"TABS";
49 $this->sub_tabs =
false;
50 $this->back_title =
"";
51 $this->back_target =
"";
52 $this->back_2_target =
"";
53 $this->back_2_title =
"";
63 $this->setup_mode = $a_val;
81 $this->back_title = $a_title;
82 $this->back_target = $a_target;
83 $this->back_frame = $a_frame;
91 $this->back_2_title = $a_title;
92 $this->back_2_target = $a_target;
93 $this->back_2_frame = $a_frame;
103 $this->force_one_tab = $a_val;
143 $a_cmdClass = array();
145 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
146 #$a_cmdClass = strtolower($a_cmdClass); 149 $this->manual_activation =
true;
151 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
152 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
153 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
164 public function addTab($a_id, $a_text, $a_link, $a_frame =
"")
166 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
167 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
181 unset($this->target[
$key]);
198 if ($this->sub_target[
$i][
'id'] == $a_id) {
199 unset($this->sub_target[
$i]);
217 public function replaceTab($a_old_id, $a_new_id, $a_text, $a_link, $a_frame =
'')
219 for (
$i = 0;
$i < count($this->target);
$i++) {
220 if ($this->target[
$i][
'id'] == $a_old_id) {
221 $this->target[
$i] = array();
222 $this->target[
$i] = array(
228 "cmdClass" => array());
243 if (isset($DIC[
"ilHelp"])) {
244 $ilHelp = $DIC[
"ilHelp"];
248 $ilHelp->setScreenIdComponent(
"");
251 $this->target = array();
252 $this->sub_target = array();
253 $this->non_tabbed_link = array();
254 $this->back_title =
"";
255 $this->back_target =
"";
256 $this->back_2_target =
"";
257 $this->back_2_title =
"";
290 $a_cmdClass = array();
292 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
293 #$a_cmdClass = strtolower($a_cmdClass); 296 $this->subtab_manual_activation =
true;
298 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
299 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
300 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
311 public function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
313 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
314 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
331 $this->target[
$key][
'activate'] = $this->target[
$key][
'id'] == $a_id;
334 $this->manual_activation =
true;
336 $this->manual_activation =
false;
364 for (
$i = 0;
$i < count($this->sub_target);
$i++) {
365 $this->sub_target[
$i][
'activate'] = $this->sub_target[
$i][
'id'] == $a_text;
367 $this->subtab_manual_activation =
true;
388 $this->sub_target = array();
395 public function getHTML($a_after_tabs_anchor =
false)
397 return $this->
__getHTML(
false, $this->manual_activation, $a_after_tabs_anchor);
405 return $this->
__getHTML(
true, $this->subtab_manual_activation);
418 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
419 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
428 public function __getHTML($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor =
false)
433 if (isset($DIC[
"ilHelp"])) {
434 $ilHelp = $DIC[
"ilHelp"];
440 if (isset($DIC[
"ilUser"])) {
443 $ilPluginAdmin = null;
444 if (isset($DIC[
"ilPluginAdmin"])) {
445 $ilPluginAdmin = $DIC[
"ilPluginAdmin"];
450 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
451 foreach ($pl_names as $pl) {
453 $gui_class = $ui_plugin->getUIClassInstance();
454 $resp = $gui_class->modifyGUI(
456 $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
457 array(
"tabs" => $this)
466 $cmdClass =
$ilCtrl->getCmdClass();
469 if ($a_get_sub_tabs) {
470 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
475 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
476 if ($a_after_tabs_anchor) {
477 $tpl->touchBlock(
"after_tabs");
481 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
484 if ($this->back_2_title !=
"") {
485 $tpl->setCurrentBlock(
"back_2_tab");
487 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
488 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
489 if ($this->back_2_frame !=
"") {
490 $tpl->setVariable(
"BACK_2_TAB_TARGET",
' target="'.$this->back_2_frame.
'" ');
493 $tpl->parseCurrentBlock();
497 if ($this->back_title !=
"") {
498 $tpl->setCurrentBlock(
"back_tab");
500 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
501 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
502 if ($this->back_frame !=
"") {
503 $tpl->setVariable(
"BACK_TAB_TARGET",
' target="'.$this->back_frame.
'" ');
505 $tpl->parseCurrentBlock();
509 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
514 if ((count($targets) > 1 || $this->force_one_tab) || ($this->back_title !=
"" && !$a_get_sub_tabs)
515 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs)) {
516 foreach ($targets as
$target) {
519 if (!is_array($target[
"cmd"])) {
520 $target[
"cmd"] = array($target[
"cmd"]);
523 (in_array($cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
524 (in_array($cmdClass, $target[
"cmdClass"]) || !$target[
"cmdClass"])) {
525 $tabtype = $pre .
"tabactive";
527 $tabtype = $pre .
"tabinactive";
530 if ($a_manual && $target[
"activate"]) {
531 $tabtype = $pre .
"tabactive";
534 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive") {
535 $tpl->setCurrentBlock(
"sel_text");
536 $tpl->setVariable(
"TXT_SELECTED",
$lng->txt(
"stat_selected"));
537 $tpl->parseCurrentBlock();
540 if ($a_get_sub_tabs) {
545 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
549 $tpl->setCurrentBlock($pre .
"tab");
550 $tpl->setVariable(
"ID", $pre .
"tab_" . $target[
"id"]);
554 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
556 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
558 $pre .
"tab_" . $target[
"id"],
569 $tabtype = in_array($tabtype, array(
"tabactive",
"subtabactive"))
574 $tpl->setVariable($pre2 .
"TAB_TYPE", $tabtype);
576 $hash = (
$ilUser->getPref(
"screen_reader_optimization"))
577 ?
"#after_" . $sr_pre .
"tabs" 581 $tpl->setVariable($pre2 .
"TAB_LINK", $target[
"link"] . $hash);
582 if ($target[
"dir_text"]) {
583 $tpl->setVariable($pre2 .
"TAB_TEXT", $target[
"text"]);
585 $tpl->setVariable($pre2 .
"TAB_TEXT",
$lng->txt($target[
"text"]));
587 if ($target[
"frame"] !=
"") {
588 $tpl->setVariable($pre2 .
"TAB_TARGET",
' target="'.$target[
"frame"].
'" ');
590 $tpl->parseCurrentBlock();
593 if ($a_get_sub_tabs) {
594 $tpl->setVariable(
"TXT_SUBTABS",
$lng->txt(
"subtabs"));
596 $tpl->setVariable(
"TXT_TABS",
$lng->txt(
"tabs"));
599 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
600 foreach ($this->non_tabbed_link as $link) {
601 $tpl->setCurrentBlock(
"tab");
602 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
604 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
605 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
606 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
607 $tpl->setVariable(
"ID",
"nontab_" . $link[
"id"]);
608 $tpl->parseCurrentBlock();
612 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
614 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
616 "nontab_" . $link[
"id"],
636 foreach ($this->target as
$i =>
$target) {
637 if ($this->target[
$i][
'activate']) {
638 return $this->target[
$i][
'id'];
getSetupMode()
Get setup mode.
addSubTabTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
setTabActive($a_id)
DEPRECATED.
activateSubTab($a_id)
Activate a specific subtab identified its id.
getSubTabHTML()
get sub tabs code as html
static get($a_glyph, $a_text="")
Get glyph html.
setBack2Target($a_title, $a_target, $a_frame="")
back target for tow level upper context
addTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
setBackTarget($a_title, $a_target, $a_frame="")
back target for upper context
getForcePresentationOfSingleTab()
Get force presentation of single tab.
replaceTab($a_old_id, $a_new_id, $a_text, $a_link, $a_frame='')
Replace a tab.
setSubTabActive($a_text)
DEPRECATED.
special template class to simplify handling of ITX/PEAR
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
setForcePresentationOfSingleTab($a_val)
Set force presentation of single tab.
addSubTab($a_id, $a_text, $a_link, $a_frame="")
Add a Subtab.
clearSubTabs()
Clear all already added sub tabs.
__getHTML($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor=false)
get tabs code as html
clearTargets()
clear all targets
addNonTabbedLink($a_id, $a_text, $a_link, $a_frame="")
Add a non-tabbed link (outside of tabs at same level)
__construct()
Constructor public.
removeTab($a_id)
Remove a tab identified by its id.
activateTab($a_id)
Activate a specific tab identified its id.
removeSubTab($a_id)
Remove a tab identified by its id.
getHTML($a_after_tabs_anchor=false)
get tabs code as html
setSetupMode($a_val)
Set setup mode.
addTab($a_id, $a_text, $a_link, $a_frame="")
Add a Tab.