19 declare(strict_types=1);
51 private readonly
int $server_id,
57 array $visible_column_ids,
61 ?array $additional_parameters,
64 foreach ($records as $record) {
65 yield $row_builder->buildDataRow((
string) $record[
'id'], $record);
69 public function initRecords():
void 71 if ($this->records ===
null) {
73 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_not_ok.svg',
'',
'small'),
74 $this->ui_factory->symbol()->icon()->custom(
'assets/images/standard/icon_ok.svg',
'',
'small')
79 foreach ($rule_objs as $rule) {
80 switch ($rule->getType()) {
82 $type = $this->
lng->txt(
'ldap_role_by_attribute');
86 $type = $this->
lng->txt(
'ldap_role_by_group');
90 $type = $this->
lng->txt(
'ldap_role_by_plugin');
94 'id' => $rule->getRuleId(),
95 'type' => $type ??
'',
96 'condition' => $rule->conditionToString(),
97 'add' => $icons[(
int) $rule->isAddOnUpdateEnabled()],
98 'remove' => $icons[(
int) $rule->isRemoveOnUpdateEnabled()],
107 $query_params_namespace = [
'ldap',
'role',
'assignment'];
108 $table_uri = $this->data_factory->uri($this->http_request->getUri()->__toString());
110 [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
111 $query_params_namespace,
116 return $this->ui_factory->table()
119 $this->
lng->txt(
'ldap_tbl_role_ass'),
122 ->withActions($this->
getActions($url_builder, $action_parameter_token, $row_id_token))
123 ->withId(
'ldap_role_assignment_table')
124 ->withOrder(
new Order(
'type', Order::DESC))
125 ->withRequest($this->http_request);
130 $this->initRecords();
132 return count((array) $this->records);
147 $this->initRecords();
170 $actions[
'delete'] = $this->ui_factory->table()->action()->multi(
171 $this->
lng->txt(
'delete'),
172 $url_builder->
withParameter($action_parameter_token,
'confirmDeleteRules'),
176 $actions[
'edit'] = $this->ui_factory->table()->action()->single(
177 $this->
lng->txt(
'edit'),
178 $url_builder->
withParameter($action_parameter_token,
'editRoleAssignment'),
228 [$order_field, $order_direction] = $order->
join(
230 fn($ret, $key, $value) => [$key, $value]
232 usort($records,
static fn(array $left, array $right):
int =>
ilStr::strCmp(
233 $left[$order_field] ??
'',
234 $right[$order_field] ??
'' 237 if ($order_direction === Order::DESC) {
238 $records = array_reverse($records);
250 'type' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_rule_type')),
251 'role' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_ilias_role')),
252 'condition' => $this->ui_factory->table()->column()->text($this->
lng->txt(
'ldap_rule_condition')),
253 'add' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'ldap_add_roles'))
254 ->withIsSortable(
false),
255 'remove' => $this->ui_factory->table()->column()->statusIcon($this->
lng->txt(
'ldap_remove_roles'))
256 ->withIsSortable(
false),
limitRecords(array $records, Range $range)
join($init, callable $fn)
Interface Observer Contains several chained tasks and infos about them.
getRows(ILIAS\UI\Component\Table\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...
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
static _getRules($a_server_id)
Get all rules.
Both the subject and the direction need to be specified when expressing an order. ...
__construct(private readonly ServerRequestInterface $http_request, private readonly ilLanguage $lng, private readonly UIFactory $ui_factory, private readonly DataFactory $data_factory, private readonly int $server_id,)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static strCmp(string $a, string $b)
orderRecords(array $records, Order $order)
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
getRecords(Range $range, Order $order)
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
A simple class to express a naive range of whole positive numbers.