You are here

interface UnitCalendarInterface in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

@file Handles querying and updating the availability information relative to a single bookable unit.

Hierarchy

Expanded class hierarchy of UnitCalendarInterface

All classes that implement UnitCalendarInterface

File

modules/rooms_availability/includes/rooms_availability.unit_calendar_interface.inc, line 9
Handles querying and updating the availability information relative to a single bookable unit.

View source
interface UnitCalendarInterface extends RoomsCalendarInterface {

  /**
   * Given a date range returns all states in that range - useful when we are
   * not interested in starting and ending dates but simply in states.
   *
   * @param DateTime $start_date
   *   The start day of the range.
   * @param DateTime $end_date
   *   The end date of our range.
   * @param bool $confirmed
   *   Whether include confirmed states or not.
   *
   * @return array
   *   An array of states within that range
   */
  public function getStates(DateTime $start_date, DateTime $end_date, $confirmed = FALSE);

  /**
   * Checks if an event is blocked, i.e. cannot be updated. This happens
   * when the event id is in the rooms_booking_locks table and the new event_id
   * is not the same as the one that is locked.
   *
   * @param BookingEventInterface $event
   *   The event to check if it is blocked.
   *
   * @return bool
   *   TRUE if blocked, FALSE otherwise.
   */
  public function eventBlocked(BookingEventInterface $event);

  /**
   * Given a set of states (e.g. the desired states to accept a booking) we
   * compare against the states the unit is actually in.
   *
   * If the unit is in any state that is not in the list of desired states it
   * means there is a mismatch - hence no availability.
   *
   * @param DateTime $start_date
   *   The starting date for the search.
   * @param DateTime $end_date
   *   The end date for the search.
   * @param array $states
   *   The states we are interested in.
   *
   * @return bool
   *   Returns true if the date range provided does not have states other than
   * the ones we are interested in
   */
  public function stateAvailability(DateTime $start_date, DateTime $end_date, array $states = array());

  /**
   * Returns the default state.
   *
   * @return string
   *   The calendar default state.
   */
  public function getDefaultState();

  /**
   * Given an array of events removes events from the calendar setting the value
   * to the default.
   *
   * @param BookingEventInterface[] $events
   *   The events to remove from the database - an array of Booking Events
   */
  public function removeEvents($events);

}

Members

Namesort descending Modifiers Type Description Overrides
RoomsCalendarInterface::addMonthEvent public function Adds an event to the calendar 1
RoomsCalendarInterface::getEvents public function Given a date range returns an array of RoomEvents. The heavy lifting really takes place in the getRawDayData function - here we are simply acting as a factory for event objects 1
RoomsCalendarInterface::getRawDayData public function 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. 1
RoomsCalendarInterface::monthDefined public function Checks if a month exists. 1
RoomsCalendarInterface::updateCalendar public function Given an array of RoomEvents the calendar is updated with regards to the events that are relevant to the Unit this calendar refers to 1
UnitCalendarInterface::eventBlocked public function Checks if an event is blocked, i.e. cannot be updated. This happens when the event id is in the rooms_booking_locks table and the new event_id is not the same as the one that is locked. 1
UnitCalendarInterface::getDefaultState public function Returns the default state. 1
UnitCalendarInterface::getStates public function Given a date range returns all states in that range - useful when we are not interested in starting and ending dates but simply in states. 1
UnitCalendarInterface::removeEvents public function Given an array of events removes events from the calendar setting the value to the default. 1
UnitCalendarInterface::stateAvailability public function Given a set of states (e.g. the desired states to accept a booking) we compare against the states the unit is actually in. 1