36 $this->manual_activation =
false;
37 $this->subtab_manual_activation =
false;
38 $this->temp_var =
"TABS";
39 $this->sub_tabs =
false;
40 $this->back_title =
"";
41 $this->back_target =
"";
42 $this->back_2_target =
"";
43 $this->back_2_title =
"";
53 $this->setup_mode = $a_val;
71 $this->back_title = $a_title;
72 $this->back_target = $a_target;
73 $this->back_frame = $a_frame;
81 $this->back_2_title = $a_title;
82 $this->back_2_target = $a_target;
83 $this->back_2_frame = $a_frame;
104 function addTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
109 $a_cmdClass = array();
111 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
112 #$a_cmdClass = strtolower($a_cmdClass);
116 $this->manual_activation =
true;
118 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
119 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
120 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
131 function addTab($a_id, $a_text, $a_link, $a_frame =
"")
133 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
134 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
146 foreach($this->target as $key =>
$target)
150 unset($this->target[$key]);
167 if($this->sub_target[$i][
'id'] == $a_id)
169 unset($this->sub_target[$i]);
187 public function replaceTab($a_old_id,$a_new_id,$a_text,$a_link,$a_frame =
'')
189 for($i = 0; $i < count($this->target); $i++)
191 if($this->target[$i][
'id'] == $a_old_id)
193 $this->target[$i] = array();
194 $this->target[$i] = array(
200 "cmdClass" => array());
216 $ilHelp->setScreenIdComponent(
"");
219 $this->target = array();
220 $this->sub_target = array();
221 $this->non_tabbed_link = array();
222 $this->back_title =
"";
223 $this->back_target =
"";
224 $this->back_2_target =
"";
225 $this->back_2_title =
"";
248 function addSubTabTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
254 $a_cmdClass = array();
256 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
257 #$a_cmdClass = strtolower($a_cmdClass);
261 $this->subtab_manual_activation =
true;
263 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
264 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
265 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
276 function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
278 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
279 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
294 foreach($this->target as $key =>
$target)
296 $this->target[$key][
'activate'] = $this->target[$key][
'id'] == $a_id;
300 $this->manual_activation =
true;
304 $this->manual_activation =
false;
332 for($i = 0; $i < count($this->sub_target);$i++)
334 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] == $a_text;
336 $this->subtab_manual_activation =
true;
357 $this->sub_target = array();
364 function getHTML($a_after_tabs_anchor =
false)
366 return $this->
__getHTML(
false,$this->manual_activation, $a_after_tabs_anchor);
374 return $this->
__getHTML(
true,$this->subtab_manual_activation);
387 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
388 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
397 function __getHTML($a_get_sub_tabs,$a_manual, $a_after_tabs_anchor =
false)
404 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
405 foreach ($pl_names as $pl)
408 $gui_class = $ui_plugin->getUIClassInstance();
409 $resp = $gui_class->modifyGUI(
"", $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
410 array(
"tabs" => $this));
418 $cmd = $ilCtrl->getCmd();
419 $cmdClass = $ilCtrl->getCmdClass();
424 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
431 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
432 if ($a_after_tabs_anchor)
434 $tpl->touchBlock(
"after_tabs");
438 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
441 if ($this->back_2_title !=
"")
443 $tpl->setCurrentBlock(
"back_2_tab");
445 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
446 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
447 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
448 $tpl->parseCurrentBlock();
452 if ($this->back_title !=
"")
454 $tpl->setCurrentBlock(
"back_tab");
456 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
457 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
458 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
459 $tpl->parseCurrentBlock();
463 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
468 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
469 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
475 if (!is_array($target[
"cmd"]))
477 $target[
"cmd"] = array($target[
"cmd"]);
480 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
481 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
483 $tabtype = $pre.
"tabactive";
487 $tabtype = $pre.
"tabinactive";
490 if ($a_manual && $target[
"activate"])
492 $tabtype = $pre.
"tabactive";
495 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
497 $tpl->setCurrentBlock(
"sel_text");
498 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
499 $tpl->parseCurrentBlock();
511 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
515 $tpl->setCurrentBlock($pre.
"tab");
516 $tpl->setVariable(
"ID", $pre.
"tab_".$target[
"id"]);
521 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
524 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
526 "bottom center",
"top center",
false);
531 $tabtype = in_array($tabtype, array(
"tabactive",
"subtabactive"))
536 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
539 $hash = ($ilUser->getPref(
"screen_reader_optimization"))
540 ?
"#after_".$sr_pre.
"tabs"
544 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
545 if ($target[
"dir_text"])
547 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
551 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
553 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
554 $tpl->parseCurrentBlock();
559 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
563 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
566 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
567 foreach ($this->non_tabbed_link as $link)
569 $tpl->setCurrentBlock(
"tab");
570 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
572 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
573 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
574 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
575 $tpl->setVariable(
"ID",
"nontab_".$link[
"id"]);
576 $tpl->parseCurrentBlock();
581 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
584 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
586 "bottom center",
"top center",
false);
601 foreach($this->target as $i =>
$target){
602 if($this->target[$i][
'activate'])
603 return $this->target[$i][
'id'];