Public Member Functions | |
ilTabsGUI () | |
Constructor public. | |
setBackTarget ($a_title, $a_target, $a_frame="") | |
back target for upper context | |
setBack2Target ($a_title, $a_target, $a_frame="") | |
back target for tow level upper context | |
getTargetsByObjectType (&$a_gui_obj, $a_type) | |
addTarget ($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false) | |
Add a target to the tabbed menu. | |
clearTargets () | |
clear all targets | |
addSubTabTarget ($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false) | |
Add a Subtarget to the tabbed menu. | |
setTabActive ($a_text) | |
Activate a specific tab identified by name This method overrides the definition in YOUR_OBJECT::getTabs() and deactivates all other tabs. | |
setSubTabActive ($a_text) | |
Activate a specific tab identified by name This method overrides the definition in YOUR_OBJECT::getTabs() and deactivates all other tabs. | |
clearSubTabs () | |
Clear all already added sub tabs. | |
getHTML () | |
get tabs code as html | |
getSubTabHTML () | |
get sub tabs code as html | |
__getHTML ($a_get_sub_tabs, $a_manual) | |
get tabs code as html | |
Data Fields | |
$target_script | |
$obj_type | |
$tpl | |
$lng | |
$tabs | |
$objDefinition | |
$target = array() | |
$sub_target = array() |
Definition at line 33 of file class.ilTabsGUI.php.
ilTabsGUI::__getHTML | ( | $ | a_get_sub_tabs, | |
$ | a_manual | |||
) |
get tabs code as html
bool | choose tabs or sub tabs | |
bool | manual activation Private |
Definition at line 251 of file class.ilTabsGUI.php.
References $cmd, $ilCtrl, $lng, $target, and $tpl.
Referenced by getHTML(), and getSubTabHTML().
{ global $ilCtrl, $lng; $cmd = $ilCtrl->getCmd(); $cmdClass = $ilCtrl->getCmdClass(); if ($a_get_sub_tabs) { $tpl = new ilTemplate("tpl.sub_tabs.html", true, true); $pre = "sub"; $pre2 = "SUB_"; } else { $tpl = new ilTemplate("tpl.tabs.html", true, true); $pre = $pre2 = ""; } // back 2 tab if ($this->back_2_title != "") { $tpl->setCurrentBlock("back_2_tab"); $tpl->setVariable("BACK_2_TAB_LINK", $this->back_2_target); $tpl->setVariable("BACK_2_TAB_TEXT", $this->back_2_title); $tpl->setVariable("BACK_2_TAB_TARGET", $this->back_2_frame); $tpl->parseCurrentBlock(); } // back tab if ($this->back_title != "") { $tpl->setCurrentBlock("back_tab"); $tpl->setVariable("BACK_TAB_LINK", $this->back_target); $tpl->setVariable("BACK_TAB_TEXT", $this->back_title); $tpl->setVariable("BACK_TAB_TARGET", $this->back_frame); $tpl->parseCurrentBlock(); } $targets = $a_get_sub_tabs ? $this->sub_target : $this->target; // do not display one tab only if ((count($targets) > 1) || $this->back_title != "") { foreach ($targets as $target) { $i++; if (!is_array($target["cmd"])) { $target["cmd"] = array($target["cmd"]); } //echo "<br>-$a_manual-$cmd-".$target["cmd"]."-"; if (!$a_manual && (in_array($cmd, $target["cmd"]) || ($target["cmd"][0] == "" && count($target["cmd"]) == 1)) && (in_array($cmdClass,$target["cmdClass"]) || !$target["cmdClass"])) { $tabtype = $pre."tabactive"; } else { $tabtype = $pre."tabinactive"; } if ($a_manual && $target["activate"]) { $tabtype = $pre."tabactive"; } $tpl->setCurrentBlock($pre."tab"); $tpl->setVariable($pre2."TAB_TYPE", $tabtype); $tpl->setVariable($pre2."TAB_LINK", $target["link"]); $tpl->setVariable($pre2."TAB_TEXT", $lng->txt($target["text"])); $tpl->setVariable($pre2."TAB_TARGET", $target["frame"]); $tpl->parseCurrentBlock(); } return $tpl->get(); } else { return ""; } }
ilTabsGUI::addSubTabTarget | ( | $ | a_text, | |
$ | a_link, | |||
$ | a_cmd = "" , |
|||
$ | a_cmdClass = "" , |
|||
$ | a_frame = "" , |
|||
$ | a_activate = false | |||
) |
Add a Subtarget to the tabbed menu.
If no target has set $a_activate to true, ILIAS tries to determine the current activated menu item automatically using $a_cmd and $a_cmdClass. If one item is set activated (and only one should be activated) the automatism is disabled.
string | $a_text menu item text | |
string | $a_link menu item link | |
string | $a_cmd command, used for auto activation | |
string | $a_cmdClass used for auto activation. String or array of cmd classes | |
string | $a_frame frame target | |
boolean | $a_activate activate this menu item |
Definition at line 156 of file class.ilTabsGUI.php.
{ if(!$a_cmdClass) { $a_cmdClass = array(); } $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass; #$a_cmdClass = strtolower($a_cmdClass); if ($a_activate) { $this->subtab_manual_activation = true; } $this->sub_target[] = array("text" => $a_text, "link" => $a_link, "cmd" => $a_cmd, "cmdClass" => $a_cmdClass, "frame" => $a_frame, "activate" => $a_activate); }
ilTabsGUI::addTarget | ( | $ | a_text, | |
$ | a_link, | |||
$ | a_cmd = "" , |
|||
$ | a_cmdClass = "" , |
|||
$ | a_frame = "" , |
|||
$ | a_activate = false | |||
) |
Add a target to the tabbed menu.
If no target has set $a_activate to true, ILIAS tries to determine the current activated menu item automatically using $a_cmd and $a_cmdClass. If one item is set activated (and only one should be activated) the automatism is disabled.
string | $a_text menu item text | |
string | $a_link menu item link | |
string | $a_cmd command, used for auto activation | |
string | $a_cmdClass used for auto activation. String or array of cmd classes | |
string | $a_frame frame target | |
boolean | $a_activate activate this menu item |
Definition at line 112 of file class.ilTabsGUI.php.
Referenced by getTargetsByObjectType().
{ if(!$a_cmdClass) { $a_cmdClass = array(); } $a_cmdClass = !is_array($a_cmdClass) ? array(strtolower($a_cmdClass)) : $a_cmdClass; #$a_cmdClass = strtolower($a_cmdClass); if ($a_activate) { $this->manual_activation = true; } $this->target[] = array("text" => $a_text, "link" => $a_link, "cmd" => $a_cmd, "cmdClass" => $a_cmdClass, "frame" => $a_frame, "activate" => $a_activate); }
ilTabsGUI::clearSubTabs | ( | ) |
Clear all already added sub tabs.
boolean |
Definition at line 221 of file class.ilTabsGUI.php.
{ $this->sub_target = array(); return true; }
ilTabsGUI::clearTargets | ( | ) |
clear all targets
Definition at line 134 of file class.ilTabsGUI.php.
{ $this->target = array(); $this->back_title = ""; $this->back_target = ""; $this->back_2_target = ""; $this->back_2_title = ""; }
ilTabsGUI::getHTML | ( | ) |
get tabs code as html
Definition at line 230 of file class.ilTabsGUI.php.
References __getHTML().
{ return $this->__getHTML(false,$this->manual_activation); }
ilTabsGUI::getSubTabHTML | ( | ) |
get sub tabs code as html
Definition at line 238 of file class.ilTabsGUI.php.
References __getHTML().
{ return $this->__getHTML(true,$this->subtab_manual_activation); }
ilTabsGUI::getTargetsByObjectType | ( | &$ | a_gui_obj, | |
$ | a_type | |||
) |
Definition at line 85 of file class.ilTabsGUI.php.
References $d, $ilCtrl, $key, $row, and addTarget().
{ global $ilCtrl; $d = $this->objDefinition->getProperties($a_type); foreach ($d as $key => $row) { $this->addTarget($row["lng"], $ilCtrl->getLinkTarget($a_gui_obj, $row["name"]), $row["name"], get_class($a_gui_obj)); } }
ilTabsGUI::ilTabsGUI | ( | ) |
Constructor public.
Definition at line 48 of file class.ilTabsGUI.php.
References $lng, $objDefinition, and $tpl.
{ global $tpl, $objDefinition, $lng; $this->tpl =& $tpl; $this->lng =& $lng; $this->objDefinition =& $objDefinition; $this->manual_activation = false; $this->subtab_manual_activation = false; $this->temp_var = "TABS"; $this->sub_tabs = false; $this->back_title = ""; $this->back_target = ""; $this->back_2_target = ""; $this->back_2_title = ""; }
ilTabsGUI::setBack2Target | ( | $ | a_title, | |
$ | a_target, | |||
$ | a_frame = "" | |||
) |
back target for tow level upper context
Definition at line 78 of file class.ilTabsGUI.php.
{ $this->back_2_title = $a_title; $this->back_2_target = $a_target; $this->back_2_frame = $a_frame; }
ilTabsGUI::setBackTarget | ( | $ | a_title, | |
$ | a_target, | |||
$ | a_frame = "" | |||
) |
back target for upper context
Definition at line 68 of file class.ilTabsGUI.php.
{ $this->back_title = $a_title; $this->back_target = $a_target; $this->back_frame = $a_frame; }
ilTabsGUI::setSubTabActive | ( | $ | a_text | ) |
Activate a specific tab identified by name This method overrides the definition in YOUR_OBJECT::getTabs() and deactivates all other tabs.
string | $a_text menu item text | |
boolean |
Definition at line 206 of file class.ilTabsGUI.php.
{ for($i = 0; $i < count($this->sub_target);$i++) { $this->sub_target[$i]['activate'] = $this->sub_target[$i]['text'] == $a_text; } $this->subtab_manual_activation = true; return true; }
ilTabsGUI::setTabActive | ( | $ | a_text | ) |
Activate a specific tab identified by name This method overrides the definition in YOUR_OBJECT::getTabs() and deactivates all other tabs.
string | $a_text menu item text | |
boolean |
Definition at line 182 of file class.ilTabsGUI.php.
{ for($i = 0; $i < count($this->target);$i++) { $this->target[$i]['activate'] = $this->target[$i]['text'] == $a_text; } if ($a_text != "") { $this->manual_activation = true; } else { $this->manual_activation = false; } return true; }
ilTabsGUI::$lng |
Definition at line 38 of file class.ilTabsGUI.php.
Referenced by __getHTML(), and ilTabsGUI().
ilTabsGUI::$obj_type |
Definition at line 36 of file class.ilTabsGUI.php.
ilTabsGUI::$objDefinition |
Definition at line 40 of file class.ilTabsGUI.php.
Referenced by ilTabsGUI().
ilTabsGUI::$sub_target = array() |
Definition at line 42 of file class.ilTabsGUI.php.
ilTabsGUI::$tabs |
Definition at line 39 of file class.ilTabsGUI.php.
ilTabsGUI::$target = array() |
Definition at line 41 of file class.ilTabsGUI.php.
Referenced by __getHTML().
ilTabsGUI::$target_script |
Definition at line 35 of file class.ilTabsGUI.php.
ilTabsGUI::$tpl |
Definition at line 37 of file class.ilTabsGUI.php.
Referenced by __getHTML(), and ilTabsGUI().