ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LDAP\Server\UI\ServerTable Class Reference
+ Inheritance diagram for ILIAS\LDAP\Server\UI\ServerTable:
+ Collaboration diagram for ILIAS\LDAP\Server\UI\ServerTable:

Public Member Functions

 __construct (private array $servers, private \ilLDAPSettingsGUI $parent_gui, private \ILIAS\UI\Factory $ui_factory, private \ILIAS\UI\Renderer $ui_renderer, private \ilLanguage $lng, private \ilCtrlInterface $ctrl, private \Psr\Http\Message\ServerRequestInterface $http_request, private \ILIAS\Data\URI $action_url, private bool $has_write_access)
 
 getRows (\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, \ILIAS\Data\Range $range, \ILIAS\Data\Order $order, ?array $filter_data, ?array $additional_parameters)
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 
 getComponent ()
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Private Member Functions

 getRecords (\ILIAS\Data\Range $range, \ILIAS\Data\Order $order)
 
 getColumnDefinition ()
 
 getActions ()
 

Private Attributes

ILIAS UI URLBuilder $url_builder
 
ILIAS UI URLBuilderToken $action_parameter_token
 
ILIAS UI URLBuilderToken $row_id_token
 

Detailed Description

Definition at line 23 of file ServerTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LDAP\Server\UI\ServerTable::__construct ( private array  $servers,
private \ilLDAPSettingsGUI  $parent_gui,
private \ILIAS\UI\Factory  $ui_factory,
private \ILIAS\UI\Renderer  $ui_renderer,
private \ilLanguage  $lng,
private \ilCtrlInterface  $ctrl,
private \Psr\Http\Message\ServerRequestInterface  $http_request,
private \ILIAS\Data\URI  $action_url,
private bool  $has_write_access 
)
Parameters
list<array<string,string|int|float|null>>$servers

Definition at line 32 of file ServerTable.php.

42 {
43 [
47 ] = (new \ILIAS\UI\URLBuilder($action_url))->acquireParameters(
48 ['ldap', 'servers'],
49 'table_action',
50 'server_id'
51 );
52 }
ILIAS UI URLBuilder $url_builder
Definition: ServerTable.php:25
ILIAS UI URLBuilderToken $action_parameter_token
Definition: ServerTable.php:26
ILIAS UI URLBuilderToken $row_id_token
Definition: ServerTable.php:27

References ILIAS\LDAP\Server\UI\ServerTable\$action_parameter_token, ILIAS\LDAP\Server\UI\ServerTable\$row_id_token, and ILIAS\LDAP\Server\UI\ServerTable\$url_builder.

Member Function Documentation

◆ getActions()

ILIAS\LDAP\Server\UI\ServerTable::getActions ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 176 of file ServerTable.php.

