Methods summary
public
|
#
__construct( )
Initialize the CalendarEvents
Initialize the CalendarEvents
Overrides
|
public
integer
|
#
add( array $vars )
Adds a calendar event
Parameters
- $vars
An array of calendar event data including:
- company_id The ID of the company to add this event under
- staff_id The ID of the staff member that created this event
- shared Whether or not this event is shared among other staff
members of this company (true to share false otherwise, default false)
- title The title of the event
- url The URL to link this event to (optional, default null)
- start_date The start date of the event
- end_date The end date of the event
- all_day Whether or not this event spans the entire day of the start/end dates (default false)
Returns
integer The ID of the calendar event created, void on error
|
public
|
#
edit( integer $calendar_event_id, array $vars )
Updates a calendar event
Parameters
- $calendar_event_id
- The ID of the calendar event to update
- $vars
An array of calendar event data including (only parameters submitted will be updated):
- company_id The ID of the company to add this event under
- staff_id The ID of the staff member that created this event (required)
- shared Whether or not this event is shared among other staff
members of this company (true to share false otherwise)
- title The title of the event
- url The URL to link this event to
- start_date The start date of the event
- end_date The end date of the event
- all_day Whether or not this event spans the entire day of the start/end dates
|
public
|
#
delete( integer $calendar_event_id )
Deletes a calendar event
Parameters
- $calendar_event_id
- The ID of the calendar event to delete
|
public
mixed
|
#
get( integer $calendar_event_id )
Fetches a calendar event
Parameters
- $calendar_event_id
- The ID of the calendar event to fetch
Returns
mixed A stdClass object representing the calendar event, false if no such event exists
|
public
array
|
#
getAll( integer $company_id, integer $staff_id, string $start_date, string $end_date, boolean $include_shared = true )
Fetches all of events that begin between the given start and end dates
Fetches all of events that begin between the given start and end dates
Parameters
- $company_id
- The ID of the company to fetch for
- $staff_id
- The ID of the staff member to fetch for
- $start_date
- Defines the lower bound for event start dates
- $end_date
- Defines the upper bound for event start dates
- $include_shared
If true will include shared calendar events,
false will only include events for this staff member
Returns
array An array of stdClass objects, each representing a calendar event
See
|
public
array
|
#
getRange( integer $company_id, integer $staff_id, string $start_date, string $end_date, boolean $include_shared = true )
Fetches a set of events that begin or end between the given start and
end dates (e.g. exist between the given start and end dates).
Fetches a set of events that begin or end between the given start and
end dates (e.g. exist between the given start and end dates).
Parameters
- $company_id
- The ID of the company to fetch for
- $staff_id
- The ID of the staff member to fetch for
- $start_date
- Defines the lower bound for event start/end dates
- $end_date
- Defines the upper bound for event start/end dates
- $include_shared
If true will include shared calendar events,
false will only include events for this staff member
Returns
array An array of stdClass objects, each representing a calendar event
See
|
public
boolean
|
#
validateStaffEvent( integer $staff_id, integer $event_id )
Validates whether the given event belongs to the given staff member
Validates whether the given event belongs to the given staff member
Parameters
- $staff_id
- The ID of the staff member that created this event
- $event_id
- The ID of the calendar event created
Returns
boolean True if the calendar event belongs to the given staff member, false otherwise
|
public
|
#
validateDateOrder( string $start_date, string $end_date )
Validates that the given start date is before the given end date, inclusive
Validates that the given start date is before the given end date, inclusive
Parameters
- $start_date
- The start date
- $end_date
- The end date
|