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 $this->target = array_slice($this->target, $i - 1, 1);
147 public function replaceTab($a_old_id,$a_new_id,$a_text,$a_link,$a_frame =
'')
149 for($i = 0; $i < count($this->target); $i++)
151 if($this->target[$i][
'id'] == $a_old_id)
153 $this->target[$i] = array();
154 $this->target[$i] = array(
160 "cmdClass" => array());
172 $this->target = array();
173 $this->back_title =
"";
174 $this->back_target =
"";
175 $this->back_2_target =
"";
176 $this->back_2_title =
"";
199 function addSubTabTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
205 $a_cmdClass = array();
207 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
208 #$a_cmdClass = strtolower($a_cmdClass);
212 $this->subtab_manual_activation =
true;
214 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
215 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
216 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
227 function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
229 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
230 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
245 for($i = 0; $i < count($this->target);$i++)
247 $this->target[$i][
'activate'] = $this->target[$i][
'id'] == $a_id;
251 $this->manual_activation =
true;
255 $this->manual_activation =
false;
283 for($i = 0; $i < count($this->sub_target);$i++)
285 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] == $a_text;
287 $this->subtab_manual_activation =
true;
308 $this->sub_target = array();
315 function getHTML($a_after_tabs_anchor =
false)
317 return $this->
__getHTML(
false,$this->manual_activation, $a_after_tabs_anchor);
325 return $this->
__getHTML(
true,$this->subtab_manual_activation);
339 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
340 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
349 function __getHTML($a_get_sub_tabs,$a_manual, $a_after_tabs_anchor =
false)
353 $cmd = $ilCtrl->getCmd();
354 $cmdClass = $ilCtrl->getCmdClass();
366 if ($a_after_tabs_anchor)
368 $tpl->touchBlock(
"after_tabs");
373 if ($this->back_2_title !=
"")
375 $tpl->setCurrentBlock(
"back_2_tab");
376 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
377 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
378 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
379 $tpl->parseCurrentBlock();
383 if ($this->back_title !=
"")
385 $tpl->setCurrentBlock(
"back_tab");
386 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
387 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
388 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
389 $tpl->parseCurrentBlock();
393 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
396 if ((count($targets) > 1) || ($this->back_title !=
"" && !$a_get_sub_tabs)
397 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
403 if (!is_array($target[
"cmd"]))
405 $target[
"cmd"] = array($target[
"cmd"]);
409 (in_array(
$cmd, $target[
"cmd"]) || ($target[
"cmd"][0] ==
"" && count($target[
"cmd"]) == 1)) &&
410 (in_array($cmdClass,$target[
"cmdClass"]) || !$target[
"cmdClass"]))
412 $tabtype = $pre.
"tabactive";
416 $tabtype = $pre.
"tabinactive";
419 if ($a_manual && $target[
"activate"])
421 $tabtype = $pre.
"tabactive";
424 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
426 $tpl->setCurrentBlock(
"sel_text");
427 $tpl->setVariable(
"TXT_SELECTED", $lng->txt(
"stat_selected"));
428 $tpl->parseCurrentBlock();
431 $tpl->setCurrentBlock($pre.
"tab");
432 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
433 $hash = ($ilUser->prefs[
"screen_reader_optimization"])
434 ?
"#after_".$sr_pre.
"tabs"
437 $tpl->setVariable($pre2.
"TAB_LINK", $target[
"link"].$hash);
438 if ($target[
"dir_text"])
440 $tpl->setVariable($pre2.
"TAB_TEXT", $target[
"text"]);
444 $tpl->setVariable($pre2.
"TAB_TEXT", $lng->txt($target[
"text"]));
446 $tpl->setVariable($pre2.
"TAB_TARGET", $target[
"frame"]);
447 $tpl->parseCurrentBlock();
452 $tpl->setVariable(
"TXT_SUBTABS", $lng->txt(
"subtabs"));
456 $tpl->setVariable(
"TXT_TABS", $lng->txt(
"tabs"));
459 foreach ($this->non_tabbed_link as $link)
461 $tpl->setCurrentBlock(
"tab");
462 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
463 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
464 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
465 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
466 $tpl->parseCurrentBlock();