PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / trunk
LatePoint – Calendar Booking Plugin for Appointments and Events vtrunk
5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / misc / booked_period.php
latepoint / lib / misc Last commit date
blocked_period.php 3 months ago booked_period.php 3 months ago booking_request.php 3 months ago booking_resource.php 3 months ago booking_slot.php 3 months ago filter.php 3 months ago process_action.php 1 month ago process_event.php 1 month ago role.php 3 weeks ago router.php 3 months ago step.php 3 months ago stripe_connect_customer.php 3 months ago time_period.php 3 months ago user.php 3 months ago work_period.php 3 months ago
booked_period.php
56 lines
1 <?php
2 /*
3 * Copyright (c) 2022 LatePoint LLC. All rights reserved.
4 *
5 * This class is used to create booked periods in resources
6 */
7
8 namespace LatePoint\Misc;
9
10 class BookedPeriod extends BlockedPeriod {
11 public int $buffer_before = 0;
12 public int $buffer_after = 0;
13 public int $total_attendees = 1;
14
15
16 public static function create_from_booking_model( \OsBookingModel $booking ): BookedPeriod {
17 return new BookedPeriod(
18 [
19 'start_date' => $booking->start_date,
20 'end_date' => $booking->end_date,
21 'start_time' => $booking->start_time,
22 'end_time' => $booking->end_time,
23 'buffer_before' => $booking->buffer_before,
24 'buffer_after' => $booking->buffer_after,
25 'total_attendees' => $booking->total_attendees ?? 1,
26 'agent_id' => $booking->agent_id,
27 'service_id' => $booking->service_id,
28 'location_id' => $booking->location_id,
29 ]
30 );
31 }
32
33 function start_time_with_buffer(): int {
34 return $this->start_time - $this->buffer_before;
35 }
36
37 function end_time_with_buffer(): int {
38 return $this->end_time + $this->buffer_after;
39 }
40
41 public static function allowed_props(): array {
42 return [
43 'start_date',
44 'end_date',
45 'start_time',
46 'end_time',
47 'buffer_before',
48 'buffer_after',
49 'total_attendees',
50 'service_id',
51 'agent_id',
52 'location_id',
53 ];
54 }
55 }
56