19 declare(strict_types=1);
46 private readonly
int $room_id,
47 private readonly array $banned_users,
53 $this->request = $http->
request();
54 $this->data_factory =
new Data\Factory();
62 return $this->ui_factory
64 ->data($this, $this->
lng->txt(
'ban_table_title'), $columns)
65 ->withId(self::class .
'_' . $this->room_id)
67 ->withActions($actions)
68 ->withRequest($this->request);
77 $date_format = $this->data_factory->dateFormat()->withTime12($this->actor->getDateFormat());
79 $date_format = $this->data_factory->dateFormat()->withTime24($this->actor->getDateFormat());
83 'login' => $this->ui_factory
84 ->table()->column()->text($this->
lng->txt(
'login'))
85 ->withIsSortable(
true),
86 'firstname' => $this->ui_factory
87 ->table()->column()->text($this->
lng->txt(
'firstname'))
88 ->withIsSortable(
true),
89 'lastname' => $this->ui_factory
90 ->table()->column()->text($this->
lng->txt(
'lastname'))
91 ->withIsSortable(
true),
92 'datetime' => $this->ui_factory
93 ->table()->column()->date($this->
lng->txt(
'chtr_ban_ts_tbl_head'), $date_format)
94 ->withIsSortable(
true),
95 'actor' => $this->ui_factory
96 ->table()->column()->text($this->
lng->txt(
'chtr_ban_actor_tbl_head'))
97 ->withIsSortable(
true),
106 $query_params_namespace = [
'chat',
'ban',
'table'];
108 $uri = $this->data_factory->uri(
109 ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTargetByClass(ilObjChatroomGUI::class,
'ban-handleTableActions')
112 $url_builder =
new UI\URLBuilder($uri);
115 $action_parameter_token_copy,
117 ] = $url_builder->acquireParameters(
118 $query_params_namespace,
124 'delete' => $this->ui_factory->table()->action()->multi(
125 $this->
lng->txt(
'unban'),
126 $url_builder->withParameter($action_parameter_token_copy,
'delete'),
134 if ($this->records ===
null) {
137 $entries = $this->banned_users;
139 foreach ($entries as $entry) {
140 $this->records[$i][
'user_id'] = $entry[
'user_id'];
141 $this->records[$i][
'login'] = $entry[
'login'];
142 $this->records[$i][
'firstname'] = $entry[
'firstname'];
143 $this->records[$i][
'lastname'] = $entry[
'lastname'];
144 $this->records[$i][
'timestamp'] = $entry[
'timestamp'];
145 $this->records[$i][
'datetime'] = (new \DateTimeImmutable(
'@' . $entry[
'timestamp']))->setTimezone(
149 $this->records[$i][
'actor'] = $entry[
'actor'];
157 array $visible_column_ids,
161 ?array $additional_parameters
165 foreach ($records as $record) {
166 $row_id = (string) $record[
'user_id'];
167 yield $row_builder->buildDataRow($row_id, $record);
173 ?array $additional_parameters
177 return \count($this->records);
185 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
187 if ($order_field ===
'datetime') {
188 $order_field =
'timestamp';
194 strtolower($order_direction),
195 $order_field ===
'timestamp' 217 return \array_slice($records, $range->getStart(), $range->getLength());
request()
Returns the current psr-7 server request.
Interface Observer Contains several chained tasks and infos about them.
getRecords(Data\Range $range, Data\Order $order)
Both the subject and the direction need to be specified when expressing an order. ...
readonly Data Factory $data_factory
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
__construct(private readonly \ilObjUser $actor, private readonly int $room_id, private readonly array $banned_users, private readonly ilCtrlInterface $ctrl, private readonly ilLanguage $lng, GlobalHttpState $http, private readonly \ILIAS\UI\Factory $ui_factory)
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
sortedRecords(Data\Order $order)
getRows(UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Data\Range $range, Data\Order $order, ?array $filter_data, ?array $additional_parameters)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
limitRecords(array $records, Data\Range $range)
readonly ServerRequestInterface $request
A simple class to express a naive range of whole positive numbers.