ILIAS  Release_4_1_x_branch Revision 61804
 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)
 DEPRECATED.
 addTab ($a_id, $a_text, $a_link, $a_frame="")
 Add a Tab.
 removeTab ($a_id)
 Remove a tab identified by its id.
 removeSubTab ($a_id)
 Remove a tab identified by its id.
 replaceTab ($a_old_id, $a_new_id, $a_text, $a_link, $a_frame= '')
 Replace a tab.
 clearTargets ()
 clear all targets
 addSubTabTarget ($a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)
 DEPRECATED.
 addSubTab ($a_id, $a_text, $a_link, $a_frame="")
 Add a Subtab.
 setTabActive ($a_id)
 DEPRECATED.
 activateTab ($a_id)
 Activate a specific tab identified its id.
 setSubTabActive ($a_text)
 DEPRECATED.
 activateSubTab ($a_id)
 Activate a specific subtab identified its id.
 clearSubTabs ()
 Clear all already added sub tabs.
 getHTML ($a_after_tabs_anchor=false)
 get tabs code as html
 getSubTabHTML ()
 get sub tabs code as html
 addNonTabbedLink ($a_id, $a_text, $a_link, $a_frame="")
 Add a non-tabbed link (outside of tabs at same level)
 __getHTML ($a_get_sub_tabs, $a_manual, $a_after_tabs_anchor=false)
 get tabs code as html

Data Fields

 $target_script
 $obj_type
 $tpl
 $lng
 $tabs
 $objDefinition
 $target = array()
 $sub_target = array()
 $non_tabbed_link = 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 28035 2011-03-10 14:10:46Z akill

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

Member Function Documentation

ilTabsGUI::__getHTML (   $a_get_sub_tabs,
  $a_manual,
  $a_after_tabs_anchor = false 
)

get tabs code as html

Parameters
boolchoose tabs or sub tabs
boolmanual activation Private

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

References $cmd, $ilCtrl, $lng, $target, and $tpl.

Referenced by getHTML(), and getSubTabHTML().

{
global $ilCtrl, $lng, $ilUser;
$cmd = $ilCtrl->getCmd();
$cmdClass = $ilCtrl->getCmdClass();
if ($a_get_sub_tabs)
{
$tpl = new ilTemplate("tpl.sub_tabs.html", true, true);
$pre = "sub";
$pre2 = "SUB_";
$sr_pre = "sub_";
}
else
{
$tpl = new ilTemplate("tpl.tabs.html", true, true);
if ($a_after_tabs_anchor)
{
$tpl->touchBlock("after_tabs");
}
$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;
$i=0;
// do not display one tab only
if ((count($targets) > 1) || ($this->back_title != "" && !$a_get_sub_tabs)
|| (count($this->non_tabbed_link) > 0 && !$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";
}
if ($tabtype == "tabactive" || $tabtype == "subtabactive")
{
$tpl->setCurrentBlock("sel_text");
$tpl->setVariable("TXT_SELECTED", $lng->txt("stat_selected"));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock($pre."tab");
$tpl->setVariable($pre2."TAB_TYPE", $tabtype);
$hash = ($ilUser->getPref("screen_reader_optimization"))
? "#after_".$sr_pre."tabs"
: "";
$tpl->setVariable($pre2."TAB_LINK", $target["link"].$hash);
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();
}
if ($a_get_sub_tabs)
{
$tpl->setVariable("TXT_SUBTABS", $lng->txt("subtabs"));
}
else
{
$tpl->setVariable("TXT_TABS", $lng->txt("tabs"));
// non tabbed links
foreach ($this->non_tabbed_link as $link)
{
$tpl->setCurrentBlock("tab");
$tpl->setVariable("TAB_TYPE", "nontabbed");
$tpl->setVariable("TAB_TEXT", $link["text"]);
$tpl->setVariable("TAB_LINK", $link["link"]);
$tpl->setVariable("TAB_TARGET", $link["frame"]);
$tpl->parseCurrentBlock();
}
}
return $tpl->get();
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

ilTabsGUI::activateSubTab (   $a_id)

Activate a specific subtab identified its id.

Parameters
string$a_textmenu item text

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

References setSubTabActive().

{
$this->setSubTabActive($a_id);
}

+ Here is the call graph for this function:

ilTabsGUI::activateTab (   $a_id)

Activate a specific tab identified its id.

Parameters
string$a_textmenu item text

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

References setTabActive().

{
$this->setTabActive($a_id);
}

+ Here is the call graph for this function:

ilTabsGUI::addNonTabbedLink (   $a_id,
  $a_text,
  $a_link,
  $a_frame = "" 
)

Add a non-tabbed link (outside of tabs at same level)

Parameters
stringid
stringtext (no lang var!)
stringlink
stringframe target

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

{
$this->non_tabbed_link[] = array("text" => $a_text, "link" => $a_link,
"frame" => $a_frame, "dir_text" => true, "id" => $a_id, "cmdClass" => array());
}
ilTabsGUI::addSubTab (   $a_id,
  $a_text,
  $a_link,
  $a_frame = "" 
)

Add a Subtab.

Parameters
stringid
stringtext (no lang var!)
stringlink
stringframe target

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

{
$this->sub_target[] = array("text" => $a_text, "link" => $a_link,
"frame" => $a_frame, "dir_text" => true, "id" => $a_id, "cmdClass" => array());
}
ilTabsGUI::addSubTabTarget (   $a_text,
  $a_link,
  $a_cmd = "",
  $a_cmdClass = "",
  $a_frame = "",
  $a_activate = false,
  $a_dir_text = false 
)

DEPRECATED.

Use addTab/addSubTab and activateTab/activateSubTab.

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 221 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, "id" => $a_text);
}
ilTabsGUI::addTab (   $a_id,
  $a_text,
  $a_link,
  $a_frame = "" 
)

Add a Tab.

Parameters
stringid
stringtext (no lang var!)
stringlink
stringframe target

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

{
$this->target[] = array("text" => $a_text, "link" => $a_link,
"frame" => $a_frame, "dir_text" => true, "id" => $a_id, "cmdClass" => array());
}
ilTabsGUI::addTarget (   $a_text,
  $a_link,
  $a_cmd = "",
  $a_cmdClass = "",
  $a_frame = "",
  $a_activate = false,
  $a_dir_text = false 
)

DEPRECATED.

Use addTab/addSubTab and activateTab/activateSubTab.

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 83 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, "id" => $a_text);
}
ilTabsGUI::clearSubTabs ( )

