19declare(strict_types=1);
50 public const ID =
'bksd';
62 private readonly UIFactory $ui_factory,
83 $this->ui_factory->table()->data($this, $this->
lng->txt(
'book_schedules'), $this->getColumns())
85 ->withRequest($this->
http->getRequest())
91 mixed $additional_viewcontrol_data,
93 mixed $additional_parameters
100 array $visible_column_ids,
103 mixed $additional_viewcontrol_data,
105 mixed $additional_parameters
107 $records = $this->limitRecords(
$range, $this->sortRecords($order, $this->loadRecords($filter_data)));
109 foreach ($records as $record) {
112 (
string) $record[
'booking_schedule_id'],
114 'title' => $record[
'title'] ??
'',
115 'is_used' => (
bool) ($record[
'is_used'] ??
false),
125 return $this->schedule_manager->getScheduleData();
130 $order_data = $order->
get();
131 if ($order_data === []) {
135 foreach ($order_data as $key => $value) {
136 $order_direction = $value === Order::DESC ? -1 : 1;
137 $callable = match ($key) {
138 'title' =>
static fn(array
$a, array
$b):
int => strcmp(
$a[
'title'],
$b[
'title']) * $order_direction,
139 'is_used' =>
static fn(array
$a, array
$b):
int => ((
$a[
'is_used'] ??
false) <=> (
$b[
'is_used'] ??
false)) * -$order_direction,
143 if ($callable ===
null) {
147 usort($records, $callable);
163 $column_factory = $this->ui_factory->table()->column();
164 $icon_factory = $this->ui_factory->symbol()->icon();
166 'title' => $column_factory->text($this->
lng->txt(
'title'))->withIsSortable(
true),
167 'is_used' => $column_factory->boolean(
168 $this->
lng->txt(
'book_is_used'),
169 $icon_factory->custom(
171 $this->lng->txt(
'yes')
173 $icon_factory->custom(
175 $this->lng->txt(
'no')
177 )->withIsSortable(
true),
188 self::ROW_ID_PARAMETER,
189 self::ACTION_PARAMETER,
190 self::ACTION_TYPE_PARAMETER
205 $this->schedule_manager,
207 ))->getTableActions();
const ACTION_TYPE_PARAMETER
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...
acquireParameters(URLBuilder $url_builder)
loadRecords(mixed $filter_data)
getComponents(URLBuilder $url_builder)
sortRecords(Order $order, array $records)
__construct(private readonly ilCtrlInterface $ctrl, private readonly ilLanguage $lng, private readonly ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly Refinery $refinery, private readonly AccessManager $access, private readonly HttpService $http, private readonly ScheduleManager $schedule_manager, private readonly int $ref_id,)
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....
limitRecords(Range $range, array $records)
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)
Util class various functions, usage as namespace.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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