function availability_calendars_get_node_notes in Availability Calendars 7.2
Same name and namespace in other branches
- 6.2 availability_calendars.inc \availability_calendars_get_node_notes()
Returns the notes for the calendar for the given node in the given month. The returned array will be completely filled, so no checking is necessary.
Parameters
int $calendar_nid:
int $year:
int $month:
Return value
array Array with 6 week entries of week number (int) => note (string) (possibly empty string)
2 calls to availability_calendars_get_node_notes()
- availability_calendars_node_edit_calendar_month_form in ./
availability_calendars.node.inc - Populates the node edit calendar month form.
- theme_availability_calendars_month in ./
availability_calendars.page.inc - Themes the calendar for a given month.
File
- ./
availability_calendars.inc, line 276 - General helper methods for Availability Calendars, like database access and settings.
Code
function availability_calendars_get_node_notes($calendar_nid, $year, $month) {
$notes = db_select('availability_calendars_week')
->fields('availability_calendars_week', array(
'week',
'note',
))
->condition('nid', $calendar_nid)
->condition('year', $year)
->condition('month', $month)
->execute()
->fetchAllKeyed();
// Complete the array with defaults
$notes += array_fill(1, 6, "");
return $notes;
}