ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $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, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $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 180 of file ServerTable.php.

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

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 140 of file ServerTable.php.

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

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

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

Definition at line 210 of file ServerTable.php.

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

References 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,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Definition at line 88 of file ServerTable.php.

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

133 : ?int {
134 return \count($this->servers);
135 }

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: