You are here

public function UnitCalendar::__construct in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Constructs a UnitCalendar instance.

Parameters

int $unit_id: The bookable unit_id.

File

modules/rooms_availability/includes/rooms_availability.unit_calendar.inc, line 25
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

public function __construct($unit_id) {
  $this->unit_id = $unit_id;

  // Load the booking unit.
  $unit = rooms_unit_load($unit_id);

  // When deleting booking which unit was deleted before we don't have unit.
  $default_state = is_object($unit) ? $unit->default_state : ROOMS_AVAILABLE;
  $this->default_state = $default_state;
  $this->base_table = 'rooms_availability';
}