ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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, private bool $has_read_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 25 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,
private bool  $has_read_access 
)
Parameters
list<array<string,string|int|float|null>>$servers

Definition at line 34 of file ServerTable.php.

45 {
46 [
50 ] = (new \ILIAS\UI\URLBuilder($action_url))->acquireParameters(
51 ['ldap', 'servers'],
52 'table_action',
53 'server_id'
54 );
55 }
ILIAS UI URLBuilder $url_builder
Definition: ServerTable.php:27
ILIAS UI URLBuilderToken $action_parameter_token
Definition: ServerTable.php:28
ILIAS UI URLBuilderToken $row_id_token
Definition: ServerTable.php:29

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

183 : array
184 {
185 $actions = [];
186
187 if ($this->has_read_access || $this->has_write_access) {
188 $actions['editServerSettings'] = $this->ui_factory->table()->action()->single(
189 $this->has_write_access ? $this->lng->txt('edit') : $this->lng->txt('view'),
190 $this->url_builder->withParameter($this->action_parameter_token, 'editServerSettings'),
191 $this->row_id_token
192 );
193 }
194
195 if ($this->has_write_access) {
196 $actions['activateServer'] = $this->ui_factory->table()->action()->single(
197 $this->lng->txt('activate'),
198 $this->url_builder->withParameter($this->action_parameter_token, 'activateServer'),
199 $this->row_id_token
200 );
201
202 $actions['deactivateServer'] = $this->ui_factory->table()->action()->single(
203 $this->lng->txt('deactivate'),
204 $this->url_builder->withParameter($this->action_parameter_token, 'deactivateServer'),
205 $this->row_id_token
206 );
207
208 $actions['confirmDeleteServerSettings'] = $this->ui_factory->table()->action()->single(
209 $this->lng->txt('delete'),
210 $this->url_builder->withParameter($this->action_parameter_token, 'confirmDeleteServerSettings'),
211 $this->row_id_token
212 );
213 }
214
215 return $actions;
216 }

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

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

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

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

Definition at line 218 of file ServerTable.php.

219 {
220 return $this->ui_factory
221 ->table()
222 ->data(
223 $this,
224 $this->lng->txt('ldap_servers'),
225 $this->getColumnDefinition(),
226 )
227 ->withId(str_replace('\\', '', self::class))
228 ->withOrder(new \ILIAS\Data\Order('title', \ILIAS\Data\Order::ASC))
229 ->withRange(new Range(0, 100))
230 ->withActions($this->getActions())
231 ->withRequest($this->http_request);
232 }
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 60 of file ServerTable.php.

60 : array
61 {
62 $servers = $this->servers;
63
64 [$order_field, $order_direction] = $order->join([], static function ($ret, $key, $value) {
65 return [$key, $value];
66 });
67
68 array_walk(
69 $servers,
70 static function (array &$server): void {
71 $server['user'] = \count(\ilObjUser::_getExternalAccountsByAuthMode('ldap_' . $server['server_id']));
72 }
73 );
74
75 $records = \ilArrayUtil::sortArray(
76 $servers,
77 $order_field,
78 strtolower($order_direction),
79 \in_array($order_field, ['user', 'active'], true)
80 );
81
82 if ($order_field === 'active') {
83 $records = array_reverse($records);
84 }
85
86 $records = \array_slice($records, $range->getStart(), $range->getLength());
87
88 return $records;
89 }
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 91 of file ServerTable.php.

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

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

136 : ?int {
137 return \count($this->servers);
138 }

Field Documentation

◆ $action_parameter_token

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

Definition at line 28 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 29 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 27 of file ServerTable.php.

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


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