ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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, 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...
 
 getComponent ()
 
 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...
 
 getActions (URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
 
 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 (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 166 of file LDAPRoleAssignmentTable.php.

170 : array {
171 $actions = [];
172 $actions['delete'] = $this->ui_factory->table()->action()->multi(
173 $this->lng->txt('delete'),
174 $url_builder->withParameter($action_parameter_token, 'confirmDeleteRules'),
175 $row_id_token
176 );
177
178 $actions['edit'] = $this->ui_factory->table()->action()->single(
179 $this->lng->txt('edit'),
180 $url_builder->withParameter($action_parameter_token, 'editRoleAssignment'),
181 $row_id_token
182 );
183
184 return $actions;
185 }
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 249 of file LDAPRoleAssignmentTable.php.

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

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

LDAPRoleAssignmentTable::getComponent ( )

Definition at line 105 of file LDAPRoleAssignmentTable.php.

105 : DataTable
106 {
107 $query_params_namespace = ['ldap', 'role', 'assignment'];
108 $url_builder = new URLBuilder($this->action_url);
109 [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
110 $query_params_namespace,
111 'table_action',
112 'rule_ids'
113 );
114
115 return $this->ui_factory->table()
116 ->data(
117 $this,
118 $this->lng->txt('ldap_tbl_role_ass'),
119 $this->getColumns()
120 )
121 ->withActions($this->getActions($url_builder, $action_parameter_token, $row_id_token))
122 ->withId('ldap_role_assignment_table')
123 ->withOrder(new Order('type', Order::DESC))
124 ->withRequest($this->http_request);
125 }
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 147 of file LDAPRoleAssignmentTable.php.

147 : array
148 {
149 $this->initRecords();
151
152 if ($order) {
153 $records = $this->orderRecords($records, $order);
154 }
155
156 if ($range) {
157 $records = $this->limitRecords($records, $range);
158 }
159
160 return $records;
161 }
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,
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.

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.

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

◆ getTotalRowCount()

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

131 : ?int {
132 $this->initRecords();
133
134 return count((array) $this->records);
135 }

◆ 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 205 of file LDAPRoleAssignmentTable.php.

205 : array
206 {
207 return array_slice($records, $range->getStart(), $range->getLength());
208 }

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

228 : array
229 {
230 [$order_field, $order_direction] = $order->join(
231 [],
232 fn($ret, $key, $value) => [$key, $value]
233 );
234 usort($records, static fn(array $left, array $right): int => ilStr::strCmp(
235 $left[$order_field] ?? '',
236 $right[$order_field] ?? ''
237 ));
238
239 if ($order_direction === Order::DESC) {
240 $records = array_reverse($records);
241 }
242
243 return $records;
244 }
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: