ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilToolbarGUI Class Reference

Toolbar. More...

+ Collaboration diagram for ilToolbarGUI:

Public Member Functions

 __construct ()
 setFormAction ($a_val, $a_multipart=false)
 Set form action (if form action is set, toolbar is wrapped into form tags.
 getFormAction ()
 Get form action.
 setLeadingImage ($a_img, $a_alt)
 Set leading image.
 addButton ($a_txt, $a_cmd, $a_target="", $a_acc_key="")
 Add button to toolbar.
 addFormButton ($a_txt, $a_cmd, $a_acc_key="")
 Add form button to toolbar.
 addInputItem ($a_item, $a_output_label=false)
 Add input item.
 addSeparator ()
 Add separator.
 addSpacer ()
 Add spacer.
 getHTML ()
 Get toolbar html.

Data Fields

 $items = array()

Detailed Description

Toolbar.

The toolbar currently only supports a list of buttons as links.

A default toolbar object is available in the $ilToolbar global object.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilToolbarGUI.php.

Constructor & Destructor Documentation

ilToolbarGUI::__construct ( )

Definition at line 17 of file class.ilToolbarGUI.php.

{
}

Member Function Documentation

ilToolbarGUI::addButton (   $a_txt,
  $a_cmd,
  $a_target = "",
  $a_acc_key = "" 
)

Add button to toolbar.

Parameters
stringtext
stringlink href / submit command
stringframe target
stringaccess key

Definition at line 59 of file class.ilToolbarGUI.php.

{
$this->items[] = array("type" => "button", "txt" => $a_txt, "cmd" => $a_cmd,
"target" => $a_target, "acc_key" => $a_acc_key);
}
ilToolbarGUI::addFormButton (   $a_txt,
  $a_cmd,
  $a_acc_key = "" 
)

Add form button to toolbar.

Parameters
stringtext
stringlink href / submit command
stringaccess key

Definition at line 72 of file class.ilToolbarGUI.php.

{
$this->items[] = array("type" => "fbutton", "txt" => $a_txt, "cmd" => $a_cmd,
"acc_key" => $a_acc_key);
}
ilToolbarGUI::addInputItem (   $a_item,
  $a_output_label = false 
)

Add input item.

Definition at line 81 of file class.ilToolbarGUI.php.

{
$this->items[] = array("type" => "input", "input" => $a_item, "label" => $a_output_label);
}
ilToolbarGUI::addSeparator ( )

Add separator.

Definition at line 89 of file class.ilToolbarGUI.php.

{
$this->items[] = array("type" => "separator");
}
ilToolbarGUI::addSpacer ( )

Add spacer.

Definition at line 97 of file class.ilToolbarGUI.php.

{
$this->items[] = array("type" => "spacer");
}
ilToolbarGUI::getFormAction ( )

Get form action.

Returns
string form action

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

Referenced by getHTML().

{
return $this->form_action;
}

+ Here is the caller graph for this function:

ilToolbarGUI::getHTML ( )

Get toolbar html.

Definition at line 105 of file class.ilToolbarGUI.php.

References $lng, $tpl, ilAccessKeyGUI\getAttribute(), and getFormAction().

{
global $lng;
$tpl = new ilTemplate("tpl.toolbar.html", true, true, "Services/UIComponent/Toolbar");
if (count($this->items) > 0)
{
foreach($this->items as $item)
{
switch ($item["type"])
{
case "button":
$tpl->setCurrentBlock("button");
$tpl->setVariable("BTN_TXT", $item["txt"]);
$tpl->setVariable("BTN_LINK", $item["cmd"]);
if ($item["target"] != "")
{
$tpl->setVariable("BTN_TARGET", 'target="'.$item["target"].'"');
}
if ($item["acc_key"] != "")
{
include_once("./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
$tpl->setVariable("BTN_ACC_KEY",
ilAccessKeyGUI::getAttribute($item["acc_key"]));
}
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
case "fbutton":
$tpl->setCurrentBlock("form_button");
$tpl->setVariable("SUB_TXT", $item["txt"]);
$tpl->setVariable("SUB_CMD", $item["cmd"]);
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
case "input":
if ($item["label"])
{
$tpl->setCurrentBlock("input_label");
$tpl->setVariable("TXT_INPUT", $item["input"]->getTitle());
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("input");
$tpl->setVariable("INPUT_HTML", $item["input"]->getToolbarHTML());
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
case "separator":
$tpl->touchBlock("separator");
$tpl->touchBlock("item");
break;
case "spacer":
$tpl->touchBlock("spacer");
$tpl->touchBlock("item");
break;
}
}
$tpl->setVariable("TXT_FUNCTIONS", $lng->txt("functions"));
if ($this->lead_img["img"] != "")
{
$tpl->setCurrentBlock("lead_image");
$tpl->setVariable("IMG_SRC", $this->lead_img["img"]);
$tpl->setVariable("IMG_ALT", $this->lead_img["alt"]);
$tpl->parseCurrentBlock();
}
// form?
if ($this->getFormAction() != "")
{
$tpl->setCurrentBlock("form_open");
$tpl->setVariable("FORMACTION", $this->getFormAction());
if ($this->multipart)
{
$tpl->setVariable("ENC_TYPE", 'enctype="multipart/form-data"');
}
$tpl->parseCurrentBlock();
$tpl->touchBlock("form_close");
}
return $tpl->get();
}
return "";
}

+ Here is the call graph for this function:

ilToolbarGUI::setFormAction (   $a_val,
  $a_multipart = false 
)

Set form action (if form action is set, toolbar is wrapped into form tags.

Parameters
stringform action

Definition at line 27 of file class.ilToolbarGUI.php.

{
$this->form_action = $a_val;
$this->multipart = $a_multipart;
}
ilToolbarGUI::setLeadingImage (   $a_img,
  $a_alt 
)

Set leading image.

Definition at line 46 of file class.ilToolbarGUI.php.

{
$this->lead_img = array("img" => $a_img, "alt" => $a_alt);
}

Field Documentation

ilToolbarGUI::$items = array()

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


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