ILIAS  eassessment Revision 61809
 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, $a_target="")
 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="", $a_additional_attrs= '')
 Add button to toolbar.
 addFormButton ($a_txt, $a_cmd, $a_acc_key="")
 Add form button to toolbar.
 addInputItem (ilToolbarItem $a_item, $a_output_label=false)
 Add input item.
 addSeparator ()
 Add separator.
 addSpacer ()
 Add spacer.
 setOpenFormTag ($a_val)
 Set open form tag.
 getOpenFormTag ()
 Get open form tag.
 setCloseFormTag ($a_val)
 Set close form tag.
 getCloseFormTag ()
 Get close form tag.
 getHTML ()
 Get toolbar html.

Data Fields

 $items = array()
 $open_form_tag = true
 $close_form_tag = true
 $form_target = ""

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 20 of file class.ilToolbarGUI.php.

{
}

Member Function Documentation

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

Add button to toolbar.

Parameters
stringtext
stringlink href / submit command
stringframe target
stringaccess key

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

Referenced by ilBookingScheduleGUI\render(), ilBookingObjectGUI\render(), and ilBookingTypeGUI\render().

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

+ Here is the caller graph for this function:

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 76 of file class.ilToolbarGUI.php.

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

Add input item.

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

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

Add separator.

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

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

Add spacer.

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

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

Get close form tag.

Returns
boolean close form tag

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

References $close_form_tag.

Referenced by getHTML().

{
}

+ Here is the caller graph for this function:

ilToolbarGUI::getFormAction ( )

Get form action.

Returns
string form action

Definition at line 42 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 149 of file class.ilToolbarGUI.php.

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

{
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"]));
}
if(($item['add_attrs']))
{
$tpl->setVariable('BTN_ADD_ARG',$item['add_attrs']);
}
$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() != "")
{
if ($this->getOpenFormTag())
{
$tpl->setCurrentBlock("form_open");
$tpl->setVariable("FORMACTION", $this->getFormAction());
if ($this->multipart)
{
$tpl->setVariable("ENC_TYPE", 'enctype="multipart/form-data"');
}
if ($this->form_target != "")
{
$tpl->setVariable("TARGET", ' target="'.$this->form_target.'" ');
}
$tpl->parseCurrentBlock();
}
if ($this->getCloseFormTag())
{
$tpl->touchBlock("form_close");
}
}
return $tpl->get();
}
return "";
}

+ Here is the call graph for this function:

ilToolbarGUI::getOpenFormTag ( )

Get open form tag.

Returns
boolean open form tag

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

References $open_form_tag.

Referenced by getHTML().

{
}

+ Here is the caller graph for this function:

ilToolbarGUI::setCloseFormTag (   $a_val)

Set close form tag.

Parameters
booleanclose form tag

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

{
$this->close_form_tag = $a_val;
}
ilToolbarGUI::setFormAction (   $a_val,
  $a_multipart = false,
  $a_target = "" 
)

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

Parameters
stringform action

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

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

Set leading image.

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

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

Set open form tag.

Parameters
booleanopen form tag

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

{
$this->open_form_tag = $a_val;
}

Field Documentation

ilToolbarGUI::$close_form_tag = true

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

Referenced by getCloseFormTag().

ilToolbarGUI::$form_target = ""

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

ilToolbarGUI::$items = array()

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

ilToolbarGUI::$open_form_tag = true

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

Referenced by getOpenFormTag().


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