ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTabsGUI Class Reference

Tabs GUI. More...

+ Collaboration diagram for ilTabsGUI:

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
 addTarget ($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=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, $a_dir_text=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()

Detailed Description

Tabs GUI.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilTabsGUI.php 16990 2008-07-19 12:05:01Z akill

Definition at line 32 of file class.ilTabsGUI.php.

Member Function Documentation

ilTabsGUI::__getHTML (   $a_get_sub_tabs,
  $a_manual 
)

get tabs code as html

Parameters
boolchoose tabs or sub tabs
boolmanual activation Private

Definition at line 256 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 != "" && !$a_get_sub_tabs))
{
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"]);
if ($target["dir_text"])
{
$tpl->setVariable($pre2."TAB_TEXT", $target["text"]);
}
else
{
$tpl->setVariable($pre2."TAB_TEXT", $lng->txt($target["text"]));
}
$tpl->setVariable($pre2."TAB_TARGET", $target["frame"]);
$tpl->parseCurrentBlock();
}
return $tpl->get();
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

ilTabsGUI::addSubTabTarget (   $a_text,
  $a_link,
  $a_cmd = "",
  $a_cmdClass = "",
  $a_frame = "",
  $a_activate = false,
  $a_dir_text = 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.

Parameters
string$a_textmenu item text
string$a_linkmenu item link
string$a_cmdcommand, used for auto activation
string$a_cmdClassused for auto activation. String or array of cmd classes
string$a_frameframe target
boolean$a_activateactivate this menu item
boolean$a_dir_texttext is direct text, no language variable

Definition at line 160 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, "dir_text" => $a_dir_text);
}
ilTabsGUI::addTarget (   $a_text,
  $a_link,
  $a_cmd = "",
  $a_cmdClass = "",
  $a_frame = "",
  $a_activate = false,
  $a_dir_text = 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.

Parameters
string$a_textmenu item text
string$a_linkmenu item link
string$a_cmdcommand, used for auto activation
string$a_cmdClassused for auto activation. String or array of cmd classes
string$a_frameframe target
boolean$a_activateactivate this menu item

Definition at line 113 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->manual_activation = true;
}
$this->target[] = array("text" => $a_text, "link" => $a_link,
"cmd" => $a_cmd, "cmdClass" => $a_cmdClass, "frame" => $a_frame,
"activate" => $a_activate, "dir_text" => $a_dir_text);
}
ilTabsGUI::clearSubTabs ( )

Clear all already added sub tabs.

Parameters
boolean

Definition at line 226 of file class.ilTabsGUI.php.

{
$this->sub_target = array();
return true;
}
ilTabsGUI::clearTargets ( )

clear all targets

Definition at line 135 of file class.ilTabsGUI.php.

References setSubTabActive(), and setTabActive().

{
$this->target = array();
$this->back_title = "";
$this->back_target = "";
$this->back_2_target = "";
$this->back_2_title = "";
$this->setTabActive("");
$this->setSubTabActive("");
}

+ Here is the call graph for this function:

ilTabsGUI::getHTML ( )

get tabs code as html

Definition at line 235 of file class.ilTabsGUI.php.

References __getHTML().

{
return $this->__getHTML(false,$this->manual_activation);
}

+ Here is the call graph for this function:

ilTabsGUI::getSubTabHTML ( )

get sub tabs code as html

Definition at line 243 of file class.ilTabsGUI.php.

References __getHTML().

{
return $this->__getHTML(true,$this->subtab_manual_activation);
}

+ Here is the call graph for this function:

ilTabsGUI::ilTabsGUI ( )

Constructor public.

Definition at line 47 of file class.ilTabsGUI.php.

References $lng, $objDefinition, and $tpl.

{
$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 77 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 67 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.

Parameters
string$a_textmenu item text
boolean

Definition at line 211 of file class.ilTabsGUI.php.

Referenced by clearTargets().

{
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;
}

+ Here is the caller graph for this function:

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.

Parameters
string$a_textmenu item text
boolean

Definition at line 187 of file class.ilTabsGUI.php.

Referenced by clearTargets().

{
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;
}

+ Here is the caller graph for this function:

Field Documentation

ilTabsGUI::$lng

Definition at line 37 of file class.ilTabsGUI.php.

Referenced by __getHTML(), and ilTabsGUI().

ilTabsGUI::$obj_type

Definition at line 35 of file class.ilTabsGUI.php.

ilTabsGUI::$objDefinition

Definition at line 39 of file class.ilTabsGUI.php.

Referenced by ilTabsGUI().

ilTabsGUI::$sub_target = array()

Definition at line 41 of file class.ilTabsGUI.php.

ilTabsGUI::$tabs

Definition at line 38 of file class.ilTabsGUI.php.

ilTabsGUI::$target = array()

Definition at line 40 of file class.ilTabsGUI.php.

Referenced by __getHTML().

ilTabsGUI::$target_script

Definition at line 34 of file class.ilTabsGUI.php.

ilTabsGUI::$tpl

Definition at line 36 of file class.ilTabsGUI.php.

Referenced by __getHTML(), and ilTabsGUI().


The documentation for this class was generated from the following file: