public function RoomsCalendar::monthDefined in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Checks if a month exists.
Parameters
int $month: The month to check.
int $year: The year to check.
Return value
bool TRUE if the month is defined, FALSE otherwise.
Overrides RoomsCalendarInterface::monthDefined
1 call to RoomsCalendar::monthDefined()
- RoomsCalendar::addMonthEvent in includes/
rooms.calendar.inc - Adds an event to the calendar
File
- includes/
rooms.calendar.inc, line 102
Class
- RoomsCalendar
- Handles querying and updating the availability information relative to a single bookable unit.
Code
public function monthDefined($month, $year) {
$query = db_select($this->base_table, 'a');
$query
->addField('a', 'unit_id');
$query
->addField('a', 'year');
$query
->addField('a', 'month');
$query
->condition('a.unit_id', $this->unit_id);
$query
->condition('a.year', $year);
$query
->condition('a.month', $month);
$result = $query
->execute()
->fetchAll(PDO::FETCH_ASSOC);
if (count($result) > 0) {
return TRUE;
}
return FALSE;
}