You are here

function availability_calendars_get_node_notes in Availability Calendars 6.2

Same name and namespace in other branches
  1. 7.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 $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 148
General helper methods for Availability Calendars, like database access and settings.

Code

function availability_calendars_get_node_notes($nid, $year, $month) {
  $notes = array_fill(1, 6, "");
  $result = db_query('SELECT week, note FROM {availability_calendars_week} WHERE nid = %d AND year = %d and month = %d', $nid, $year, $month);
  while ($note = db_fetch_array($result)) {
    $notes[$note['week']] = $note['note'];
  }
  return $notes;
}