Clear all already added sub tabs.

Parameters
boolean

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

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

clear all targets

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

References setSubTabActive(), and setTabActive().

{
$this->target = array();
$this->sub_target = array();
$this->non_tabbed_link = 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 (   $a_after_tabs_anchor = false)

get tabs code as html

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

References __getHTML().

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

+ Here is the call graph for this function:

ilTabsGUI::getSubTabHTML ( )

get sub tabs code as html

Definition at line 345 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 28 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::removeSubTab (   $a_id)

Remove a tab identified by its id.

Parameters
string$a_idId of tab to remove
Returns
bool false if tab wasn't found public

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

{
for($i = 0; $i < count($this->sub_target); $i++)
{
if($this->sub_target[$i]['id'] == $a_id)
{
unset($this->sub_target[$i]);
return true;
}
}
return false;
}
ilTabsGUI::removeTab (   $a_id)

Remove a tab identified by its id.

Parameters
string$a_idId of tab to remove
Returns
bool false if tab wasn't found public

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

{
for($i = 0; $i < count($this->target); $i++)
{
if($this->target[$i]['id'] == $a_id)
{
unset($this->target[$i]);
return true;
}
}
return false;
}
ilTabsGUI::replaceTab (   $a_old_id,
  $a_new_id,
  $a_text,
  $a_link,
  $a_frame = '' 
)

Replace a tab.

In contrast to a combination of removeTab and addTab, the position is kept.

Parameters
string$a_old_idold id of tab
string$a_new_idnew id if tab
string$a_texttab text
string$a_linktab link
string$a_frame,[optional]frame
Returns
bool

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

{
for($i = 0; $i < count($this->target); $i++)
{
if($this->target[$i]['id'] == $a_old_id)
{
$this->target[$i] = array();
$this->target[$i] = array(
"text" => $a_text,
"link" => $a_link,
"frame" => $a_frame,
"dir_text" => true,
"id" => $a_new_id,
"cmdClass" => array());
return true;
}
}
return false;
}
ilTabsGUI::setBack2Target (   $a_title,
  $a_target,
  $a_frame = "" 
)

back target for tow level upper context

Definition at line 58 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 48 of file class.ilTabsGUI.php.

{
$this->back_title = $a_title;
$this->back_target = $a_target;
$this->back_frame = $a_frame;
}
ilTabsGUI::setSubTabActive (   $a_text)

DEPRECATED.

Use addTab/addSubTab and activateTab/activateSubTab.

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 303 of file class.ilTabsGUI.php.

Referenced by activateSubTab(), and clearTargets().

{
for($i = 0; $i < count($this->sub_target);$i++)
{
$this->sub_target[$i]['activate'] = $this->sub_target[$i]['id'] == $a_text;
}
$this->subtab_manual_activation = true;
return true;
}

+ Here is the caller graph for this function:

ilTabsGUI::setTabActive (   $a_id)

DEPRECATED.

Use addTab/addSubTab and activateTab/activateSubTab.

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

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

Referenced by activateTab(), and clearTargets().

{
for($i = 0; $i < count($this->target);$i++)
{
$this->target[$i]['activate'] = $this->target[$i]['id'] == $a_id;
}
if ($a_id != "")
{
$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 17 of file class.ilTabsGUI.php.

Referenced by __getHTML(), and ilTabsGUI().

ilTabsGUI::$non_tabbed_link = array()

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

ilTabsGUI::$obj_type

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

ilTabsGUI::$objDefinition

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

Referenced by ilTabsGUI().

ilTabsGUI::$sub_target = array()

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

ilTabsGUI::$tabs

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

ilTabsGUI::$target = array()

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

Referenced by __getHTML().

ilTabsGUI::$target_script

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

ilTabsGUI::$tpl

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

Referenced by __getHTML(), and ilTabsGUI().


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