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");
439 if ($this->back_2_title !=
"")
441 $tpl->setCurrentBlock(
"back_2_tab");
442 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
443 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
444 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
445 $tpl->parseCurrentBlock();
449 if ($this->back_title !=
"")
451 $tpl->setCurrentBlock(
"back_tab");
452 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
453 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
454 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
455 $tpl->parseCurrentBlock();
459 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
464 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
465 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
471 if (!is_array($target[
"cmd"]))
473 $target[
"cmd"] = array($target[
"cmd"]);
476 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
477 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
479 $tabtype = $pre.
"tabactive";
483 $tabtype = $pre.
"tabinactive";
486 if ($a_manual && $target[
"activate"])
488 $tabtype = $pre.
"tabactive";
491 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
493 $tpl->setCurrentBlock(
"sel_text");
494 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
495 $tpl->parseCurrentBlock();
507 $ilHelp->setDefaultScreenId($part, $target[
"id"]);
511 $tpl->setCurrentBlock($pre.
"tab");
512 $tpl->setVariable(
"ID", $pre.
"tab_".$target[
"id"]);
517 $ttext = $ilHelp->getTabTooltipText($target[
"id"]);
520 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
522 "bottom center",
"top center",
false);
526 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
529 $hash = ($ilUser->getPref(
"screen_reader_optimization"))
530 ?
"#after_".$sr_pre.
"tabs"
534 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
535 if ($target[
"dir_text"])
537 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
541 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
543 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
544 $tpl->parseCurrentBlock();
549 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
553 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
556 foreach ($this->non_tabbed_link as $link)
558 $tpl->setCurrentBlock(
"tab");
559 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
560 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
561 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
562 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
563 $tpl->setVariable(
"ID",
"nontab_".$link[
"id"]);
564 $tpl->parseCurrentBlock();
569 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
572 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
574 "bottom center",
"top center",
false);
589 foreach($this->target as $i =>
$target){
590 if($this->target[$i][
'activate'])
591 return $this->target[$i][
'id'];