19declare(strict_types=1);
25use Psr\Http\Message\ServerRequestInterface;
46 private readonly
string $action_url
48 $this->request =
$http->request();
49 $this->data_factory =
new Data\Factory();
57 return $this->ui_factory
59 ->data($this, $this->
lng->txt(
'frm_moderators'), $columns)
60 ->withId(self::class .
'_' . $this->forum_moderators->getRefId())
62 ->withActions($actions)
63 ->withRequest($this->request);
72 'login' => $this->ui_factory
75 ->text($this->
lng->txt(
'login'))
76 ->withIsSortable(
true),
77 'firstname' => $this->ui_factory
80 ->text($this->
lng->txt(
'firstname'))
81 ->withIsSortable(
true),
83 'lastname' => $this->ui_factory
86 ->text($this->
lng->txt(
'lastname'))
87 ->withIsSortable(
true),
96 $query_params_namespace = [
'frm',
'moderators',
'table'];
98 $uri_detach = $this->data_factory->uri($this->action_url);
100 $url_builder_detach =
new UI\URLBuilder($uri_detach);
103 $action_parameter_token_copy,
105 ] = $url_builder_detach->acquireParameters(
106 $query_params_namespace,
112 'detachModeratorRole' => $this->ui_factory->table()->action()->single(
113 $this->
lng->txt(
'remove'),
114 $url_builder_detach->withParameter($action_parameter_token_copy,
'detachModeratorRole'),
120 private function initRecords(): void
122 if ($this->records ===
null) {
125 $entries = $this->forum_moderators->getCurrentModerators();
126 foreach ($entries as $usr_id) {
130 $this->forum_moderators->detachModeratorRole($usr_id);
134 $this->records[$i][
'usr_id'] = $user->getId();
135 $this->records[$i][
'login'] = $user->getLogin();
136 $this->records[$i][
'firstname'] = $user->getFirstname();
137 $this->records[$i][
'lastname'] = $user->getLastname();
145 array $visible_column_ids,
149 ?array $additional_parameters
154 $row_id = (string) $record[
'usr_id'];
155 yield $row_builder->buildDataRow($row_id, $record);
161 ?array $additional_parameters
163 $this->initRecords();
165 return \count($this->records);
173 $records = $this->records;
174 [$order_field, $order_direction] = $order->join([], fn($ret, $key, $value) => [$key, $value]);
184 $this->initRecords();
186 $records = $this->sortedRecords($order);
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.
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...
ServerRequestInterface $request
Data Factory $data_factory
getRecords(Data\Range $range, 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)
sortedRecords(Data\Order $order)
__construct(private readonly ilForumModerators $forum_moderators, private readonly ilLanguage $lng, \ILIAS\HTTP\Services $http, private readonly \ILIAS\UI\Factory $ui_factory, private readonly string $action_url)
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 ilObjectFactory This class offers methods to get instances of the type-specific object classes ...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
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.