176 : array
177 {
178 if (!$this->has_write_access) {
179 return [];
180 }
181
182 return [
183 'editServerSettings' => $this->ui_factory->table()->action()->single(
184 $this->lng->txt('edit'),
185 $this->url_builder->withParameter($this->action_parameter_token, 'editServerSettings'),
186 $this->row_id_token
187 ),
188 'activateServer' => $this->ui_factory->table()->action()->single(
189 $this->lng->txt('activate'),
190 $this->url_builder->withParameter($this->action_parameter_token, 'activateServer'),
191 $this->row_id_token
192 ),
193 'deactivateServer' => $this->ui_factory->table()->action()->single(
194 $this->lng->txt('deactivate'),
195 $this->url_builder->withParameter($this->action_parameter_token, 'deactivateServer'),
196 $this->row_id_token
197 ),
198 'confirmDeleteServerSettings' => $this->ui_factory->table()->action()->single(
199 $this->lng->txt('delete'),
200 $this->url_builder->withParameter($this->action_parameter_token, 'confirmDeleteServerSettings'),
201 $this->row_id_token
202 )
203 ];
204 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getColumnDefinition()

ILIAS\LDAP\Server\UI\ServerTable::getColumnDefinition ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Column\Column>

Definition at line 136 of file ServerTable.php.

136 : array
137 {
138 return [
139 'active' => $this->ui_factory
140 ->table()
141 ->column()
142 ->boolean(
143 $this->lng->txt('status'),
144 $this->ui_factory->symbol()->icon()->custom(
145 'assets/images/standard/icon_ok.svg',
146 $this->lng->txt('active'),
147 'small'
148 ),
149 $this->ui_factory->symbol()->icon()->custom(
150 'assets/images/standard/icon_not_ok.svg',
151 $this->lng->txt('inactive'),
152 'small'
153 )
154 )
155 ->withIsSortable(true)
156 ->withOrderingLabels(
157 "{$this->lng->txt('status')}, {$this->lng->txt('active')} {$this->lng->txt('order_option_first')}",
158 "{$this->lng->txt('status')}, {$this->lng->txt('inactive')} {$this->lng->txt('order_option_first')}"
159 ),
160 'name' => $this->ui_factory
161 ->table()
162 ->column()
163 ->text($this->lng->txt('title'))
164 ->withIsSortable(true),
165 'user' => $this->ui_factory
166 ->table()
167 ->column()
168 ->number($this->lng->txt('user'))
169 ->withIsSortable(true)
170 ];
171 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

ILIAS\LDAP\Server\UI\ServerTable::getComponent ( )

Definition at line 206 of file ServerTable.php.

207 {
208 return $this->ui_factory
209 ->table()
210 ->data(
211 $this,
212 $this->lng->txt('ldap_servers'),
213 $this->getColumnDefinition(),
214 )
215 ->withId(self::class)
216 ->withOrder(new \ILIAS\Data\Order('title', \ILIAS\Data\Order::ASC))
217 ->withActions($this->getActions())
218 ->withRequest($this->http_request);
219 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Data\Order\ASC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\LDAP\Server\UI\ServerTable::getRecords ( \ILIAS\Data\Range  $range,
\ILIAS\Data\Order  $order 
)
private
Returns
list<array<string, string|int|float|null>>

Definition at line 57 of file ServerTable.php.

57 : array
58 {
59 $servers = $this->servers;
60
61 [$order_field, $order_direction] = $order->join([], static function ($ret, $key, $value) {
62 return [$key, $value];
63 });
64
65 array_walk(
66 $servers,
67 static function (array &$server): void {
68 $server['user'] = \count(\ilObjUser::_getExternalAccountsByAuthMode('ldap_' . $server['server_id']));
69 }
70 );
71
72 $records = \ilArrayUtil::sortArray(
73 $servers,
74 $order_field,
75 strtolower($order_direction),
76 \in_array($order_field, ['user', 'active'], true)
77 );
78
79 if ($order_field === 'active') {
80 $records = array_reverse($records);
81 }
82
83 $records = \array_slice($records, $range->getStart(), $range->getLength());
84
85 return $records;
86 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getExternalAccountsByAuthMode(string $a_auth_mode, bool $a_read_auth_default=false)
Get list of external account by authentication method Note: If login == ext_account for two user with...
$server
Definition: shib_login.php:28

References ILIAS\UI\Implementation\Component\Table\$range, $server, ilObjUser\_getExternalAccountsByAuthMode(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ilArrayUtil\sortArray().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\LDAP\Server\UI\ServerTable::getRows ( \ILIAS\UI\Component\Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
\ILIAS\Data\Range  $range,
\ILIAS\Data\Order  $order,
?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 88 of file ServerTable.php.

95 : \Generator {
96 foreach ($this->getRecords($range, $order) as $server) {
97 $title = $server['name'];
98 if ($this->has_write_access) {
99 $this->ctrl->setParameter($this->parent_gui, 'ldap_server_id', $server['server_id']);
100 $title = $this->ui_renderer->render(
101 $this->ui_factory->link()->standard(
102 $title,
103 $this->ctrl->getLinkTarget($this->parent_gui, 'editServerSettings')
104 )
105 );
106 }
107
108 yield $row_builder
109 ->buildDataRow(
110 (string) $server['server_id'],
111 [
112 'name' => $title,
113 'active' => (bool) $server['active'],
114 'user' => $server['user']
115 ]
116 )
117 ->withDisabledAction(
118 'activateServer',
119 (bool) $server['active'],
120 )
121 ->withDisabledAction(
122 'deactivateServer',
123 !$server['active'],
124 );
125 }
126 }
getRecords(\ILIAS\Data\Range $range, \ILIAS\Data\Order $order)
Definition: ServerTable.php:57

References $server, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\LDAP\Server\UI\ServerTable::getTotalRowCount ( ?array  $filter_data,
?array  $additional_parameters 
)

Mainly for the purpose of pagination-support, it is important to know about the total number of records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 128 of file ServerTable.php.

128 : ?int
129 {
130 return \count($this->servers);
131 }

Field Documentation

◆ $action_parameter_token

ILIAS UI URLBuilderToken ILIAS\LDAP\Server\UI\ServerTable::$action_parameter_token
private

Definition at line 26 of file ServerTable.php.

Referenced by ILIAS\LDAP\Server\UI\ServerTable\__construct().

◆ $row_id_token

ILIAS UI URLBuilderToken ILIAS\LDAP\Server\UI\ServerTable::$row_id_token
private

Definition at line 27 of file ServerTable.php.

Referenced by ILIAS\LDAP\Server\UI\ServerTable\__construct().

◆ $url_builder

ILIAS UI URLBuilder ILIAS\LDAP\Server\UI\ServerTable::$url_builder
private

Definition at line 25 of file ServerTable.php.

Referenced by ILIAS\LDAP\Server\UI\ServerTable\__construct().


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