ILIAS  release_8 Revision v8.24
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

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

Member Function Documentation

◆ addAdvancedSelectionList()

ilToolbarGUI::addAdvancedSelectionList ( ilAdvancedSelectionListGUI  $adv)

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

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

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

124 : void {
125 $this->items[] = array("type" => "button", "txt" => $a_txt, "cmd" => $a_cmd,
126 "target" => $a_target, "acc_key" => $a_acc_key, 'add_attrs' => $a_additional_attrs,
127 "id" => $a_id, "class" => $a_class);
128 }

Referenced by ilTestResultsToolbarGUI\build(), ilObjSurveyQuestionPoolGUI\exportObject(), ilPCProfileGUI\initForm(), ilObjStudyProgrammeMembersGUI\initMailToMemberButton(), ilContSkillAdminGUI\listCompetences(), ilRecommendedContentRoleConfigGUI\listItems(), ilCalendarCategoryGUI\manage(), ilObjTestGUI\populateQuestionBrowserToolbarButtons(), ilContainerGUI\renderObject(), ilSkillProfileGUI\showLevelsWithLocalContext(), ilMembershipGUI\showMailToMemberToolbarButton(), and ilMembershipGUI\showMemberExportToolbarButton().

+ Here is the caller graph for this function:

◆ addButtonInstance()

ilToolbarGUI::addButtonInstance ( ilButtonBase  $a_button)

Add button instance.

Parameters
ilButtonBase$a_button

Reimplemented in ilTestInfoScreenToolbarGUI.

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

176 : void
177 {
178 if ($a_button->isPrimary()) {
179 $this->addStickyItem($a_button);
180 } else {
181 $this->items[] = array("type" => "button_obj", "instance" => $a_button);
182 }
183 }
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.

References ilButtonBase\isPrimary().

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\addApprSelectionToToolbar(), ilParticipantsTestResultsGUI\addDeleteAllTestResultsButton(), ilTestParticipantsGUI\addFinishAllPassesButton(), ilTestNavigationToolbarGUI\addFinishTestButton(), ilTestNavigationToolbarGUI\addQuestionListButton(), ilTestNavigationToolbarGUI\addQuestionSelectionButton(), ilTestNavigationToolbarGUI\addQuestionTreeButton(), ILIAS\Survey\Mode\IndividualFeedback\UIModifier\addRaterSelectionToToolbar(), ilTestNavigationToolbarGUI\addSuspendTestButton(), ilTestParticipantsGUI\addUserSearchControls(), ilTestResultsToolbarGUI\build(), ilAssQuestionPreviewToolbarGUI\build(), ilObjCmiXapiAdministrationGUI\buildLrsTypesToolbarGUI(), ilDclRecordListGUI\createSwitchers(), ilAppointmentPresentationGUI\getHTML(), ILIAS\Survey\InfoScreen\InfoScreenGUI\getInfoScreenGUI(), and ilContSkillAdminGUI\listProfiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addComponent()

◆ addDropDown()

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

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

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

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

139 : void {
140 if ($a_primary) {
141 $button = ilSubmitButton::getInstance();
142 $button->setPrimary(true);
143 $button->setCaption($a_txt, false);
144 $button->setCommand($a_cmd);
145 $this->addStickyItem($button);
146 } else {
147 $this->items[] = array("type" => "fbutton", "txt" => $a_txt, "cmd" => $a_cmd,
148 "acc_key" => $a_acc_key, "primary" => $a_primary, "class" => $a_class);
149 }
150 }

References ilSubmitButton\getInstance().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addInputItem()

◆ addLink()

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

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

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

◆ addSeparator()

◆ addSpacer()

ilToolbarGUI::addSpacer ( string  $a_width = null)

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

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

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

168 : void {
169 $this->sticky_items[] = array("item" => $a_item, "label" => $a_output_label);
170 }

Referenced by ilAppointmentPresentationGUI\getHTML().

+ Here is the caller graph for this function:

◆ addText()

ilToolbarGUI::addText ( string  $a_text)

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

203 : void
204 {
205 $this->items[] = array("type" => "text", "text" => $a_text);
206 }

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), and ilDclRecordListGUI\createSwitchers().

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

509 : void
510 {
511 if (count($this->items) === 1 && count($this->sticky_items) === 0) {
512 $supported_types = ['button', 'fbutton', 'button_obj'];
513 $item = $this->items[0];
514 if (!in_array($item['type'], $supported_types)) {
515 return;
516 }
517 $button = null;
518 switch ($item['type']) {
519 case 'button_obj':
520 $button = $item['instance'];
521 break;
522 case 'fbutton':
523 $button = ilSubmitButton::getInstance();
524 $button->setPrimary($item['primary']);
525 $button->setCaption($item['txt'], false);
526 $button->setCommand($item['cmd']);
527 break;
528 case 'button':
529 $button = ilLinkButton::getInstance();
530 $button->setCaption($item['txt'], false);
531 $button->setUrl($item['cmd']);
532 $button->setTarget($item['target']);
533 $button->setId($item['id']);
534 break;
535 }
536 $this->addStickyItem($button);
537 $this->items = [];
538 }
539 }

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

+ Here is the call graph for this function:

◆ getCloseFormTag()

