ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Table.php
Go to the documentation of this file.
1<?php
2
20
24use ilLanguage;
32
36class Table
37{
38 public const ACTION_EDIT = 'edit';
39 public const ACTION_DELETE = 'delete';
40 public const ACTION_RESET = 'reset';
41 public const ACTION_DUPLICATE = 'duplicate';
48
49 protected array $components = [];
50
51 public function __construct(
52 private ilADNNotificationGUI $calling_gui,
53 ) {
54 global $DIC;
55 $this->ui_factory = $DIC['ui.factory'];
56 $this->ui_renderer = $DIC['ui.renderer'];
57 $this->ctrl = $DIC['ilCtrl'];
58 $this->lng = $DIC['lng'];
59
60 $this->url_builder = $this->initURIBuilder();
61 $columns = $this->initColumns();
62 $actions = $this->initActions();
63 $data_retrieval = new DataRetrieval(
64 (new ilObjAdministrativeNotificationAccess())->hasUserPermissionTo('write')
65 );
66
67 $this->components[] = $this->ui_factory->table()->data(
68 $data_retrieval,
69 $this->lng->txt('notifications'),
70 $columns,
71 )->withActions($actions)->withRequest(
72 $DIC->http()->request()
73 );
74 }
75
76 private function initURIBuilder(): URLBuilder
77 {
80 );
81
82 // these are the query parameters this instance is controlling
83 $query_params_namespace = ['msg', 'notifications'];
85 $query_params_namespace,
87 );
88
89 return $url_builder;
90 }
91
92 protected function initColumns(): array
93 {
94 return [
95 'title' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_title')),
96 'type' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_type')),
97 'languages' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_languages')),
98 'type_during_event' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_type_during_event')),
99 'event_start' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_event_date_start')),
100 'event_end' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_event_date_end')),
101 'display_start' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_display_date_start')),
102 'display_end' => $this->ui_factory->table()->column()->text($this->lng->txt('msg_display_date_end'))
103 ];
104 }
105
106 protected function initActions(): array
107 {
108 return [
109 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
110 $this->lng->txt("btn_edit"),
111 $this->url_builder->withURI($this->getURI(ilADNNotificationGUI::CMD_EDIT)),
112 $this->id_token
113 ),
114 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
115 $this->lng->txt("btn_delete"),
116 $this->url_builder->withURI($this->getURI(ilADNNotificationGUI::CMD_CONFIRM_DELETE)),
117 $this->id_token
118 )->withAsync(true),
119 self::ACTION_RESET => $this->ui_factory->table()->action()->standard(
120 $this->lng->txt("btn_reset"),
121 $this->url_builder->withURI($this->getURI(ilADNNotificationGUI::CMD_RESET)),
122 $this->id_token
123 ),
124 self::ACTION_DUPLICATE => $this->ui_factory->table()->action()->single(
125 $this->lng->txt("btn_duplicate"),
126 $this->url_builder->withURI($this->getURI(ilADNNotificationGUI::CMD_DUPLICATE)),
127 $this->id_token
128 ),
129 ];
130 }
131
136 protected function getURI(string $command): URI
137 {
138 return new URI(
139 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget(
140 $this->calling_gui,
141 $command
142 )
143 );
144 }
145
146 public function getHTML(): string
147 {
148 return $this->ui_renderer->render($this->components);
149 }
150
151 public function getUrlBuilder(): URLBuilder
152 {
153 return $this->url_builder;
154 }
155
156 public function getIdToken(): URLBuilderToken
157 {
158 return $this->id_token;
159 }
160
161}
__construct(private ilADNNotificationGUI $calling_gui,)
Definition: Table.php:51
getURI(string $command)
@description Unfortunately, I have not yet found an easier way to generate this URI.
Definition: Table.php:136
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
acquireParameters(array $namespace, string ... $names)
Definition: URLBuilder.php:138
Class ilADNAbstractGUI.
Class ilADNNotificationGUI @ilCtrl_IsCalledBy ilADNNotificationGUI: ilObjAdministrativeNotificationGU...
Class ilBiblFieldFilterGUI.
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilChatroomConfigFileHandler \ILIAS\Chatroom\classes.
global $DIC
Definition: shib_login.php:26