ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 DataFactory $data_factory, 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)
 

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 34 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 DataFactory  $data_factory,
private readonly int  $server_id 
)

Definition at line 46 of file LDAPRoleAssignmentTable.php.

52  {
53  }

Member Function Documentation

◆ getActions()

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

Definition at line 164 of file LDAPRoleAssignmentTable.php.

References ILIAS\Repository\lng(), and ILIAS\UI\URLBuilder\withParameter().

Referenced by getComponent().

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

◆ getColumns()

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

Definition at line 247 of file LDAPRoleAssignmentTable.php.

References ILIAS\Repository\lng().

Referenced by getComponent().

247  : array
248  {
249  return [
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),
257  ];
258  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

LDAPRoleAssignmentTable::getComponent ( )

Definition at line 105 of file LDAPRoleAssignmentTable.php.

References getActions(), getColumns(), and ILIAS\Repository\lng().

Referenced by ilLDAPSettingsGUI\getRoleAssignmentTable().

105  : DataTable
106  {
107  $query_params_namespace = ['ldap', 'role', 'assignment'];
108  $table_uri = $this->data_factory->uri($this->http_request->getUri()->__toString());
109  $url_builder = new URLBuilder($table_uri);
110  [$url_builder, $action_parameter_token, $row_id_token] = $url_builder->acquireParameters(
111  $query_params_namespace,
112  'table_action',
113  'rule_ids'
114  );
115 
116  return $this->ui_factory->table()
117  ->data(
118  $this,
119  $this->lng->txt('ldap_tbl_role_ass'),
120  $this->getColumns()
121  )
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);
126  }
getActions(URLBuilder $url_builder, URLBuilderToken $action_parameter_token, URLBuilderToken $row_id_token)
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
URLBuilder.
Definition: URLBuilder.php:40
+ Here is the call graph for this function:
+ Here is the caller 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 145 of file LDAPRoleAssignmentTable.php.

References $records, limitRecords(), and orderRecords().

Referenced by getRows().

145  : array
146  {
147  $this->initRecords();
149 
150  if ($order) {
151  $records = $this->orderRecords($records, $order);
152  }
153 
154  if ($range) {
155  $records = $this->limitRecords($records, $range);
156  }
157 
158  return $records;
159  }
limitRecords(array $records, Range $range)
orderRecords(array $records, Order $order)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

References ilLDAPRoleAssignmentRule\_getRules(), ilObject\_lookupTitle(), getRecords(), ILIAS\Repository\int(), ILIAS\Repository\lng(), null, ilLDAPRoleAssignmentRule\TYPE_ATTRIBUTE, ilLDAPRoleAssignmentRule\TYPE_GROUP, and ilLDAPRoleAssignmentRule\TYPE_PLUGIN.

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)
+ Here is the call graph for this function:

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

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

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

References ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

Referenced by getRecords().

203  : array
204  {
205  return array_slice($records, $range->getStart(), $range->getLength());
206  }
+ Here is the call graph for this function:
+ Here is the caller 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 226 of file LDAPRoleAssignmentTable.php.

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

Referenced by getRecords().

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

Field Documentation

◆ $records

array LDAPRoleAssignmentTable::$records = null
private

Definition at line 44 of file LDAPRoleAssignmentTable.php.

Referenced by getRecords(), and orderRecords().


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