ILIAS  release_4-3 Revision
 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.
 setHidden ($a_val)
 Set hidden.
 getHidden ()
 Get hidden.
 setId ($a_val)
 Set id.
 getId ()
 Get id.
 addButton ($a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs= '', $a_id="")
 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.
 addText ($a_text)
 Add text.
 addSpacer ($a_width=null)
 Add spacer.
 addLink ($a_caption, $a_url, $a_disabled=false)
 Add link.
 setOpenFormTag ($a_val)
 Set open form tag.
 getOpenFormTag ()
 Get open form tag.
 setCloseFormTag ($a_val)
 Set close form tag.
 getCloseFormTag ()
 Get close form tag.
 setFormName ($a_val)
 Set form name.
 getFormName ()
 Get form name.
 getHTML ()
 Get toolbar html.

Data Fields

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

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

{
}

Member Function Documentation

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

Add button to toolbar.

Parameters
stringtext
stringlink href / submit command
stringframe target
stringaccess key

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

Referenced by ilBookingScheduleGUI\render(), and ilBookingObjectGUI\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,
"id" => $a_id);
}

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch().

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

+ Here is the caller graph for this function:

ilToolbarGUI::addInputItem ( ilToolbarItem  $a_item,
  $a_output_label = false 
)

Add input item.

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch().

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

+ Here is the caller graph for this function:

ilToolbarGUI::addLink (   $a_caption,
  $a_url,
  $a_disabled = false 
)

Add link.

Parameters
string$a_caption
string$a_url
boolean$a_disabled

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

{
$this->items[] = array("type" => "link", "txt" => $a_caption, "cmd" => $a_url, "disabled" => $a_disabled);
}
ilToolbarGUI::addSeparator ( )

Add separator.

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

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

Add spacer.

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

{
$this->items[] = array("type" => "spacer", "width" => $a_width);
}
ilToolbarGUI::addText (   $a_text)

Add text.

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch().

{
$this->items[] = array("type" => "text", "text" => $a_text);
}

+ Here is the caller graph for this function:

ilToolbarGUI::getCloseFormTag ( )

Get close form tag.

Returns
boolean close form tag

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

Referenced by getHTML().

{
return $this->form_action;
}

+ Here is the caller graph for this function:

ilToolbarGUI::getFormName ( )

Get form name.

Returns
string form name

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

References $form_name.

Referenced by getHTML().

{
}

+ Here is the caller graph for this function:

ilToolbarGUI::getHidden ( )

Get hidden.

Returns
boolean hidden

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

Referenced by getHTML().

{
return $this->hidden;
}

+ Here is the caller graph for this function:

ilToolbarGUI::getHTML ( )

Get toolbar html.

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

References $lng, $tpl, ilAccessKeyGUI\getAttribute(), getCloseFormTag(), getFormAction(), getFormName(), getHidden(), getId(), 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["id"] != "")
{
$tpl->setVariable("BID", 'id="'.$item["id"].'"');
}
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 "text":
$tpl->setCurrentBlock("text");
$tpl->setVariable("VAL_TEXT", $item["text"]);
$tpl->touchBlock("item");
break;
case "spacer":
$tpl->touchBlock("spacer");
if(!$item["width"])
{
$item["width"] = 2;
}
$tpl->setVariable("SPACER_WIDTH", $item["width"]);
$tpl->touchBlock("item");
break;
case "link":
if ($item["disabled"] == false) {
$tpl->setCurrentBlock("link");
$tpl->setVariable("LINK_TXT", $item["txt"]);
$tpl->setVariable("LINK_URL", $item["cmd"]);
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
}
else {
$tpl->setCurrentBlock("link_disabled");
$tpl->setVariable("LINK_DISABLED_TXT", $item["txt"]);
//$tpl->setVariable("LINK_URL", $item["cmd"]);
$tpl->parseCurrentBlock();
$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.'" ');
}
if ($this->form_name != "")
{
$tpl->setVariable("FORMNAME", 'name="'.$this->getFormName().'"');
}
$tpl->parseCurrentBlock();
}
if ($this->getCloseFormTag())
{
$tpl->touchBlock("form_close");
}
}
// id
if ($this->getId() != "")
{
$tpl->setVariable("ID", ' id="'.$this->getId().'" ');
}
// hidden style
if ($this->getHidden())
{
$tpl->setVariable("STYLE", ' style="display:none;" ');
}
return $tpl->get();
}
return "";
}

+ Here is the call graph for this function:

ilToolbarGUI::getId ( )

Get id.

Returns
string id

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

Referenced by getHTML().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilToolbarGUI::getOpenFormTag ( )

Get open form tag.

Returns
boolean open form tag

Definition at line 185 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 195 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 31 of file class.ilToolbarGUI.php.

{
$this->form_action = $a_val;
$this->multipart = $a_multipart;
$this->form_target = $a_target;
}
ilToolbarGUI::setFormName (   $a_val)

Set form name.

Parameters
stringform name

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

{
$this->form_name = $a_val;
}
ilToolbarGUI::setHidden (   $a_val)

Set hidden.

Parameters
boolean$a_valhidden

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

{
$this->hidden = $a_val;
}
ilToolbarGUI::setId (   $a_val)

Set id.

Parameters
string$a_valid

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

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

Set leading image.

Definition at line 51 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 175 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_name = ""

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

Referenced by getFormName().

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: