38 $this->manual_activation =
false;
39 $this->subtab_manual_activation =
false;
40 $this->temp_var =
"TABS";
41 $this->sub_tabs =
false;
42 $this->back_title =
"";
43 $this->back_target =
"";
44 $this->back_2_target =
"";
45 $this->back_2_title =
"";
55 $this->setup_mode = $a_val;
73 $this->back_title = $a_title;
74 $this->back_target = $a_target;
75 $this->back_frame = $a_frame;
83 $this->back_2_title = $a_title;
84 $this->back_2_target = $a_target;
85 $this->back_2_frame = $a_frame;
95 $this->force_one_tab = $a_val;
125 function addTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
130 $a_cmdClass = array();
132 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
133 #$a_cmdClass = strtolower($a_cmdClass);
137 $this->manual_activation =
true;
139 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
140 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
141 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
152 function addTab($a_id, $a_text, $a_link, $a_frame =
"")
154 $this->target[] = array(
"text" => $a_text,
"link" => $a_link,
155 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
167 foreach($this->target as $key =>
$target)
171 unset($this->target[$key]);
188 if($this->sub_target[$i][
'id'] == $a_id)
190 unset($this->sub_target[$i]);
208 public function replaceTab($a_old_id,$a_new_id,$a_text,$a_link,$a_frame =
'')
210 for($i = 0; $i < count($this->target); $i++)
212 if($this->target[$i][
'id'] == $a_old_id)
214 $this->target[$i] = array();
215 $this->target[$i] = array(
221 "cmdClass" => array());
237 $ilHelp->setScreenIdComponent(
"");
240 $this->target = array();
241 $this->sub_target = array();
242 $this->non_tabbed_link = array();
243 $this->back_title =
"";
244 $this->back_target =
"";
245 $this->back_2_target =
"";
246 $this->back_2_title =
"";
269 function addSubTabTarget($a_text, $a_link, $a_cmd =
"", $a_cmdClass =
"", $a_frame =
"", $a_activate =
false,
275 $a_cmdClass = array();
277 $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass;
278 #$a_cmdClass = strtolower($a_cmdClass);
282 $this->subtab_manual_activation =
true;
284 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
285 "cmd" => $a_cmd,
"cmdClass" => $a_cmdClass,
"frame" => $a_frame,
286 "activate" => $a_activate,
"dir_text" => $a_dir_text,
"id" => $a_text);
297 function addSubTab($a_id, $a_text, $a_link, $a_frame =
"")
299 $this->sub_target[] = array(
"text" => $a_text,
"link" => $a_link,
300 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
316 foreach($this->target as $key =>
$target)
318 $this->target[$key][
'activate'] = $this->target[$key][
'id'] == $a_id;
322 $this->manual_activation =
true;
326 $this->manual_activation =
false;
354 for($i = 0; $i < count($this->sub_target);$i++)
356 $this->sub_target[$i][
'activate'] = $this->sub_target[$i][
'id'] == $a_text;
358 $this->subtab_manual_activation =
true;
379 $this->sub_target = array();
386 function getHTML($a_after_tabs_anchor =
false)
388 return $this->
__getHTML(
false,$this->manual_activation, $a_after_tabs_anchor);
396 return $this->
__getHTML(
true,$this->subtab_manual_activation);
409 $this->non_tabbed_link[] = array(
"text" => $a_text,
"link" => $a_link,
410 "frame" => $a_frame,
"dir_text" =>
true,
"id" => $a_id,
"cmdClass" => array());
419 function __getHTML($a_get_sub_tabs,$a_manual, $a_after_tabs_anchor =
false)
426 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
427 foreach ($pl_names as $pl)
430 $gui_class = $ui_plugin->getUIClassInstance();
431 $resp = $gui_class->modifyGUI(
"", $a_get_sub_tabs ?
"sub_tabs" :
"tabs",
432 array(
"tabs" => $this));
440 $cmd = $ilCtrl->getCmd();
441 $cmdClass =
$ilCtrl->getCmdClass();
446 $tpl =
new ilTemplate(
"tpl.sub_tabs.html",
true,
true,
"Services/UIComponent/Tabs");
453 $tpl =
new ilTemplate(
"tpl.tabs.html",
true,
true,
"Services/UIComponent/Tabs");
454 if ($a_after_tabs_anchor)
456 $tpl->touchBlock(
"after_tabs");
460 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
463 if ($this->back_2_title !=
"")
465 $tpl->setCurrentBlock(
"back_2_tab");
467 $tpl->setVariable(
"BACK_2_TAB_LINK", $this->back_2_target);
468 $tpl->setVariable(
"BACK_2_TAB_TEXT", $this->back_2_title);
469 $tpl->setVariable(
"BACK_2_TAB_TARGET", $this->back_2_frame);
470 $tpl->parseCurrentBlock();
474 if ($this->back_title !=
"")
476 $tpl->setCurrentBlock(
"back_tab");
478 $tpl->setVariable(
"BACK_TAB_LINK", $this->back_target);
479 $tpl->setVariable(
"BACK_TAB_TEXT", $this->back_title);
480 $tpl->setVariable(
"BACK_TAB_TARGET", $this->back_frame);
481 $tpl->parseCurrentBlock();
485 $targets = $a_get_sub_tabs ? $this->sub_target :
$this->target;
490 if ((count($targets) > 1 || $this->force_one_tab) || ($this->back_title !=
"" && !$a_get_sub_tabs)
491 || (count($this->non_tabbed_link) > 0 && !$a_get_sub_tabs))
503 (in_array($cmdClass,
$target[
"cmdClass"]) || !
$target[
"cmdClass"]))
505 $tabtype = $pre.
"tabactive";
509 $tabtype = $pre.
"tabinactive";
512 if ($a_manual &&
$target[
"activate"])
514 $tabtype = $pre.
"tabactive";
517 if ($tabtype ==
"tabactive" || $tabtype ==
"subtabactive")
519 $tpl->setCurrentBlock(
"sel_text");
520 $tpl->setVariable(
"TXT_SELECTED",
$lng->txt(
"stat_selected"));
521 $tpl->parseCurrentBlock();
533 $ilHelp->setDefaultScreenId($part,
$target[
"id"]);
537 $tpl->setCurrentBlock($pre.
"tab");
538 $tpl->setVariable(
"ID", $pre.
"tab_".
$target[
"id"]);
543 $ttext = $ilHelp->getTabTooltipText(
$target[
"id"]);
546 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
548 "bottom center",
"top center",
false);
553 $tabtype = in_array($tabtype, array(
"tabactive",
"subtabactive"))
558 $tpl->setVariable($pre2.
"TAB_TYPE", $tabtype);
561 $hash = (
$ilUser->getPref(
"screen_reader_optimization"))
562 ?
"#after_".$sr_pre.
"tabs"
566 $tpl->setVariable($pre2.
"TAB_LINK",
$target[
"link"].$hash);
569 $tpl->setVariable($pre2.
"TAB_TEXT",
$target[
"text"]);
575 $tpl->setVariable($pre2.
"TAB_TARGET",
$target[
"frame"]);
576 $tpl->parseCurrentBlock();
581 $tpl->setVariable(
"TXT_SUBTABS",
$lng->txt(
"subtabs"));
585 $tpl->setVariable(
"TXT_TABS",
$lng->txt(
"tabs"));
588 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
589 foreach ($this->non_tabbed_link as $link)
591 $tpl->setCurrentBlock(
"tab");
592 $tpl->setVariable(
"TAB_TYPE",
"nontabbed");
594 $tpl->setVariable(
"TAB_TEXT", $link[
"text"]);
595 $tpl->setVariable(
"TAB_LINK", $link[
"link"]);
596 $tpl->setVariable(
"TAB_TARGET", $link[
"frame"]);
597 $tpl->setVariable(
"ID",
"nontab_".$link[
"id"]);
598 $tpl->parseCurrentBlock();
603 $ttext = $ilHelp->getTabTooltipText($link[
"id"]);
606 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
608 "bottom center",
"top center",
false);
623 foreach($this->target as $i =>
$target){
624 if($this->target[$i][
'activate'])
625 return $this->target[$i][
'id'];
An exception for terminatinating execution or to throw for unit testing.
static get($a_glyph, $a_text="")
Get glyph html.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
__construct()
Constructor @access public.
getSubTabHTML()
get sub tabs code as html
getHTML($a_after_tabs_anchor=false)
get tabs code as html
getForcePresentationOfSingleTab()
Get force presentation of single tab.
addNonTabbedLink($a_id, $a_text, $a_link, $a_frame="")
Add a non-tabbed link (outside of tabs at same level)
replaceTab($a_old_id, $a_new_id, $a_text, $a_link, $a_frame='')
Replace a tab.
activateSubTab($a_id)
Activate a specific subtab identified its id.
clearSubTabs()
Clear all already added sub tabs.
setSetupMode($a_val)
Set setup mode.
getSetupMode()
Get setup mode.
removeTab($a_id)
Remove a tab identified by its id.
setForcePresentationOfSingleTab($a_val)
Set force presentation of single tab.
__getHTML($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor=false)
get tabs code as html
addSubTabTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
DEPRECATED.
clearTargets()
clear all targets
setTabActive($a_id)
DEPRECATED.
removeSubTab($a_id)
Remove a tab identified by its id.
setBackTarget($a_title, $a_target, $a_frame="")
back target for upper context
addTab($a_id, $a_text, $a_link, $a_frame="")
Add a Tab.
activateTab($a_id)
Activate a specific tab identified its id.
setBack2Target($a_title, $a_target, $a_frame="")
back target for tow level upper context
setSubTabActive($a_text)
DEPRECATED.
addTarget($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
addSubTab($a_id, $a_text, $a_link, $a_frame="")
Add a Subtab.
special template class to simplify handling of ITX/PEAR