protected function UnitCalendar::prepareFullMonthArray in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Given an event it prepares the entire month array for it assuming no other events in the month and days where there is no event get set to the default state.
Parameters
RoomsEventInterface $event: The event to process.
Return value
array The days of the month states processed array.
Overrides RoomsCalendar::prepareFullMonthArray
1 call to UnitCalendar::prepareFullMonthArray()
- UnitCalendar::getRawDayData in modules/
rooms_availability/ includes/ rooms_availability.unit_calendar.inc - Given a date range it returns all data within that range including the start and end dates of states. The MySQL queries are kept simple and then the data is cleared up.
File
- modules/
rooms_availability/ includes/ rooms_availability.unit_calendar.inc, line 398 - Class UnitCalendar Handles querying and updating the availability information relative to a single bookable unit.
Class
- UnitCalendar
- @file Class UnitCalendar Handles querying and updating the availability information relative to a single bookable unit.
Code
protected function prepareFullMonthArray(RoomsEventInterface $event) {
$days = array();
$eod = rooms_end_of_month_dates($event
->startYear());
$last_day = $eod[$event
->startMonth()];
for ($i = 1; $i <= $last_day; $i++) {
if ($i >= $event
->startDay() && $i <= $event
->endDay()) {
$days['d' . $i] = $event->id;
}
else {
// Replace with default state.
$days['d' . $i] = $this->default_state;
}
}
return $days;
}