Blesta Source Documentation

CalendarEvents extends AppModel

CalendarEvents

Table of Contents

Methods

__construct() Initialize the CalendarEvents
add() Adds a calendar event
delete() Deletes a calendar event
edit() Updates a calendar event
get() Fetches a calendar event
getAll() Fetches all of events that begin between the given start and end dates
getRange() 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).
validateDateOrder() Validates that the given start date is before the given end date, inclusive
validateStaffEvent() Validates whether the given event belongs to the given staff member
getEvents() Returns a Record objects consisting of a partial query on calendar events
getRules() Retrieves a list of add/edit rules
Methods

__construct()

Initialize the CalendarEvents

public __construct() : mixed

add()

Adds a calendar event

public add(array<string|int, mixed> $vars) : int
Parameters
$vars : array<string|int, mixed>

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)
Return values
int

The ID of the calendar event created, void on error

delete()

Deletes a calendar event

public delete(int $calendar_event_id) : mixed
Parameters
$calendar_event_id : int

The ID of the calendar event to delete

edit()

Updates a calendar event

public edit(int $calendar_event_id, array<string|int, mixed> $vars) : mixed
Parameters
$calendar_event_id : int

The ID of the calendar event to update

$vars : array<string|int, mixed>

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

get()

Fetches a calendar event

public get(int $calendar_event_id) : mixed
Parameters
$calendar_event_id : int

The ID of the calendar event to fetch

Return values
mixed

A stdClass object representing the calendar event, false if no such event exists

getAll()

Fetches all of events that begin between the given start and end dates

public getAll(int $company_id, int $staff_id, string $start_date, string $end_date[, bool $include_shared = true ]) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company to fetch for

$staff_id : int

The ID of the staff member to fetch for

$start_date : string

Defines the lower bound for event start dates

$end_date : string

Defines the upper bound for event start dates

$include_shared : bool = true

If true will include shared calendar events, false will only include events for this staff member

Tags
see
CalendarEvents::getRange()
Return values
array<string|int, mixed>

An array of stdClass objects, each representing a calendar event

getRange()

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).

public getRange(int $company_id, int $staff_id, string $start_date, string $end_date[, bool $include_shared = true ]) : array<string|int, mixed>
Parameters
$company_id : int

The ID of the company to fetch for

$staff_id : int

The ID of the staff member to fetch for

$start_date : string

Defines the lower bound for event start/end dates

$end_date : string

Defines the upper bound for event start/end dates

$include_shared : bool = true

If true will include shared calendar events, false will only include events for this staff member

Tags
see
CalendarEvents::getAll()
Return values
array<string|int, mixed>

An array of stdClass objects, each representing a calendar event

validateDateOrder()

Validates that the given start date is before the given end date, inclusive

public validateDateOrder(string $start_date, string $end_date) : mixed
Parameters
$start_date : string

The start date

$end_date : string

The end date

validateStaffEvent()

Validates whether the given event belongs to the given staff member

public validateStaffEvent(int $staff_id, int $event_id) : bool
Parameters
$staff_id : int

The ID of the staff member that created this event

$event_id : int

The ID of the calendar event created

Return values
bool

True if the calendar event belongs to the given staff member, false otherwise

getEvents()

Returns a Record objects consisting of a partial query on calendar events

private getEvents() : Record
Return values
Record

A partial query on calendar events

getRules()

Retrieves a list of add/edit rules

private getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

A list of input vars

$edit : bool = false

True to retrieve the edit rules, false to retrieve the add rules (optional, default false)

Return values
array<string|int, mixed>

A list of input rules

Tags
subpackage

app.models

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results