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

Data Fields

const string ID = 'bkbiwos'
 
- Data Fields inherited from ILIAS\BookingManager\BookableItem\Table\BookableItemTable
const string ROW_ID_PARAMETER = 'bookable_item_row'
 
const string ACTION_PARAMETER = 'action'
 
const string ACTION_TYPE_PARAMETER = 'action_type'
 

Protected Member Functions

 getColumns ()
 
 getFilterInputs ()
 
 loadRecords (mixed $filter_data)
 
 buildRowCells (array $record)
 
- Protected Member Functions inherited from ILIAS\BookingManager\BookableItem\Table\BookableItemTable
 getColumns ()
 
 getFilterInputs ()
 
 loadRecords (mixed $filter_data)
 
 buildRowCells (array $record)
 
 sortRecords (Order $order, array $records)
 
 getSortCallable (string $key, int $direction)
 
 limitRecords (Range $range, array $records)
 
 getFilterComponent ()
 
 acquireParameters (URLBuilder $url_builder)
 
 getTableActions ()
 
 loadFilteredBookingObjects (?string $title_filter, ?string $description_filter, ?array $object_ids_filter)
 
 getReservationsForObject (int $booking_object_id)
 
 buildAvailabilityCell (int $available, int $total)
 

Private Member Functions

 hasActiveReservations (int $object_id)
 

Additional Inherited Members

- Public Member Functions inherited from ILIAS\BookingManager\BookableItem\Table\BookableItemTable
 __construct (protected readonly UIFactory $ui_factory, protected readonly UIRenderer $ui_renderer, protected readonly ilLanguage $lng, protected readonly HttpService $http, protected readonly ilUIService $ui_service, protected readonly ilCtrlInterface $ctrl, protected readonly ilGlobalTemplateInterface $tpl, protected readonly Refinery $refinery, protected readonly AccessManager $access, protected readonly ilObjBookingPool $pool, protected readonly BookingProcessManager $process_manager, protected readonly Settings $settings, protected readonly ilObjUser $user, protected readonly int $ref_id, protected readonly bool $active_management, protected readonly int $booking_context_obj_id,)
 
 getTableId ()
 
 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 records available. More...
 
 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\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...
 

Detailed Description

Definition at line 27 of file BookableItemWithoutScheduleTable.php.

Member Function Documentation

◆ buildRowCells()

ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::buildRowCells ( array  $record)
protected
Returns
array<string, mixed>

Reimplemented from ILIAS\BookingManager\BookableItem\Table\BookableItemTable.

Definition at line 119 of file BookableItemWithoutScheduleTable.php.

119 : array
120 {
121 return [
122 'availability' => $this->buildAvailabilityCell((int) $record['available'], (int) $record['nr_items']),
123 'title' => (string) $record['title'],
124 'description' => nl2br((string) $record['description']),
125 ];
126 }

References ILIAS\BookingManager\BookableItem\Table\BookableItemTable\buildAvailabilityCell().

+ Here is the call graph for this function:

◆ getColumns()

ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::getColumns ( )
protected
Returns
array<string, Column>

Reimplemented from ILIAS\BookingManager\BookableItem\Table\BookableItemTable.

Definition at line 34 of file BookableItemWithoutScheduleTable.php.

