ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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)
 
 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:
with ILIAS 12

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

Member Function Documentation

◆ 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.

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 }

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

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

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.

References ilButtonBase\isPrimary().

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

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 }

References ilSubmitButton\getInstance().

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

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

Reimplemented in ilTestInfoScreenToolbarGUI.

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

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

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\addApprSelectionToToolbar(), ILIAS\Survey\Mode\IndividualFeedback\UIModifier\addRaterSelectionToToolbar(), ilPersonalSkillsFilterGUI\addToToolbar(), ilDidacticTemplateGUI\appendToolbarSwitch(), ilTestSkillEvaluationToolbarGUI\build(), and ilContSkillAdminGUI\listProfiles().

+ Here is the caller graph for this function:

◆ addLink()

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

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

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

◆ addSeparator()

◆ addSpacer()

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

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

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

◆ 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.

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

Referenced by ilTestNavigationToolbarGUI\build(), ilAppointmentPresentationGUI\getHTML(), ILIAS\MediaCast\Presentation\VideoViewGUI\renderToolbar(), ILIAS\Repository\Button\ButtonAdapterGUI\toToolbar(), and ILIAS\Repository\Link\LinkAdapterGUI\toToolbar().

+ Here is the caller graph for this function:

◆ addText()

ilToolbarGUI::addText ( string  $a_text)

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

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

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch().

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

465 : void
466 {
467 if (count($this->items) === 1 && count($this->sticky_items) === 0) {
468 $supported_types = ['button', 'fbutton', 'button_obj'];
469 $item = $this->items[0];
470 if (!in_array($item['type'], $supported_types)) {
471 return;
472 }
473 $button = null;
474 switch ($item['type']) {
475 case 'button_obj':
476 $button = $item['instance'];
477 break;
478 case 'fbutton':
479 $button = ilSubmitButton::getInstance();
480 $button->setPrimary($item['primary']);
481 $button->setCaption($item['txt'], false);
482 $button->setCommand($item['cmd']);
483 break;
484 case 'button':
485 $button = ilLinkButton::getInstance();
486 $button->setCaption($item['txt'], false);
487 $button->setUrl($item['cmd']);
488 $button->setTarget($item['target']);
489 $button->setId($item['id']);
490 break;
491 }
492 $this->addStickyItem($button);
493 $this->items = [];
494 }
495 }

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

+ Here is the call graph for this function:

◆ getCloseFormTag()

ilToolbarGUI::getCloseFormTag ( )

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

240 : bool
241 {
243 }

◆ getFormAction()

ilToolbarGUI::getFormAction ( )

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

73 : string
74 {
75 return $this->form_action;
76 }

◆ getFormName()

ilToolbarGUI::getFormName ( )

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

250 : string
251 {
252 return $this->form_name;
253 }

◆ getGroupedItems()

ilToolbarGUI::getGroupedItems ( )

Get all groups (items separated by a separator)

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

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

◆ getHidden()

ilToolbarGUI::getHidden ( )

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

90 : bool
91 {
92 return $this->hidden;
93 }

◆ getId()

ilToolbarGUI::getId ( )

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

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

◆ getItems()

ilToolbarGUI::getItems ( )

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

450 : array
451 {
452 return $this->items;
453 }

◆ getOpenFormTag()

ilToolbarGUI::getOpenFormTag ( )

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

230 : bool
231 {
233 }

◆ getPreventDoubleSubmission()

ilToolbarGUI::getPreventDoubleSubmission ( )

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

110 : bool
111 {
113 }
bool $prevent_double_submission

◆ setCloseFormTag()

ilToolbarGUI::setCloseFormTag ( bool  $a_val)

Reimplemented in ilTestInfoScreenToolbarGUI.

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

235 : void
236 {
237 $this->close_form_tag = $a_val;
238 }

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

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

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

+ Here is the caller graph for this function:

◆ setFormName()

ilToolbarGUI::setFormName ( string  $a_val)

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

245 : void
246 {
247 $this->form_name = $a_val;
248 }

◆ 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.

95 : void
96 {
97 $this->id = $a_val;
98 }

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

+ Here is the caller graph for this function:

◆ setItems()

ilToolbarGUI::setItems ( array  $items)

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

455 : void
456 {
457 $this->items = $items;
458 }

◆ setLeadingImage()

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

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

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

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

+ Here is the caller graph for this function:

◆ setOpenFormTag()

ilToolbarGUI::setOpenFormTag ( bool  $a_val)

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

226 : void {
227 $this->open_form_tag = $a_val;
228 }

◆ 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.

◆ $form_action

string ilToolbarGUI::$form_action = ''
protected

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

◆ $form_name

string ilToolbarGUI::$form_name = ""
protected

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

◆ $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.

◆ $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.

◆ $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.

◆ $prevent_double_submission

bool ilToolbarGUI::$prevent_double_submission = false
protected

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

◆ $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: