ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilToolbarGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilToolbarGUI:
+ Collaboration diagram for ilToolbarGUI:

Public Member Functions

 setFormAction (string $a_val, bool $a_multipart=false, string $a_target="")
 Set form action (if form action is set, toolbar is wrapped into form tags) More...
 
 getFormAction ()
 
 setLeadingImage (string $a_img, string $a_alt)
 
 setHidden (bool $a_val)
 
 getHidden ()
 
 setId (string $a_val)
 
 getId ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 addButton (string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
 
 addFormButton (string $a_txt, string $a_cmd, ?int $a_acc_key=null, bool $a_primary=false, ?string $a_class=null)
 
 addInputItem (ilToolbarItem $a_item, bool $a_output_label=false)
 
 addStickyItem ( $a_item, bool $a_output_label=false)
 Add a sticky item. More...
 
 addButtonInstance (ilButtonBase $a_button)
 Add button instance. More...
 
 addDropDown (string $a_txt, string $a_dd_html)
 
 addAdvancedSelectionList (ilAdvancedSelectionListGUI $adv)
 
 addSeparator ()
 
 addText (string $a_text)
 
 addSpacer (?string $a_width=null)
 
 addComponent (\ILIAS\UI\Component\Component $a_comp)
 
 addLink (string $a_caption, string $a_url, bool $a_disabled=false)
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 setFormName (string $a_val)
 
 getFormName ()
 
 getGroupedItems ()
 Get all groups (items separated by a separator) More...
 
 getItems ()
 
 setItems (array $items)
 

Data Fields

array $items = array()
 

Protected Member Functions

 applyAutoStickyToSingleElement ()
 If the toolbar consists of only one button, make it sticky Note: Atm this is only possible for buttons. More...
 

Protected Attributes

ilLanguage $lng
 
string $id = ''
 
string $form_action = ''
 
bool $hidden = false
 
array $lead_img
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
string $form_target = ""
 
string $form_name = ""
 
bool $prevent_double_submission = false
 
array $sticky_items = array()
 
bool $has_separator = false
 
ILIAS DI UIServices $ui
 
bool $multipart = false
 

Static Protected Attributes

static int $instances = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Toolbar. The toolbar currently only supports a list of buttons as links. A default toolbar object is available in the $ilToolbar global object.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Deprecated:
10

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

Member Function Documentation

◆ addAdvancedSelectionList()

ilToolbarGUI::addAdvancedSelectionList ( ilAdvancedSelectionListGUI  $adv)

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

194  : void
195  {
196  $this->items[] = array("type" => "adv_sel_list", "list" => $adv);
197  }

◆ addButton()

ilToolbarGUI::addButton ( string  $a_txt,
string  $a_cmd,
string  $a_target = "",
?int  $a_acc_key = null,
string  $a_additional_attrs = '',
string  $a_id = "",
string  $a_class = 'submit' 
)
Deprecated:
use addButtonInstance() instead!

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

Referenced by ilMultilingualismGUI\addToolbar(), ilPCProfileGUI\initForm(), ilContSkillAdminGUI\listCompetences(), ilRecommendedContentRoleConfigGUI\listItems(), ilCalendarCategoryGUI\manage(), ilObjTestGUI\populateQuestionBrowserToolbarButtons(), ilContainerGUI\renderObject(), ilSkillProfileGUI\showLevelsWithLocalContext(), ilMembershipGUI\showMailToMemberToolbarButton(), ilMembershipGUI\showMemberExportToolbarButton(), and ilObjExerciseGUI\showOverviewObject().

126  : void {
127  $this->items[] = array("type" => "button", "txt" => $a_txt, "cmd" => $a_cmd,
128  "target" => $a_target, "acc_key" => $a_acc_key, 'add_attrs' => $a_additional_attrs,
129  "id" => $a_id, "class" => $a_class);
130  }
+ Here is the caller graph for this function:

◆ addButtonInstance()

ilToolbarGUI::addButtonInstance ( ilButtonBase  $a_button)

Add button instance.

Parameters
ilButtonBase$a_button

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

References addStickyItem(), and ilButtonBase\isPrimary().

178  : void
179  {
180  if ($a_button->isPrimary()) {
181  $this->addStickyItem($a_button);
182  } else {
183  $this->items[] = array("type" => "button_obj", "instance" => $a_button);
184  }
185  }
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.
+ Here is the call graph for this function:

◆ addComponent()

◆ addDropDown()

ilToolbarGUI::addDropDown ( string  $a_txt,
string  $a_dd_html 
)

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

190  : void {
191  $this->items[] = array("type" => "dropdown", "txt" => $a_txt, "dd_html" => $a_dd_html);
192  }

◆ addFormButton()

ilToolbarGUI::addFormButton ( string  $a_txt,
string  $a_cmd,
?int  $a_acc_key = null,
bool  $a_primary = false,
?string  $a_class = null 
)
Deprecated:
use addButtonInstance() instead!

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

References addStickyItem(), and ilSubmitButton\getInstance().

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), ilTestSkillEvaluationToolbarGUI\build(), ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\populateNewQuestionSelectionRuleInputs(), ilContainerGUI\showAdministrationPanel(), and ilObjWorkspaceFolderGUI\showAdministrationPanel().

