19declare(strict_types=1);
25use Psr\Http\Message\ServerRequestInterface;
37 private readonly ServerRequestInterface
$request;
47 private readonly
int $room_id,
48 private readonly array $banned_users,
54 $this->request =
$http->request();
55 $this->data_factory =
new Data\Factory();
63 return $this->ui_factory
65 ->data($this, $this->
lng->txt(
'ban_table_title'), $columns)
66 ->withId(str_replace(
'\\',
'', self::class) .
'_' . $this->room_id)
68 ->withRange(
new Range(0, 50))
69 ->withActions($actions)
70 ->withRequest($this->request);
79 $date_format = $this->data_factory->dateFormat()->withTime12($this->actor->getDateFormat());
81 $date_format = $this->data_factory->dateFormat()->withTime24($this->actor->getDateFormat());
85 'login' => $this->ui_factory
86 ->table()->column()->text($this->
lng->txt(
'login'))
87 ->withIsSortable(
true),
88 'firstname' => $this->ui_factory
89 ->table()->column()->text($this->
lng->txt(
'firstname'))
90 ->withIsSortable(
true),
91 'lastname' => $this->ui_factory
92 ->table()->column()->text($this->
lng->txt(
'lastname'))
93 ->withIsSortable(
true),
94 'datetime' => $this->ui_factory
95 ->table()->column()->date($this->
lng->txt(
'chtr_ban_ts_tbl_head'), $date_format)
96 ->withIsSortable(
true),
97 'actor' => $this->ui_factory
98 ->table()->column()->text($this->
lng->txt(
'chtr_ban_actor_tbl_head'))
99 ->withIsSortable(
true),
108 $query_params_namespace = [
'chat',
'ban',
'table'];
110 $uri = $this->data_factory->uri(
111 ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTargetByClass(ilObjChatroomGUI::class,
'ban-handleTableActions')
114 $url_builder =
new UI\URLBuilder($uri);
117 $action_parameter_token_copy,
119 ] = $url_builder->acquireParameters(
120 $query_params_namespace,
126 'delete' => $this->ui_factory->table()->action()->multi(
127 $this->
lng->txt(
'unban'),
128 $url_builder->withParameter($action_parameter_token_copy,
'delete'),
136 if ($this->records ===
null) {
139 $entries = $this->banned_users;
141 foreach ($entries as $entry) {
142 $this->records[$i][
'user_id'] = $entry[
'user_id'];
143 $this->records[$i][
'login'] = $entry[
'login'];
144 $this->records[$i][
'firstname'] = $entry[
'firstname'];
145 $this->records[$i][
'lastname'] = $entry[
'lastname'];
146 $this->records[$i][
'timestamp'] = $entry[
'timestamp'];
147 $this->records[$i][
'datetime'] = (new \DateTimeImmutable(
'@' . $entry[
'timestamp']))->setTimezone(
148 new \DateTimeZone($this->actor->getTimeZone())
151 $this->records[$i][
'actor'] = $entry[
'actor'];
159 array $visible_column_ids,
162 mixed $additional_viewcontrol_data,
164 mixed $additional_parameters
169 $row_id = (string) $record[
'user_id'];
170 yield $row_builder->buildDataRow($row_id, $record);
175 mixed $additional_viewcontrol_data,
177 mixed $additional_parameters
179 $this->initRecords();
181 return \count($this->records);
189 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
191 if ($order_field ===
'datetime') {
192 $order_field =
'timestamp';
198 strtolower($order_direction),
199 $order_field ===
'timestamp'
208 $this->initRecords();
210 $records = $this->sortedRecords($order);
212 return $this->limitRecords($records,
$range);
getRows(UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, Data\Range $range, Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
readonly Data Factory $data_factory
limitRecords(array $records, Data\Range $range)
getRecords(Data\Range $range, Data\Order $order)
__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)
readonly ServerRequestInterface $request
sortedRecords(Data\Order $order)
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 recor...
Builds a Color from either hex- or rgb values.
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
Class for date presentation.
@classDescription Date and time handling
@ilCtrl_Calls ilObjChatroomGUI: ilMDEditorGUI, ilInfoScreenGUI, ilPermissionGUI, ilObjectCopyGUI @ilC...
Interface GlobalHttpState.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.