ilToolbarGUI::getCloseFormTag ( )

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

242 : bool
243 {
245 }

◆ getFormAction()

ilToolbarGUI::getFormAction ( )

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

71 : string
72 {
73 return $this->form_action;
74 }

◆ getFormName()

ilToolbarGUI::getFormName ( )

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

252 : string
253 {
254 return $this->form_name;
255 }

◆ getGroupedItems()

ilToolbarGUI::getGroupedItems ( )

Get all groups (items separated by a separator)

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

261 : array
262 {
263 $groups = array();
264 $group = array();
265 foreach ($this->items as $item) {
266 if ($item['type'] === 'separator') {
267 $groups[] = $group;
268 $group = array();
269 } else {
270 $group[] = $item;
271 }
272 }
273 if (count($group)) {
274 $groups[] = $group;
275 }
276
277 return $groups;
278 }

◆ getHidden()

ilToolbarGUI::getHidden ( )

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

88 : bool
89 {
90 return $this->hidden;
91 }

◆ getId()

ilToolbarGUI::getId ( )

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

98 : string
99 {
100 return $this->id ?: self::$instances;
101 }
static int $instances

◆ getItems()

ilToolbarGUI::getItems ( )

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

494 : array
495 {
496 return $this->items;
497 }

◆ getOpenFormTag()

ilToolbarGUI::getOpenFormTag ( )

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

232 : bool
233 {
235 }

◆ getPreventDoubleSubmission()

ilToolbarGUI::getPreventDoubleSubmission ( )

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

108 : bool
109 {
111 }
bool $prevent_double_submission

◆ setCloseFormTag()

ilToolbarGUI::setCloseFormTag ( bool  $a_val)

Reimplemented in ilTestInfoScreenToolbarGUI.

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

237 : void
238 {
239 $this->close_form_tag = $a_val;
240 }

Referenced by ilObjTestGUI\infoScreen().

+ 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)

Reimplemented in ilTestInfoScreenToolbarGUI.

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

65 : void {
66 $this->form_action = $a_val;
67 $this->multipart = $a_multipart;
68 $this->form_target = $a_target;
69 }

Referenced by ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI\build(), ilTestSkillEvaluationToolbarGUI\build(), ilDclRecordListGUI\createSwitchers(), McstImageGalleryGUI\getHTML(), ILIAS\Survey\InfoScreen\InfoScreenGUI\getInfoScreenGUI(), and ilContSkillAdminGUI\listProfiles().

+ Here is the caller graph for this function:

◆ setFormName()

ilToolbarGUI::setFormName ( string  $a_val)

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

247 : void
248 {
249 $this->form_name = $a_val;
250 }

◆ setHidden()

ilToolbarGUI::setHidden ( bool  $a_val)

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

83 : void
84 {
85 $this->hidden = $a_val;
86 }

◆ setId()

ilToolbarGUI::setId ( string  $a_val)

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

93 : void
94 {
95 $this->id = $a_val;
96 }

Referenced by ilTestResultsToolbarGUI\build(), ilCalendarAppointmentPresentationGUI\getContentByPlugins(), ilCalendarAppointmentPresentationGUI\getModalHTML(), and ilContainerGUI\showAdministrationPanel().

+ Here is the caller graph for this function:

◆ setItems()

ilToolbarGUI::setItems ( array  $items)

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

499 : void
500 {
501 $this->items = $items;
502 }

◆ setLeadingImage()

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

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

79 : void {
80 $this->lead_img = array("img" => $a_img, "alt" => $a_alt);
81 }

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

+ Here is the caller graph for this function:

◆ setOpenFormTag()

ilToolbarGUI::setOpenFormTag ( bool  $a_val)

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

228 : void {
229 $this->open_form_tag = $a_val;
230 }

◆ setPreventDoubleSubmission()

ilToolbarGUI::setPreventDoubleSubmission ( bool  $a_val)

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

103 : void
104 {
105 $this->prevent_double_submission = $a_val;
106 }

Field Documentation

◆ $close_form_tag

bool ilToolbarGUI::$close_form_tag = true
protected

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

◆ $form_action

string ilToolbarGUI::$form_action = ''
protected

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

◆ $form_name

string ilToolbarGUI::$form_name = ""
protected

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

◆ $form_target

string ilToolbarGUI::$form_target = ""
protected

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

◆ $has_separator

bool ilToolbarGUI::$has_separator = false
protected

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

◆ $hidden

bool ilToolbarGUI::$hidden = false
protected

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

◆ $id

string ilToolbarGUI::$id = ''
protected

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

◆ $instances

int ilToolbarGUI::$instances = 0
staticprotected

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

◆ $items

array ilToolbarGUI::$items = array()

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

◆ $lead_img

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

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

◆ $lng

◆ $multipart

bool ilToolbarGUI::$multipart = false
protected

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

◆ $open_form_tag

bool ilToolbarGUI::$open_form_tag = true
protected

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

◆ $prevent_double_submission

bool ilToolbarGUI::$prevent_double_submission = false
protected

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

◆ $sticky_items

array ilToolbarGUI::$sticky_items = array()
protected

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

◆ $ui

ILIAS DI UIServices ilToolbarGUI::$ui
protected

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


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