19declare(strict_types=1);
53 public const ID =
'bksp';
65 private readonly UIFactory $ui_factory,
76 private readonly
int $pool_id,
92 $table = $this->ui_factory->table()->data($this, $this->
lng->txt(
'participants'), $this->getColumns())
94 ->withRequest($this->
http->getRequest())
96 ->withFilter($this->ui_service->filter()->getData($filter));
98 return [$filter, $table];
102 mixed $additional_viewcontrol_data,
104 mixed $additional_parameters
111 array $visible_column_ids,
114 mixed $additional_viewcontrol_data,
116 mixed $additional_parameters
118 $records = $this->limitRecords(
$range, $this->sortRecords($order, $this->loadRecords($filter_data)));
120 foreach ($records as $record) {
123 (
string) $record[
'user_id'],
125 'name' => $record[
'name'] ??
'',
126 'bookable_item' => $this->ui_renderer->render(
127 $this->ui_factory->listing()->unordered($record[
'object_title'] ?? [])
141 $column_factory = $this->ui_factory->table()->column();
143 'name' => $column_factory->text($this->
lng->txt(
'name'))->withIsSortable(
true),
144 'bookable_item' => $column_factory->text($this->
lng->txt(
'book_bobj'))->withIsSortable(
false),
152 if (isset($filter_data[
'bookable_item_id']) && $filter_data[
'bookable_item_id'] !==
'') {
153 $filter[
'object'] = (
int) $filter_data[
'bookable_item_id'];
156 if (isset($filter_data[
'bookable_item_title']) && $filter_data[
'bookable_item_title'] !==
'') {
157 $filter[
'title'] = (string) $filter_data[
'bookable_item_title'];
160 if (isset($filter_data[
'participant_id']) && $filter_data[
'participant_id'] !==
'') {
161 $filter[
'user_id'] = (
int) $filter_data[
'participant_id'];
164 $filter_object = isset($filter[
'object']) ? (
int) $filter[
'object'] :
null;
165 if ($filter_object === -1) {
168 static fn(array $item):
bool => ($item[
'obj_count'] ?? 0) === 0
177 $order_data = $order->
get();
178 if ($order_data === []) {
182 foreach ($order_data as $key => $value) {
183 $order_direction = $value === Order::DESC ? -1 : 1;
184 $callable = match ($key) {
185 'name' =>
static fn(array
$a, array
$b):
int => strcmp(
$a[
'name'],
$b[
'name']) * $order_direction,
186 'bookable_item' =>
static fn(array
$a, array
$b):
int => strcmp(
$a[
'bookable_item'],
$b[
'bookable_item']) * $order_direction,
190 if ($callable ===
null) {
194 usort($records, $callable);
207 $bookable_items = [];
209 $bookable_items[$item[
'booking_object_id']] = $item[
'title'];
212 $field_factory = $this->ui_factory->input()->field();
214 'bookable_item_id' => $field_factory->select(
215 $this->
lng->txt(
'book_bobj'),
216 array_replace([
'-1' => $this->
lng->txt(
'book_no_objects')], $bookable_items)
218 'bookable_item_title' => $field_factory->text(
219 "{$this->lng->txt('book_bobj')} {$this->lng->txt('title')}/{$this->lng->txt('description')}"
221 'participant_id' => $field_factory->select(
222 $this->
lng->txt(
'book_participant'),
227 return $this->ui_service->filter()->standard(
228 "participant_filter_{$this->pool_id}",
231 array_fill(0, count($filter_inputs),
true),
244 self::ROW_ID_PARAMETER,
245 self::ACTION_PARAMETER,
246 self::ACTION_TYPE_PARAMETER
261 $this->participant_repository,
264 ))->getTableActions();
sortRecords(Order $order, array $records)
getComponents(URLBuilder $url_builder)
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...
const ACTION_TYPE_PARAMETER
limitRecords(Range $range, array $records)
loadRecords(?array $filter_data)
getFilterComponent(string $action)
__construct(private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly ilLanguage $lng, private readonly HttpService $http, private readonly ilUIService $ui_service, private readonly ilCtrlInterface $ctrl, private readonly ilGlobalTemplateInterface $tpl, private readonly Refinery $refinery, private readonly AccessManager $access, private readonly ParticipantRepository $participant_repository, private readonly int $ref_id, private readonly int $pool_id,)
@phpstan-type ParticipantRecord array{user_id: int, name: string, object_title: array<string>,...
acquireParameters(URLBuilder $url_builder)
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....
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.
acquireParameters(array $namespace, string ... $names)
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getList(int $a_booking_pool, ?array $a_filter=null, ?int $a_object_id=null)
static getUserFilter(int $a_pool_id)
Get user data from db for an specific pool id.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A component is the most general form of an entity in the UI.
A Column describes the form of presentation for a certain aspect of data, i.e.
buildDataRow(string $id, array $record)
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait TableActionExecutorTrait
readonly HttpService $http
readonly UIRenderer $ui_renderer
static http()
Fetches the global http state from ILIAS.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples