PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.3
Booktics – Appointment Booking Calendar for Service Businesses v1.0.3
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / trunk / core / calendar / calendar-manager.php

calendar-manager.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.3, at trunk/core/calendar/calendar-manager.php

28 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Calendar;
4
5 class Calendar_Manager {
6 public static function sync_team_member_calendar( int $team_member_id, string $calendar_id ): array {
7 if ( $calendar = Calendar_Registry::get_calendar( $calendar_id ) ) {
8 if ( $calendar->is_configured( $team_member_id ) ) {
9 return $calendar->sync_events( $team_member_id );
10 }
11 throw new \Exception(
12 sprintf(
13 'Calendar not configured for team member ID: %d',
14 intval( $team_member_id )
15 )
16 );
17 }
18 throw new \Exception( sprintf( 'Calendar not found: %s', esc_html( $calendar_id ) ) );
19 }
20
21 public static function create_calendar_event( string $calendar_id, int $team_member_id, array $event_data ): bool {
22 if ( $calendar = Calendar_Registry::get_calendar( $calendar_id ) ) {
23 return $calendar->create_event( array_merge( $event_data, array( 'team_member_id' => $team_member_id ) ) );
24 }
25 return false;
26 }
27 }
28