ILIAS  trunk Revision v12.0_alpha-1613-gae4c99ebb18
BookingsWithoutScheduleTable.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use Generator;
28
30{
31 public const string ID = 'bkbwos';
32
33 public function getRows(
34 DataRowBuilder $row_builder,
35 array $visible_column_ids,
37 Order $order,
38 mixed $additional_viewcontrol_data,
39 mixed $filter_data,
40 mixed $additional_parameters
41 ): Generator {
42 $bookings = $this->limitRecords($range, $this->sortRecords($order, $this->loadRecords($filter_data)));
43
44 foreach ($bookings as $record) {
45 $user_id = $record['user_id'];
46
47 yield $this->getTableActions()->onDataRow(
48 $row_builder->buildDataRow(
49 (string) $record['booking_reservation_id'],
50 [
51 'title' => (string) $record['title'],
52 'status' => $record['status'] === ilBookingReservation::STATUS_CANCELLED
53 ? $this->lng->txt('book_reservation_status_5')
54 : '',
55 'user' => $this->getUserComponent($user_id)
56 ]
57 ),
58 $record
59 );
60 }
61 }
62
63 protected function getColumns(): array
64 {
65 return [
66 'title' => $this->column_factory->text($this->lng->txt('title')),
67 'status' => $this->column_factory->text($this->lng->txt('status')),
68 'user' => $this->column_factory->link($this->lng->txt('user')),
69 ];
70 }
71
72 protected function getFilterInputs(): array
73 {
74 $txt_user = $this->lng->txt('user');
75 if (
76 $this->access->canManageAllReservations($this->booking_pool->getRefId())
77 || $this->access->canReadPublicLog($this->booking_pool->getRefId())
78 ) {
79 $user_input = $this->input_factory->select($txt_user, $this->getUsers());
80 } else {
81 $user_input = $this->input_factory
82 ->select($txt_user, $this->getUsers($this->user->getId()))
83 ->withValue($this->user->getId())
84 ->withDisabled(true);
85 }
86
87 return [
88 'object' => $this->input_factory->select(
89 $this->lng->txt('object'),
90 array_column($this->booking_items, 'title', 'booking_object_id')
91 ),
92 'object_title_or_description' => $this->input_factory->text($this->lng->txt('book_object_title_or_description')),
93 'status' => $this->input_factory->select($this->lng->txt('status'), $this->getStatuses()),
94 'user' => $user_input
95 ];
96 }
97}
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....
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildDataRow(string $id, array $record)