141  : void {
142  if ($a_primary) {
143  $button = ilSubmitButton::getInstance();
144  $button->setPrimary(true);
145  $button->setCaption($a_txt, false);
146  $button->setCommand($a_cmd);
147  $this->addStickyItem($button);
148  } else {
149  $this->items[] = array("type" => "fbutton", "txt" => $a_txt, "cmd" => $a_cmd,
150  "acc_key" => $a_acc_key, "primary" => $a_primary, "class" => $a_class);
151  }
152  }
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addInputItem()

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

◆ addLink()

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

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

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

◆ addSeparator()

◆ addSpacer()

ilToolbarGUI::addSpacer ( ?string  $a_width = null)

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

210  : void
211  {
212  $this->items[] = array("type" => "spacer", "width" => $a_width);
213  }

◆ addStickyItem()

ilToolbarGUI::addStickyItem (   $a_item,
bool  $a_output_label = false 
)

Add a sticky item.

Sticky items are always visible, also if the toolbar is collapsed (responsive view). Sticky items are displayed first in the toolbar.

Parameters
ilToolbarItem | \ILIAS\UI\Component\Component$a_item

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

Referenced by addButtonInstance(), addFormButton(), applyAutoStickyToSingleElement(), ilTestNavigationToolbarGUI\build(), ilAppointmentPresentationGUI\getHTML(), ILIAS\Repository\Link\LinkAdapterGUI\toToolbar(), and ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\toToolbar().

170  : void {
171  $this->sticky_items[] = array("item" => $a_item, "label" => $a_output_label);
172  }
+ Here is the caller graph for this function:

◆ addText()

ilToolbarGUI::addText ( string  $a_text)

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch().

205  : void
206  {
207  $this->items[] = array("type" => "text", "text" => $a_text);
208  }
+ Here is the caller graph for this function:

◆ applyAutoStickyToSingleElement()

ilToolbarGUI::applyAutoStickyToSingleElement ( )
protected

If the toolbar consists of only one button, make it sticky Note: Atm this is only possible for buttons.

If we are dealing with objects implementing the ilToolbarItem interface one day, other elements can be added as sticky.

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

References addStickyItem(), ilSubmitButton\getInstance(), ilLinkButton\getInstance(), and null.

Referenced by getGroupedItems().

