Property | Type | Description | |
---|---|---|---|
$default_value | The default value for events. In the event store this is represented by 0 which is then replaced by the default value provided in the constructor. | ||
$itemized_events | Stores itemized events allowing us to perform searches over them without having to pull them out of storage (i.e. reducing DB calls) | ||
$store | The class that will access the actual event store where event data is held. | ||
$units | array | The units we are dealing with. If no unit ids set the calendar will return results for date range and all units within that range. |
Method | Description | |
---|---|---|
addEvents ( $events, $granularity ) | ||
getEvents ( DateTime $start_date, DateTime $end_date, $reset = TRUE ) : array | Given a start and end time will retrieve events from the defined store. | |
getEventsItemized ( DateTime $start_date, DateTime $end_date, String $granularity = Event::BAT_HOURLY ) : array | Provides an itemized array of events keyed by the unit_id and divided by day, hour and minute. | |
getEventsNormalized ( DateTime $start_date, DateTime $end_date, $events ) : array | Given an itemized set of event data it will return an array of Events | |
getMatchingUnits ( DateTime $start_date, DateTime $end_date, $valid_states, $constraints = [], $intersect = FALSE, $reset = TRUE ) : Roomify\Bat\Calendar\CalendarResponse | Given a date range and a set of valid states it will return all units within the set of valid states. | |
getStates ( DateTime $start_date, DateTime $end_date, $reset = TRUE ) : array | Given a start and end time this will return the states units find themselves in for that range. | |
groupData ( $data, $length ) | A simple utility function that given an array of datum=>value will group results based on those that have the same value. Useful for grouping events based on state. |
Method | Description | |
---|---|---|
getUnit ( $unit_id ) : Roomify\Bat\Unit\Unit | Returns the unit object. | |
getUnitIds ( ) : array | Return an array of unit ids from the set of units supplied to the Calendar. | |
keyUnitsById ( ) : array | Return an array of units keyed by unit id |
Method | Description | |
---|---|---|
itemizeDays ( $db_events, $itemized, $unit, $keyed_units ) : array | Helper function that cycles through db results and setups the BAT_DAY itemized array | |
itemizeHours ( $db_events, $itemized, $unit, $keyed_units ) : array | Helper function that cycles through db results and setups the BAT_HOUR itemized array | |
itemizeMinutes ( $db_events, $itemized, $unit, $keyed_units ) : array | Helper function that cycles through db results and setups the BAT_MINUTE itemized array |
public getEventsItemized ( DateTime $start_date, DateTime $end_date, String $granularity = Event::BAT_HOURLY ) : array | ||
$start_date | DateTime | |
$end_date | DateTime | |
$granularity | String | |
return | array |
public getEventsNormalized ( DateTime $start_date, DateTime $end_date, $events ) : array | ||
$start_date | DateTime | |
$end_date | DateTime | |
$events | ||
return | array |
public getMatchingUnits ( DateTime $start_date, DateTime $end_date, $valid_states, $constraints = [], $intersect = FALSE, $reset = TRUE ) : Roomify\Bat\Calendar\CalendarResponse | ||
$start_date | DateTime | |
$end_date | DateTime | |
$valid_states | ||
$constraints | ||
$intersect | - performs an intersect rather than a diff on valid states | |
$reset | - if set to true we refer to the Store to retrieve events | |
return | Roomify\Bat\Calendar\CalendarResponse |
protected getUnit ( $unit_id ) : Roomify\Bat\Unit\Unit | ||
$unit_id | ||
return | Roomify\Bat\Unit\Unit |
protected getUnitIds ( ) : array | ||
return | array |
public groupData ( $data, $length ) | ||
$data | ||
$length |
protected keyUnitsById ( ) : array | ||
return | array |
protected $default_value |
protected $itemized_events |
protected $store |
protected array $units | ||
return | array |