ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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

Definition at line 48 of file AddNewItemGUI.php.

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

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 
60  $this->lng->loadLanguageModule('wsp');
61  $this->lng->loadLanguageModule('rep');
62  $this->lng->loadLanguageModule('cntr');
63  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ buildAddNewItemsMenu()

ILIAS\ILIASObject\Creation\AddNewItemGUI::buildAddNewItemsMenu ( array  $elements)
private
Returns
array<Component|Component|Divider>

Definition at line 96 of file AddNewItemGUI.php.

References ILIAS\ILIASObject\Creation\Group.

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

96  : ?array
97  {
98  $sub_menu = [];
99 
100  foreach ($elements as $element) {
101  if ($element->getType() === AddNewItemElementTypes::Group) {
102  $sub_menu[] = $this->ui_factory->menu()->sub(
103  $element->getLabel(),
104  $this->buildAddNewItemsMenu($element->getSubElements())
105  );
106  }
107  if ($element->getType() === AddNewItemElementTypes::Object) {
108  $sub_menu[] = $this->ui_factory->link()->bulky(
109  $element->getIcon(),
110  $element->getLabel(),
111  $element->getCreationUri()
112  );
113  continue;
114  }
115  }
116 
117  return $sub_menu;
118  }
+ Here is the caller graph for this function:

◆ render()

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

Add new item selection to current page incl.

toolbar (trigger) and overlay

Definition at line 68 of file AddNewItemGUI.php.

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

68  : void
69  {
70  if ($this->elements === []) {
71  return;
72  }
73  $modal = $this->ui_factory->modal()->roundtrip(
74  $this->lng->txt('cntr_add_new_item'),
75  $this->ui_factory->menu()->drilldown(
76  $this->lng->txt('object_list'),
77  $this->buildAddNewItemsMenu($this->elements)
78  )
79  );
80 
81  $this->toolbar->addComponent(
82  $this->ui_factory->button()->primary(
83  $this->lng->txt('cntr_add_new_item'),
84  $modal->getShowSignal()
85  )
86  );
87  $this->tpl->setVariable(
88  'IL_OBJECT_ADD_NEW_ITEM_MODAL',
89  $this->ui_renderer->render($modal)
90  );
91  }
+ 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: