ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LDAPRoleAssignmentTable Class Reference
+ Inheritance diagram for LDAPRoleAssignmentTable:
+ Collaboration diagram for LDAPRoleAssignmentTable:

Public Member Functions

 __construct (private readonly ServerRequestInterface $http_request, private readonly ilLanguage $lng, private readonly UIFactory $ui_factory, private readonly \ILIAS\Data\URI $action_url, private readonly int $server_id)
 
 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.g. More...
 
 getComponent ()
 
 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...
 
 getActions (URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
 
 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 (Range $range, Order $order)
 
 limitRecords (array $records, Range $range)
 
 orderRecords (array $records, Order $order)
 
 getColumns ()
 

Private Attributes

array $records = null
 

Detailed Description

Definition at line 33 of file LDAPRoleAssignmentTable.php.

Constructor & Destructor Documentation

◆ __construct()

LDAPRoleAssignmentTable::__construct ( private readonly ServerRequestInterface  $http_request,
private readonly ilLanguage  $lng,
private readonly UIFactory  $ui_factory,
private readonly \ILIAS\Data\URI  $action_url,
private readonly int  $server_id 
)

Definition at line 45 of file LDAPRoleAssignmentTable.php.

51 {
52 }

Member Function Documentation

◆ getActions()

LDAPRoleAssignmentTable::getActions ( URLBuilder  $url_builder,
URLBuilderToken  $action_parameter_token,
URLBuilderToken  $row_id_token 
)
Returns
array<string, Action[]>

Definition at line 162 of file LDAPRoleAssignmentTable.php.

166 : array {
167 $actions = [];
168 $actions['delete'] = $this->ui_factory->table()->action()->multi(
169 $this->lng->txt('delete'),
170 $url_builder->withParameter($action_parameter_token, 'confirmDeleteRules'),
171 $row_id_token
172 );
173
174 $actions['edit'] = $this->ui_factory->table()->action()->single(
175 $this->lng->txt('edit'),
176 $url_builder->withParameter($action_parameter_token, 'editRoleAssignment'),
177 $row_id_token
178 );
179
180 return $actions;
181 }
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166

◆ getColumns()

LDAPRoleAssignmentTable::getColumns ( )
private
Returns
array<string, Column>

Definition at line 245 of file LDAPRoleAssignmentTable.php.

245 : array
246 {
247 return [
248 'type' => $this->ui_factory->table()->column()->text($this->lng->txt('ldap_rule_type')),
249 'role' => $this->ui_factory->table()->column()->text($this->lng->txt('ldap_ilias_role')),
250 'condition' => $this->ui_factory->table()->column()->text($this->lng->txt('ldap_rule_condition')),
251 'add' => $this->ui_factory->table()->column()->statusIcon($this->lng->txt('ldap_add_roles'))
252 ->withIsSortable(false),
253 'remove' => $this->ui_factory->table()->column()->statusIcon($this->lng->txt('ldap_remove_roles'))
254 ->withIsSortable(false),
255 ];
256 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

LDAPRoleAssignmentTable::getComponent ( )

Definition at line 104 of file LDAPRoleAssignmentTable.php.

104 : DataTable
105 {
106 $query_params_namespace = ['ldap', 'role', 'assignment'];
107 $url_builder = new URLBuilder($this->action_url);
108 [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
109 $query_params_namespace,
110 'table_action',
111 'rule_ids'
112 );
113
114 return $this->ui_factory->table()
115 ->data(
116 $this,
117 $this->lng->txt('ldap_tbl_role_ass'),
118 $this->getColumns()
119 )
120 ->withActions($this->getActions($url_builder, $action_parameter_token, $row_id_token))
121 ->withId('ldap_role_assignment_table')
122 ->withOrder(new Order('type', Order::DESC))
123 ->withRequest($this->http_request);
124 }
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getRecords()

LDAPRoleAssignmentTable::getRecords ( Range  $range,
Order  $order 
)
private
Returns
list<array{ 'id': int, 'type': string, 'condition': string, 'add': Icon, 'remove': Icon, 'role': string, }>

Definition at line 143 of file LDAPRoleAssignmentTable.php.

143 : array
144 {
145 $this->initRecords();
147
148 if ($order) {
149 $records = $this->orderRecords($records, $order);
150 }
151
152 if ($range) {
153 $records = $this->limitRecords($records, $range);
154 }
155
156 return $records;
157 }
orderRecords(array $records, Order $order)
limitRecords(array $records, Range $range)

References ILIAS\UI\Implementation\Component\Table\$range.

◆ getRows()

LDAPRoleAssignmentTable::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.g.

yield $row_builder->buildStandardRow($row_id, $record).

Parameters
string[]$visible_column_ids

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 54 of file LDAPRoleAssignmentTable.php.

61 : Generator {
62 $records = $this->getRecords($range, $order);
63 foreach ($records as $record) {
64 yield $row_builder->buildDataRow((string) $record['id'], $record);
65 }
66 }
getRecords(Range $range, Order $order)

◆ getTotalRowCount()

LDAPRoleAssignmentTable::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 126 of file LDAPRoleAssignmentTable.php.

126 : ?int
127 {
128 $this->initRecords();
129
130 return count((array) $this->records);
131 }

◆ limitRecords()

LDAPRoleAssignmentTable::limitRecords ( array  $records,
Range  $range 
)
private
Parameters
list<array{'id': int, 'type': string, 'condition': string, 'add': Icon, 'remove': Icon, 'role': string, }> $records
Returns
list<array{ 'id': int, 'type': string, 'condition': string, 'add': Icon, 'remove': Icon, 'role': string, }>

Definition at line 201 of file LDAPRoleAssignmentTable.php.

201 : array
202 {
203 return array_slice($records, $range->getStart(), $range->getLength());
204 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

+ Here is the call graph for this function:

◆ orderRecords()

LDAPRoleAssignmentTable::orderRecords ( array  $records,
Order  $order 
)
private
Parameters
list<array{'id': int, 'type': string, 'condition': string, 'add': Icon, 'remove': Icon, 'role': string, }> $records
Returns
list<array{ 'id': int, 'type': string, 'condition': string, 'add': Icon, 'remove': Icon, 'role': string, }>

Definition at line 224 of file LDAPRoleAssignmentTable.php.

224 : array
225 {
226 [$order_field, $order_direction] = $order->join(
227 [],
228 fn($ret, $key, $value) => [$key, $value]
229 );
230 usort($records, static fn(array $left, array $right): int => ilStr::strCmp(
231 $left[$order_field] ?? '',
232 $right[$order_field] ?? ''
233 ));
234
235 if ($order_direction === Order::DESC) {
236 $records = array_reverse($records);
237 }
238
239 return $records;
240 }
join($init, callable $fn)
Definition: Order.php:75
static strCmp(string $a, string $b)
Definition: class.ilStr.php:87

References ILIAS\Data\Order\join(), and ilStr\strCmp().

+ Here is the call graph for this function:

Field Documentation

◆ $records

array LDAPRoleAssignmentTable::$records = null
private

Definition at line 43 of file LDAPRoleAssignmentTable.php.


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