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());
192 $this->target = array();
193 $this->sub_target = array();
194 $this->non_tabbed_link = array();
195 $this->back_title =
"";
196 $this->back_target =
"";
197 $this->back_2_target =
"";
198 $this->back_2_title =
"";
221 function addSubTabTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
227 $a_cmdClass = array();
229 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
230 #$a_cmdClass = strtolower($a_cmdClass);
234 $this->subtab_manual_activation =
true;
236 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
237 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
238 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
249 function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
251 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
252 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
267 foreach($this->target as $key =>
$target)
269 $this->target[$key][
'activate'] = $this->target[$key][
'id'] == $a_id;
273 $this->manual_activation =
true;
277 $this->manual_activation =
false;
305 for($i = 0; $i < count($this->sub_target);$i++)
307 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] == $a_text;
309 $this->subtab_manual_activation =
true;
330 $this->sub_target = array();
337 function getHTML($a_after_tabs_anchor =
false)
339 return $this->
__getHTML(
false,$this->manual_activation, $a_after_tabs_anchor);
347 return $this->
__getHTML(
true,$this->subtab_manual_activation);
361 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
362 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
371 function __getHTML($a_get_sub_tabs,$a_manual, $a_after_tabs_anchor =
false)
376 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
377 foreach ($pl_names as $pl)
380 $gui_class = $ui_plugin->getUIClassInstance();
381 $resp = $gui_class->modifyGUI(
"", $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
382 array(
"tabs" => $this));
385 $cmd = $ilCtrl->getCmd();
386 $cmdClass = $ilCtrl->getCmdClass();
398 if ($a_after_tabs_anchor)
400 $tpl->touchBlock(
"after_tabs");
405 if ($this->back_2_title !=
"")
407 $tpl->setCurrentBlock(
"back_2_tab");
408 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
409 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
410 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
411 $tpl->parseCurrentBlock();
415 if ($this->back_title !=
"")
417 $tpl->setCurrentBlock(
"back_tab");
418 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
419 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
420 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
421 $tpl->parseCurrentBlock();
425 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
430 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
431 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
437 if (!is_array($target[
"cmd"]))
439 $target[
"cmd"] = array($target[
"cmd"]);
443 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
444 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
446 $tabtype = $pre.
"tabactive";
450 $tabtype = $pre.
"tabinactive";
453 if ($a_manual && $target[
"activate"])
455 $tabtype = $pre.
"tabactive";
458 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
460 $tpl->setCurrentBlock(
"sel_text");
461 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
462 $tpl->parseCurrentBlock();
465 $tpl->setCurrentBlock($pre.
"tab");
466 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
467 $hash = ($ilUser->getPref(
"screen_reader_optimization"))
468 ?
"#after_".$sr_pre.
"tabs"
471 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
472 if ($target[
"dir_text"])
474 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
478 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
480 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
481 $tpl->parseCurrentBlock();
486 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
490 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
493 foreach ($this->non_tabbed_link as $link)
495 $tpl->setCurrentBlock(
"tab");
496 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
497 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
498 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
499 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
500 $tpl->parseCurrentBlock();