ILIAS  trunk Revision v12.0_alpha-1613-gae4c99ebb18
ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable Class Reference
+ Inheritance diagram for ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable:
+ Collaboration diagram for ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable:

Public Member Functions

 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.g. More...
 
- Public Member Functions inherited from ILIAS\BookingManager\Bookings\Table\BookingsTable
 __construct (protected readonly UIFactory $ui_factory, protected readonly UIRenderer $ui_renderer, protected readonly AccessManager $access, protected readonly ilGlobalTemplateInterface $tpl, protected readonly Refinery $refinery, protected readonly Language $lng, protected readonly HttpService $http, protected readonly ilObjUser $user, protected readonly ReservationDBRepository $reservation_repository, protected readonly ilCtrlInterface $ctrl, protected readonly ilUIService $ui_service, protected readonly Settings $settings, protected readonly ilObjBookingPool $booking_pool)
 
 getTableId ()
 
 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.g. More...
 
 getFilter ()
 
 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 records available. More...
 
 getComponents (URLBuilder $url_builder)
 
- Public Member Functions inherited from ILIAS\BookingManager\Common\Table\Table
 getTableId ()
 
 execute (URLBuilder $url_builder)
 
 getComponents (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.g. More...
 
 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 records available. More...
 

Data Fields

const string ID = 'bkbws'
 
- Data Fields inherited from ILIAS\BookingManager\Bookings\Table\BookingsTable
const ROW_ID_PARAMETER = 'booking_id'
 
const ACTION_PARAMETER = 'action'
 
const ACTION_TYPE_PARAMETER = 'action_type'
 

Protected Member Functions

 getColumns ()
 
 getFilterInputs ()
 
 getTimeSlots ()
 
 getBookingTimeSlotFilterLabel (array $booking)
 
- Protected Member Functions inherited from ILIAS\BookingManager\Bookings\Table\BookingsTable
 getUserPresentationName (int $user_id)
 
 getColumns ()
 
 getFilterInputs ()
 
 loadRecords (mixed $filter_data)
 
 sortRecords (Order $order, array $records)
 
 limitRecords (Range $range, array $records)
 
 acquireParameters (URLBuilder $url_builder)
 
 getUsers (?int $user_id=null)
 
 getStatuses ()
 
 getTableActions ()
 
 getUserComponent (int $user_id)
 
 getBookingTimeSlotFilterLabel (array $booking)
 

Private Member Functions

 isAllDayBooking (array $booking)
 
 getSchedule (int $schedule_id)
 

Private Attributes

array $schedule_cache = []
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\BookingManager\Bookings\Table\BookingsTable
readonly array $booking_items
 
readonly array $bookings
 
readonly array $participants
 
readonly ColumnFactory $column_factory
 
readonly InputFactory $input_factory
 

Detailed Description

Definition at line 34 of file BookingsWithScheduleTable.php.

Member Function Documentation

◆ getBookingTimeSlotFilterLabel()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::getBookingTimeSlotFilterLabel ( array  $booking)
protected

Reimplemented from ILIAS\BookingManager\Bookings\Table\BookingsTable.

Definition at line 172 of file BookingsWithScheduleTable.php.

172 : string
173 {
174 return $this->isAllDayBooking($booking)
175 ? $this->lng->txt('book_all_day')
176 : parent::getBookingTimeSlotFilterLabel($booking);
177 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getColumns()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::getColumns ( )
protected

Reimplemented from ILIAS\BookingManager\Bookings\Table\BookingsTable.

Definition at line 90 of file BookingsWithScheduleTable.php.

90 : array
91 {
92 $columns = [
93 'title' => $this->column_factory->text($this->lng->txt('title')),
94 'status' => $this->column_factory->text($this->lng->txt('status')),
95 'date' => $this->column_factory->date(
96 $this->lng->txt('date'),
97 new DateFormat([
104 ])
105 ),
106 'week' => $this->column_factory->date($this->lng->txt('week'), new DateFormat([DateFormat::WEEK]))
107 ->withIsOptional(true, true),
108 'weekday' => $this->column_factory->date($this->lng->txt('cal_weekday'), new DateFormat([DateFormat::WEEKDAY_SHORT]))
109 ->withIsOptional(true, true),
110 'time_slot' => $this->column_factory->text($this->lng->txt('book_schedule_slot')),
111 'unit_count' => $this->column_factory->number($this->lng->txt('book_no_of_objects')),
112 'message' => $this->column_factory->text($this->lng->txt('book_message'))->withIsSortable(false),
113 'user' => $this->column_factory->link($this->lng->txt('user'))
114 ];
115
116 if (!$this->booking_pool->usesMessages()) {
117 unset($columns['message']);
118 }
119
120 return $columns;
121 }

References ILIAS\Data\DateFormat\DateFormat\DAY, ILIAS\Data\DateFormat\DateFormat\DOT, ILIAS\Repository\lng(), ILIAS\Data\DateFormat\DateFormat\MONTH_SPELLED_SHORT, ILIAS\Data\DateFormat\DateFormat\SPACE, ILIAS\Data\DateFormat\DateFormat\WEEK, ILIAS\Data\DateFormat\DateFormat\WEEKDAY_SHORT, and ILIAS\Data\DateFormat\DateFormat\YEAR.

+ Here is the call graph for this function:

◆ getFilterInputs()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::getFilterInputs ( )
protected

Reimplemented from ILIAS\BookingManager\Bookings\Table\BookingsTable.

Definition at line 123 of file BookingsWithScheduleTable.php.

123 : array
124 {
125 $txt_user = $this->lng->txt('user');
126 if (
127 $this->access->canManageAllReservations($this->booking_pool->getRefId())
128 || $this->access->canReadPublicLog($this->booking_pool->getRefId())
129 ) {
130 $user_input = $this->input_factory->select($txt_user, $this->getUsers());
131 } else {
132 $user_input = $this->input_factory
133 ->select($txt_user, $this->getUsers($this->user->getId()))
134 ->withValue($this->user->getId())
135 ->withDisabled(true);
136 }
137
138 return [
139 'object' => $this->input_factory->select(
140 $this->lng->txt('object'),
141 array_column($this->booking_items, 'title', 'booking_object_id')
142 ),
143 'object_title_or_description' => $this->input_factory->text($this->lng->txt('book_object_title_or_description')),
144 'period' => $this->input_factory->duration($this->lng->txt('book_filter_period'))
145 ->withUseTime(true)
146 ->withFormat($this->user->getDateTimeFormat()),
147 'time_slot' => $this->input_factory->select($this->lng->txt('book_schedule_slot'), $this->getTimeSlots()),
148 'past_bookings' => $this->input_factory->select(
149 $this->lng->txt('book_show_past_bookings'),
150 [1 => $this->lng->txt('book_past_bookings'), 2 => $this->lng->txt('book_present_bookings')]
151 ),
152 'status' => $this->input_factory->select($this->lng->txt('status'), $this->getStatuses()),
153 'user' => $user_input
154 ];
155 }

References ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::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.g.

yield $row_builder->buildStandardRow($row_id, $record).

Parameters
string[]$visible_column_ids

Reimplemented from ILIAS\BookingManager\Bookings\Table\BookingsTable.

Definition at line 43 of file BookingsWithScheduleTable.php.

51 : Generator {
52 $records = $this->limitRecords($range, $this->sortRecords($order, $this->loadRecords($filter_data)));
53
54 foreach ($records as $record) {
55 $user_id = $record['user_id'];
56
57 $record['date_to']++;
58
59 $date_from = new DateTimeImmutable("@{$record['date_from']}");
60 $time_slot = $this->isAllDayBooking($record)
61 ? $this->lng->txt('book_all_day')
63 new ilDateTime($record['date_from'], IL_CAL_UNIX),
64 new ilDateTime($record['date_to'], IL_CAL_UNIX),
65 true
66 );
67
68 yield $this->getTableActions()->onDataRow(
69 $row_builder->buildDataRow(
70 (string) $record['booking_reservation_id'],
71 [
72 'title' => (string) $record['title'],
73 'status' => $record['status'] === ilBookingReservation::STATUS_CANCELLED
74 ? $this->lng->txt('book_reservation_status_5')
75 : '',
76 'date' => $date_from,
77 'week' => $date_from,
78 'weekday' => $date_from,
79 'time_slot' => $time_slot,
80 'unit_count' => 1,
81 'message' => (string) ($record['message'] ?? ''),
82 'user' => $this->getUserComponent($user_id)
83 ]
84 ),
85 $record
86 );
87 }
88 }
const IL_CAL_UNIX
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
buildDataRow(string $id, array $record)

References $user_id, ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow(), ilDatePresentation\formatPeriod(), ILIAS\BookingManager\Bookings\Table\BookingsTable\getTableActions(), IL_CAL_UNIX, ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable\isAllDayBooking(), ILIAS\Repository\lng(), and ilBookingReservation\STATUS_CANCELLED.

+ Here is the call graph for this function:

◆ getSchedule()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::getSchedule ( int  $schedule_id)
private

Definition at line 189 of file BookingsWithScheduleTable.php.

190 {
191 return $this->schedule_cache[$schedule_id] ??= new ilBookingSchedule($schedule_id);
192 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getTimeSlots()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::getTimeSlots ( )
protected
Returns
string[]

Definition at line 160 of file BookingsWithScheduleTable.php.

160 : array
161 {
162 $time_slots = [];
163
164 foreach ($this->bookings as $booking) {
165 $time_slot = $this->getBookingTimeSlotFilterLabel($booking);
166 $time_slots[$time_slot] ??= $time_slot;
167 }
168
169 return $time_slots;
170 }

◆ isAllDayBooking()

ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::isAllDayBooking ( array  $booking)
private

Definition at line 179 of file BookingsWithScheduleTable.php.

179 : bool
180 {
181 $object_id = (int) $booking['object_id'];
182 $schedule_id = (int) ($this->booking_items[$object_id]['schedule_id'] ?? 0);
183
184 return
185 $schedule_id !== 0
186 && $this->getSchedule($schedule_id)->getScheduleType() === ilBookingSchedule::SCHEDULE_TYPE_ALL_DAY;
187 }

References ILIAS\Repository\int(), and ilBookingSchedule\SCHEDULE_TYPE_ALL_DAY.

Referenced by ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable\getRows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $schedule_cache

array ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::$schedule_cache = []
private

Definition at line 41 of file BookingsWithScheduleTable.php.

◆ ID

const string ILIAS\BookingManager\Bookings\Table\BookingsWithScheduleTable::ID = 'bkbws'

Definition at line 36 of file BookingsWithScheduleTable.php.


The documentation for this class was generated from the following file: