ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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=[])
 
 render ()
 Add new item selection to current page incl. More...
 

Private Member Functions

 buildAddNewItemsMenu (array $elements)
 

Private Attributes

ilLanguage $lng
 
ilObjectDefinition $obj_definition
 
ilSetting $settings
 
ilAccessHandler $access
 
ilCtrl $ctrl
 
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 31 of file AddNewItemGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ILIASObject\Creation\AddNewItemGUI::__construct ( private array  $elements = [])
Parameters
array<ILIAS

ILIASObject\Creation\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
Returns
array<Component\Menu\Sub|Component\Clickable|Divider\Horizontal>

Definition at line 92 of file AddNewItemGUI.php.

92 : ?array
93 {
94 $sub_menu = [];
95
96 foreach ($elements as $element) {
97 if ($element->getType() === AddNewItemElementTypes::Group) {
98 $sub_menu[] = $this->ui_factory->menu()->sub(
99 $element->getLabel(),
100 $this->buildAddNewItemsMenu($element->getSubElements())
101 );
102 }
103 if ($element->getType() === AddNewItemElementTypes::Object) {
104 $sub_menu[] = $this->ui_factory->link()->bulky(
105 $element->getIcon(),
106 $element->getLabel(),
107 $element->getCreationUri()
108 );
109 continue;
110 }
111 }
112
113 return $sub_menu;
114 }

References ILIAS\ILIASObject\Creation\Group.

◆ render()

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

Add new item selection to current page incl.

toolbar (trigger) and overlay

Definition at line 64 of file AddNewItemGUI.php.

64 : void
65 {
66 if ($this->elements === []) {
67 return;
68 }
69 $modal = $this->ui_factory->modal()->roundtrip(
70 $this->lng->txt('cntr_add_new_item'),
71 $this->ui_factory->menu()->drilldown(
72 $this->lng->txt('object_list'),
73 $this->buildAddNewItemsMenu($this->elements)
74 )
75 );
76
77 $this->toolbar->addComponent(
78 $this->ui_factory->button()->primary(
79 $this->lng->txt('cntr_add_new_item'),
80 $modal->getShowSignal()
81 )
82 );
83 $this->tpl->setVariable(
84 'IL_OBJECT_ADD_NEW_ITEM_MODAL',
85 $this->ui_renderer->render($modal)
86 );
87 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ILIAS\ILIASObject\Creation\AddNewItemGUI::$access
private

Definition at line 36 of file AddNewItemGUI.php.

◆ $ctrl

ilCtrl ILIAS\ILIASObject\Creation\AddNewItemGUI::$ctrl
private

Definition at line 37 of file AddNewItemGUI.php.

◆ $lng

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

Definition at line 33 of file AddNewItemGUI.php.

◆ $obj_definition

ilObjectDefinition ILIAS\ILIASObject\Creation\AddNewItemGUI::$obj_definition
private

Definition at line 34 of file AddNewItemGUI.php.

◆ $settings

ilSetting ILIAS\ILIASObject\Creation\AddNewItemGUI::$settings
private

Definition at line 35 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: