function availability_calendars_get_node_states_range in Availability Calendars 7.2
Returns the existing states for the calendar for the given node and date range. The from and to dates are inclusive.
Parameters
int $calendar_nid:
DateTime $from:
DateTime $to:
Return value
array Array with existing states within the given date range indexed by date. Missing dates should get the default status.
1 call to availability_calendars_get_node_states_range()
- availability_calendars_update_node_states_range in ./
availability_calendars.inc - Updates/inserts the states for the calendar for the given node and date range.
File
- ./
availability_calendars.inc, line 407 - General helper methods for Availability Calendars, like database access and settings.
Code
function availability_calendars_get_node_states_range($calendar_nid, $from, $to) {
// Get the states from the database.
$states = db_select('availability_calendars_day')
->fields('availability_calendars_day', array(
'date',
'status',
))
->condition('nid', $calendar_nid)
->condition('date', array(
$from
->format(AC_ISODATE),
$to
->format(AC_ISODATE),
), 'BETWEEN')
->execute()
->fetchAllKeyed();
return $states;
}