34 : array
35 {
36 $column_factory = $this->ui_factory->table()->column();
37 return [
38 'availability' => $column_factory->text($this->lng->txt('book_table_col_availability'))->withIsSortable(true),
39 'title' => $column_factory->text($this->lng->txt('title'))->withIsSortable(true),
40 'description' => $column_factory->text($this->lng->txt('description'))->withIsSortable(true),
41 ];
42 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getFilterInputs()

ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::getFilterInputs ( )
protected
Returns
array<string, mixed>

Reimplemented from ILIAS\BookingManager\BookableItem\Table\BookableItemTable.

Definition at line 47 of file BookableItemWithoutScheduleTable.php.

47 : array
48 {
49 $bookable_items = [];
50 foreach (ilBookingObject::getList($this->pool->getId()) as $item) {
51 $bookable_items[(int) $item['booking_object_id']] = (string) $item['title'];
52 }
53
54 $field_factory = $this->ui_factory->input()->field();
55 return [
56 'title' => $field_factory->text($this->lng->txt('title')),
57 'description' => $field_factory->text($this->lng->txt('description')),
58 'objects' => $field_factory->multiSelect($this->lng->txt('book_filter_objects'), $bookable_items),
59 ];
60 }
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.

References ilBookingObject\getList(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasActiveReservations()

ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::hasActiveReservations ( int  $object_id)
private

Definition at line 128 of file BookableItemWithoutScheduleTable.php.

128 : bool
129 {
130 return array_any(
131 $this->getReservationsForObject($object_id),
132 static fn(array $reservation): bool => $reservation['status'] !== ilBookingReservation::STATUS_CANCELLED
133 );
134 }

References ILIAS\BookingManager\BookableItem\Table\BookableItemTable\getReservationsForObject(), and ilBookingReservation\STATUS_CANCELLED.

Referenced by ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable\loadRecords().

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

◆ loadRecords()

ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::loadRecords ( mixed  $filter_data)
protected
Returns
array<string, mixed>[]

Reimplemented from ILIAS\BookingManager\BookableItem\Table\BookableItemTable.

Definition at line 65 of file BookableItemWithoutScheduleTable.php.

65 : array
66 {
67 $filter_data = is_array($filter_data) ? $filter_data : [];
68
69 $title_filter = trim((string) ($filter_data['title'] ?? '')) ?: null;
70 $description_filter = trim((string) ($filter_data['description'] ?? '')) ?: null;
71 $object_ids_filter = ($filter_data['objects'] ?? []) !== []
72 ? array_map('intval', $filter_data['objects'])
73 : null;
74
75 $rows = [];
76 foreach ($this->loadFilteredBookingObjects($title_filter, $description_filter, $object_ids_filter) as $item) {
77 $object_id = (int) $item['booking_object_id'];
79 $user_has_booking = false;
80 $user_has_active_booking = false;
81
82 foreach ($this->getReservationsForObject($object_id) as $reservation) {
83 $user_id = (int) $reservation['user_id'];
84 if ($user_id !== $this->user->getId()) {
85 continue;
86 }
87
88 $user_has_booking = true;
89
90 if ($reservation['status'] === ilBookingReservation::STATUS_CANCELLED) {
91 continue;
92 }
93
94 $user_has_active_booking = true;
95 break;
96 }
97
98 $rows[] = [
99 'row_id' => (string) $object_id,
100 'booking_object_id' => $object_id,
101 'title' => (string) $item['title'],
102 'description' => (string) ($item['description'] ?? ''),
103 'nr_items' => (int) $item['nr_items'],
104 'available' => $available,
105 'is_available' => $available > 0,
106 'has_user_booking' => $user_has_booking,
107 'has_user_active_booking' => $user_has_active_booking,
108 'has_reservations' => $this->hasActiveReservations($object_id),
109 'post_text' => (string) ($item['post_text'] ?? ''),
110 ];
111 }
112
113 return $rows;
114 }
loadFilteredBookingObjects(?string $title_filter, ?string $description_filter, ?array $object_ids_filter)
static numAvailableFromObjectNoSchedule(int $a_obj_id)

References $user_id, ILIAS\BookingManager\BookableItem\Table\BookableItemTable\getReservationsForObject(), ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable\hasActiveReservations(), ILIAS\Repository\int(), ILIAS\BookingManager\BookableItem\Table\BookableItemTable\loadFilteredBookingObjects(), ilBookingReservation\numAvailableFromObjectNoSchedule(), ilBookingReservation\STATUS_CANCELLED, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ ID

const string ILIAS\BookingManager\BookableItem\Table\BookableItemWithoutScheduleTable::ID = 'bkbiwos'

Definition at line 29 of file BookableItemWithoutScheduleTable.php.


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