35 $this->manual_activation =
false;
36 $this->subtab_manual_activation =
false;
37 $this->temp_var =
"TABS";
38 $this->sub_tabs =
false;
39 $this->back_title =
"";
40 $this->back_target =
"";
41 $this->back_2_target =
"";
42 $this->back_2_title =
"";
50 $this->back_title = $a_title;
51 $this->back_target = $a_target;
52 $this->back_frame = $a_frame;
60 $this->back_2_title = $a_title;
61 $this->back_2_target = $a_target;
62 $this->back_2_frame = $a_frame;
83 function addTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
88 $a_cmdClass = array();
90 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
91 #$a_cmdClass = strtolower($a_cmdClass);
95 $this->manual_activation =
true;
97 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
98 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
99 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
110 function addTab($a_id, $a_text, $a_link, $a_frame =
"")
112 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
113 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
125 foreach($this->target as $key =>
$target)
129 unset($this->target[$key]);
145 for($i = 0; $i < count($this->sub_target); $i++)
147 if($this->sub_target[$i][
'id'] == $a_id)
149 unset($this->sub_target[$i]);
167 public function replaceTab($a_old_id,$a_new_id,$a_text,$a_link,$a_frame =
'')
169 for($i = 0; $i < count($this->target); $i++)
171 if($this->target[$i][
'id'] == $a_old_id)
173 $this->target[$i] = array();
174 $this->target[$i] = array(
180 "cmdClass" => array());
194 $ilHelp->setScreenIdComponent(
"");
196 $this->target = array();
197 $this->sub_target = array();
198 $this->non_tabbed_link = array();
199 $this->back_title =
"";
200 $this->back_target =
"";
201 $this->back_2_target =
"";
202 $this->back_2_title =
"";
225 function addSubTabTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
231 $a_cmdClass = array();
233 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
234 #$a_cmdClass = strtolower($a_cmdClass);
238 $this->subtab_manual_activation =
true;
240 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
241 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
242 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
253 function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
255 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
256 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
271 foreach($this->target as $key =>
$target)
273 $this->target[$key][
'activate'] = $this->target[$key][
'id'] == $a_id;
277 $this->manual_activation =
true;
281 $this->manual_activation =
false;
309 for($i = 0; $i < count($this->sub_target);$i++)
311 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] == $a_text;
313 $this->subtab_manual_activation =
true;
334 $this->sub_target = array();
341 function getHTML($a_after_tabs_anchor =
false)
343 return $this->
__getHTML(
false,$this->manual_activation, $a_after_tabs_anchor);
351 return $this->
__getHTML(
true,$this->subtab_manual_activation);
364 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
365 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
374 function __getHTML($a_get_sub_tabs,$a_manual, $a_after_tabs_anchor =
false)
379 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
380 foreach ($pl_names as $pl)
383 $gui_class = $ui_plugin->getUIClassInstance();
384 $resp = $gui_class->modifyGUI(
"", $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
385 array(
"tabs" => $this));
388 $cmd = $ilCtrl->getCmd();
389 $cmdClass = $ilCtrl->getCmdClass();
393 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
400 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
401 if ($a_after_tabs_anchor)
403 $tpl->touchBlock(
"after_tabs");
408 if ($this->back_2_title !=
"")
410 $tpl->setCurrentBlock(
"back_2_tab");
411 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
412 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
413 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
414 $tpl->parseCurrentBlock();
418 if ($this->back_title !=
"")
420 $tpl->setCurrentBlock(
"back_tab");
421 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
422 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
423 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
424 $tpl->parseCurrentBlock();
428 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
433 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
434 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
440 if (!is_array($target[
"cmd"]))
442 $target[
"cmd"] = array($target[
"cmd"]);
446 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
447 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
449 $tabtype = $pre.
"tabactive";
453 $tabtype = $pre.
"tabinactive";
456 if ($a_manual && $target[
"activate"])
458 $tabtype = $pre.
"tabactive";
461 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
463 $tpl->setCurrentBlock(
"sel_text");
464 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
465 $tpl->parseCurrentBlock();
474 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
477 $tpl->setCurrentBlock($pre.
"tab");
478 $tpl->setVariable(
"ID", $pre.
"tab_".$target[
"id"]);
481 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
484 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
486 "bottom center",
"top center",
false);
489 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
490 $hash = ($ilUser->getPref(
"screen_reader_optimization"))
491 ?
"#after_".$sr_pre.
"tabs"
494 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
495 if ($target[
"dir_text"])
497 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
501 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
503 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
504 $tpl->parseCurrentBlock();
509 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
513 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
516 foreach ($this->non_tabbed_link as $link)
518 $tpl->setCurrentBlock(
"tab");
519 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
520 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
521 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
522 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
523 $tpl->setVariable(
"ID",
"nontab_".$link[
"id"]);
524 $tpl->parseCurrentBlock();
527 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
530 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
532 "bottom center",
"top center",
false);