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 for($i = 0; $i < count($this->target); $i++)
127 if($this->target[$i][
'id'] == $a_id)
129 unset($this->target[$i]);
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 for($i = 0; $i < count($this->target);$i++)
269 $this->target[$i][
'activate'] = $this->target[$i][
'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)
375 $cmd = $ilCtrl->getCmd();
376 $cmdClass = $ilCtrl->getCmdClass();
388 if ($a_after_tabs_anchor)
390 $tpl->touchBlock(
"after_tabs");
395 if ($this->back_2_title !=
"")
397 $tpl->setCurrentBlock(
"back_2_tab");
398 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
399 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
400 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
401 $tpl->parseCurrentBlock();
405 if ($this->back_title !=
"")
407 $tpl->setCurrentBlock(
"back_tab");
408 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
409 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
410 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
411 $tpl->parseCurrentBlock();
415 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
420 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
421 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
427 if (!is_array($target[
"cmd"]))
429 $target[
"cmd"] = array($target[
"cmd"]);
433 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
434 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
436 $tabtype = $pre.
"tabactive";
440 $tabtype = $pre.
"tabinactive";
443 if ($a_manual && $target[
"activate"])
445 $tabtype = $pre.
"tabactive";
448 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
450 $tpl->setCurrentBlock(
"sel_text");
451 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
452 $tpl->parseCurrentBlock();
455 $tpl->setCurrentBlock($pre.
"tab");
456 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
457 $hash = ($ilUser->getPref(
"screen_reader_optimization"))
458 ?
"#after_".$sr_pre.
"tabs"
461 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
462 if ($target[
"dir_text"])
464 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
468 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
470 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
471 $tpl->parseCurrentBlock();
476 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
480 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
483 foreach ($this->non_tabbed_link as $link)
485 $tpl->setCurrentBlock(
"tab");
486 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
487 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
488 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
489 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
490 $tpl->parseCurrentBlock();