474  : void
475  {
476  if (count($this->items) === 1 && count($this->sticky_items) === 0) {
477  $supported_types = ['button', 'fbutton', 'button_obj'];
478  $item = $this->items[0];
479  if (!in_array($item['type'], $supported_types)) {
480  return;
481  }
482  $button = null;
483  switch ($item['type']) {
484  case 'button_obj':
485  $button = $item['instance'];
486  break;
487  case 'fbutton':
488  $button = ilSubmitButton::getInstance();
489  $button->setPrimary($item['primary']);
490  $button->setCaption($item['txt'], false);
491  $button->setCommand($item['cmd']);
492  break;
493  case 'button':
494  $button = ilLinkButton::getInstance();
495  $button->setCaption($item['txt'], false);
496  $button->setUrl($item['cmd']);
497  $button->setTarget($item['target']);
498  $button->setId($item['id']);
499  break;
500  }
501  $this->addStickyItem($button);
502  $this->items = [];
503  }
504  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCloseFormTag()

ilToolbarGUI::getCloseFormTag ( )

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

References $close_form_tag.

Referenced by getGroupedItems().

244  : bool
245  {
246  return $this->close_form_tag;
247  }
+ Here is the caller graph for this function:

◆ getFormAction()

ilToolbarGUI::getFormAction ( )

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

References $form_action.

Referenced by getGroupedItems().

73  : string
74  {
75  return $this->form_action;
76  }
+ Here is the caller graph for this function:

◆ getFormName()

ilToolbarGUI::getFormName ( )

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

References $form_name.

Referenced by getGroupedItems().

254  : string
255  {
256  return $this->form_name;
257  }
+ Here is the caller graph for this function:

◆ getGroupedItems()

ilToolbarGUI::getGroupedItems ( )

Get all groups (items separated by a separator)

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

References $GLOBALS, $lng, applyAutoStickyToSingleElement(), getCloseFormTag(), getFormAction(), getFormName(), getHidden(), getId(), getOpenFormTag(), getPreventDoubleSubmission(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\Repository\lng(), null, ilLanguage\txt(), and ILIAS\Repository\ui().

263  : array
264  {
265  $groups = array();
266  $group = array();
267  foreach ($this->items as $item) {
268  if ($item['type'] === 'separator') {
269  $groups[] = $group;
270  $group = array();
271  } else {
272  $group[] = $item;
273  }
274  }
275  if (count($group)) {
276  $groups[] = $group;
277  }
278 
279  return $groups;
280  }
+ Here is the call graph for this function:

◆ getHidden()

ilToolbarGUI::getHidden ( )

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

References $hidden.

Referenced by getGroupedItems().

90  : bool
91  {
92  return $this->hidden;
93  }
+ Here is the caller graph for this function:

◆ getId()

ilToolbarGUI::getId ( )

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

Referenced by getGroupedItems().

100  : string
101  {
102  return $this->id ?: self::$instances;
103  }
+ Here is the caller graph for this function:

◆ getItems()

ilToolbarGUI::getItems ( )

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

References $items.

459  : array
460  {
461  return $this->items;
462  }

◆ getOpenFormTag()

ilToolbarGUI::getOpenFormTag ( )

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

References $open_form_tag.

Referenced by getGroupedItems().

234  : bool
235  {
236  return $this->open_form_tag;
237  }
+ Here is the caller graph for this function:

◆ getPreventDoubleSubmission()

ilToolbarGUI::getPreventDoubleSubmission ( )

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

References $prevent_double_submission.

Referenced by getGroupedItems().

110  : bool
111  {
113  }
bool $prevent_double_submission
+ Here is the caller graph for this function:

◆ setCloseFormTag()

ilToolbarGUI::setCloseFormTag ( bool  $a_val)

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

Referenced by ilObjTestGUI\forwardToInfoScreen().

239  : void
240  {
241  $this->close_form_tag = $a_val;
242  }
+ Here is the caller graph for this function:

◆ setFormAction()

ilToolbarGUI::setFormAction ( string  $a_val,
bool  $a_multipart = false,
string  $a_target = "" 
)

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

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

Referenced by ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\build(), ilTestSkillEvaluationToolbarGUI\build(), McstImageGalleryGUI\getHTML(), and ilContSkillAdminGUI\listProfiles().

67  : void {
68  $this->form_action = $a_val;
69  $this->multipart = $a_multipart;
70  $this->form_target = $a_target;
71  }
+ Here is the caller graph for this function:

◆ setFormName()

ilToolbarGUI::setFormName ( string  $a_val)

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

249  : void
250  {
251  $this->form_name = $a_val;
252  }

◆ setHidden()

ilToolbarGUI::setHidden ( bool  $a_val)

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

85  : void
86  {
87  $this->hidden = $a_val;
88  }

◆ setId()

ilToolbarGUI::setId ( string  $a_val)

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

Referenced by ilTestSubmissionReviewGUI\buildToolbar(), ilCalendarAppointmentPresentationGUI\getContentByPlugins(), ilCalendarAppointmentPresentationGUI\getModalHTML(), and ilContainerGUI\showAdministrationPanel().

95  : void
96  {
97  $this->id = $a_val;
98  }
+ Here is the caller graph for this function:

◆ setItems()

ilToolbarGUI::setItems ( array  $items)

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

References $items.

Referenced by ilTestInfoScreenToolbarGUI\clearItems().

464  : void
465  {
466  $this->items = $items;
467  }
+ Here is the caller graph for this function:

◆ setLeadingImage()

ilToolbarGUI::setLeadingImage ( string  $a_img,
string  $a_alt 
)

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

Referenced by ILIAS\components\UICore\MetaTemplate\PageContentGUI\fillAdminPanel(), ilGlobalTemplate\fillAdminPanel(), ilDataCollectionGlobalTemplate\fillAdminPanel(), ilContainerGUI\showAdministrationPanel(), and ilObjWorkspaceFolderGUI\showAdministrationPanel().

81  : void {
82  $this->lead_img = array("img" => $a_img, "alt" => $a_alt);
83  }
+ Here is the caller graph for this function:

◆ setOpenFormTag()

ilToolbarGUI::setOpenFormTag ( bool  $a_val)

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

230  : void {
231  $this->open_form_tag = $a_val;
232  }

◆ setPreventDoubleSubmission()

ilToolbarGUI::setPreventDoubleSubmission ( bool  $a_val)

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

105  : void
106  {
107  $this->prevent_double_submission = $a_val;
108  }

Field Documentation

◆ $close_form_tag

bool ilToolbarGUI::$close_form_tag = true
protected

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

Referenced by getCloseFormTag().

◆ $form_action

string ilToolbarGUI::$form_action = ''
protected

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

Referenced by getFormAction().

◆ $form_name

string ilToolbarGUI::$form_name = ""
protected

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

Referenced by getFormName().

◆ $form_target

string ilToolbarGUI::$form_target = ""
protected

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

◆ $has_separator

bool ilToolbarGUI::$has_separator = false
protected

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

◆ $hidden

bool ilToolbarGUI::$hidden = false
protected

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

Referenced by getHidden().

◆ $id

string ilToolbarGUI::$id = ''
protected

◆ $instances

int ilToolbarGUI::$instances = 0
staticprotected

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

◆ $items

array ilToolbarGUI::$items = array()

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

Referenced by getItems(), and setItems().

◆ $lead_img

array ilToolbarGUI::$lead_img
protected
Initial value:
= array(
'img' => '',
'alt' => '',
)

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

◆ $lng

ilLanguage ilToolbarGUI::$lng
protected

◆ $multipart

bool ilToolbarGUI::$multipart = false
protected

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

◆ $open_form_tag

bool ilToolbarGUI::$open_form_tag = true
protected

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

Referenced by getOpenFormTag().

◆ $prevent_double_submission

bool ilToolbarGUI::$prevent_double_submission = false
protected

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

Referenced by getPreventDoubleSubmission().

◆ $sticky_items

array ilToolbarGUI::$sticky_items = array()
protected

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

◆ $ui

ILIAS DI UIServices ilToolbarGUI::$ui
protected

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


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