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

Toolbar. More...

+ Inheritance diagram for ilToolbarGUI:
+ 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.
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission.
 getPreventDoubleSubmission ()
 Get prevent double submission.
 addButton ($a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs= '', $a_id="", $a_class= 'submit')
 Add button to toolbar.
 addFormButton ($a_txt, $a_cmd, $a_acc_key="", $a_primary=false, $a_class=false)
 Add form button to toolbar.
 addInputItem (ilToolbarItem $a_item, $a_output_label=false)
 Add input item.
 addButtonInstance (ilButton $a_button)
 Add button instance.
 addDropDown ($a_txt, $a_dd_html)
 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 = ""

Protected Attributes

 $prevent_double_submission = false

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

Member Function Documentation

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

Add button to toolbar.

Deprecated:
use addButtonInstance() instead!
Parameters
stringtext
stringlink href / submit command
stringframe target
stringaccess key

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

Referenced by ilTestResultsToolbarGUI\build(), 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, "class" => $a_class);
}

+ Here is the caller graph for this function:

ilToolbarGUI::addButtonInstance ( ilButton  $a_button)

Add button instance.

Parameters
ilButton$a_button

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

Referenced by ilTestResultsToolbarGUI\build().

{
$this->items[] = array("type" => "button_obj", "instance" => $a_button);
}

+ Here is the caller graph for this function:

ilToolbarGUI::addDropDown (   $a_txt,
  $a_dd_html 
)

Add input item.

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

{
$this->items[] = array("type" => "dropdown", "txt" => $a_txt, "dd_html" => $a_dd_html);
}
ilToolbarGUI::addFormButton (   $a_txt,
  $a_cmd,
  $a_acc_key = "",
  $a_primary = false,
  $a_class = false 
)

Add form button to toolbar.

deprecated use addButtonInstance() instead!

Parameters
stringtext
stringlink href / submit command
stringaccess key
boolprimary action
stringcss class

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), ilAssQuestionPreviewToolbarGUI\build(), ilTestSkillEvaluationToolbarGUI\build(), and ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\populateNewQuestionSelectionRuleInputs().

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

+ Here is the caller graph for this function:

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

Add input item.

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), ilTestResultsToolbarGUI\build(), ilTestSkillEvaluationToolbarGUI\build(), and ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\populateNewQuestionSelectionRuleInputs().

{
$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 213 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 184 of file class.ilToolbarGUI.php.

Referenced by ilTestResultsToolbarGUI\build().

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

+ Here is the caller graph for this function:

ilToolbarGUI::addSpacer (   $a_width = null)

Add spacer.

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

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

Add text.

Definition at line 192 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 253 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 45 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 273 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 73 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 281 of file class.ilToolbarGUI.php.

References $lng, $tpl, ilAccessKeyGUI\getAttribute(), getCloseFormTag(), getFormAction(), getFormName(), getHidden(), getId(), getOpenFormTag(), and getPreventDoubleSubmission().

{
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->setVariable('BTN_CLASS',$item['class']);
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
case "fbutton":
$tpl->setCurrentBlock("form_button");
$tpl->setVariable("SUB_TXT", $item["txt"]);
$tpl->setVariable("SUB_CMD", $item["cmd"]);
if($item["primary"])
{
$tpl->setVariable("SUB_CLASS", " emphsubmit");
}
else if($item["class"])
{
$tpl->setVariable("SUB_CLASS", " ".$item["class"]);
}
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
case "button_obj":
$tpl->setCurrentBlock("button_instance");
$tpl->setVariable("BUTTON_OBJ", $item["instance"]->render());
$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;
// bs-patch start
case "dropdown":
$tpl->setCurrentBlock("dropdown");
$tpl->setVariable("TXT_DROPDOWN", $item["txt"]);
$tpl->setVariable("DROP_DOWN", $item["dd_html"]);
$tpl->parseCurrentBlock();
$tpl->touchBlock("item");
break;
// bs-patch end
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());
{
$tpl->setVariable("FORM_CLASS", "preventDoubleSubmission");
}
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("HIDDEN_CLASS", 'ilNoDisplay');
}
return $tpl->get();
}
return "";
}

+ Here is the call graph for this function:

ilToolbarGUI::getId ( )

Get id.

Returns
string id

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

References $open_form_tag.

Referenced by getHTML().

{
}

+ Here is the caller graph for this function:

ilToolbarGUI::getPreventDoubleSubmission ( )

Get prevent double submission.

Returns
bool prevent double submission

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

References $prevent_double_submission.

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

Referenced by ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\build(), and ilTestSkillEvaluationToolbarGUI\build().

{
$this->form_action = $a_val;
$this->multipart = $a_multipart;
$this->form_target = $a_target;
}

+ Here is the caller graph for this function:

ilToolbarGUI::setFormName (   $a_val)

Set form name.

Parameters
stringform name

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

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

Set hidden.

Parameters
boolean$a_valhidden

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

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

Set id.

Parameters
string$a_valid

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

Referenced by ilTestResultsToolbarGUI\build().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilToolbarGUI::setLeadingImage (   $a_img,
  $a_alt 
)

Set leading image.

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

{
$this->open_form_tag = $a_val;
}
ilToolbarGUI::setPreventDoubleSubmission (   $a_val)

Set prevent double submission.

Parameters
bool$a_valprevent double submission

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

{
$this->prevent_double_submission = $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().

ilToolbarGUI::$prevent_double_submission = false
protected

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

Referenced by getPreventDoubleSubmission().


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