ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\ILIASObject\Creation\AddNewItemGUI Class Reference

Render add new item selector. More...

+ Collaboration diagram for ILIAS\ILIASObject\Creation\AddNewItemGUI:

Public Member Functions

 __construct (private array $elements=[])
 
 createModal ()
 
 renderToolbarAction ()
 Add new item selection to current page incl. More...
 

Private Member Functions

 buildAddNewItemsMenu (array $elements)
 

Private Attributes

ilLanguage $lng
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $tpl
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 

Detailed Description

Render add new item selector.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 35 of file AddNewItemGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ILIASObject\Creation\AddNewItemGUI::__construct ( private array  $elements = [])
Parameters
array<AddNewItemElement>$elements The Key MUST contain the object type or the

Definition at line 48 of file AddNewItemGUI.php.

50 {
51 global $DIC;
52
53 $this->lng = $DIC['lng'];
54 $this->toolbar = $DIC['ilToolbar'];
55 $this->tpl = $DIC['tpl'];
56
57 $this->ui_factory = $DIC['ui.factory'];
58 $this->ui_renderer = $DIC['ui.renderer'];
59 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildAddNewItemsMenu()

ILIAS\ILIASObject\Creation\AddNewItemGUI::buildAddNewItemsMenu ( array  $elements)
private
Parameters
array<AddNewItemElement>$elements
Returns
?array<Sub|Clickable|Horizontal>

Definition at line 103 of file AddNewItemGUI.php.

103 : ?array
104 {
105 $sub_menu = [];
106
107 foreach ($elements as $element) {
108 if ($element->getType() === AddNewItemElementTypes::Group) {
109 $sub_menu[] = $this->ui_factory->menu()->sub(
110 $element->getLabel(),
111 $this->buildAddNewItemsMenu($element->getSubElements())
112 );
113 continue;
114 }
115 if ($element->getType() === AddNewItemElementTypes::Object) {
116 $sub_menu[] = $this->ui_factory->link()->bulky(
117 $element->getIcon(),
118 $element->getLabel(),
119 $element->getCreationUri()
120 );
121 }
122 }
123
124 return $sub_menu;
125 }

References ILIAS\ILIASObject\Creation\Group.

◆ createModal()

ILIAS\ILIASObject\Creation\AddNewItemGUI::createModal ( )

Definition at line 61 of file AddNewItemGUI.php.

61 : ?RoundTrip
62 {
63 if ($this->elements === []) {
64 return null;
65 }
66
67 return $this->ui_factory->modal()->roundtrip(
68 $this->lng->txt('cntr_add_new_item'),
69 $this->ui_factory->menu()->drilldown(
70 $this->lng->txt('object_list'),
71 $this->buildAddNewItemsMenu($this->elements)
72 )
73 );
74 }

References ILIAS\Repository\lng().

Referenced by ILIAS\ILIASObject\Creation\AddNewItemGUI\renderToolbarAction().

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

◆ renderToolbarAction()

ILIAS\ILIASObject\Creation\AddNewItemGUI::renderToolbarAction ( )

Add new item selection to current page incl.

toolbar (trigger) and overlay

Definition at line 79 of file AddNewItemGUI.php.

79 : void
80 {
81 $modal = $this->createModal();
82
83 if ($modal === null) {
84 return;
85 }
86
87 $this->toolbar->addComponent(
88 $this->ui_factory->button()->primary(
89 $this->lng->txt('cntr_add_new_item'),
90 $modal->getShowSignal()
91 )
92 );
93 $this->tpl->setVariable(
94 'IL_OBJECT_ADD_NEW_ITEM_MODAL',
95 $this->ui_renderer->render($modal)
96 );
97 }

References ILIAS\ILIASObject\Creation\AddNewItemGUI\createModal(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ILIAS\ILIASObject\Creation\AddNewItemGUI::$lng
private

Definition at line 37 of file AddNewItemGUI.php.

◆ $toolbar

ilToolbarGUI ILIAS\ILIASObject\Creation\AddNewItemGUI::$toolbar
private

Definition at line 38 of file AddNewItemGUI.php.

◆ $tpl

ilGlobalTemplateInterface ILIAS\ILIASObject\Creation\AddNewItemGUI::$tpl
private

Definition at line 39 of file AddNewItemGUI.php.

◆ $ui_factory

UIFactory ILIAS\ILIASObject\Creation\AddNewItemGUI::$ui_factory
private

Definition at line 41 of file AddNewItemGUI.php.

◆ $ui_renderer

UIRenderer ILIAS\ILIASObject\Creation\AddNewItemGUI::$ui_renderer
private

Definition at line 42 of file AddNewItemGUI.php.


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