You are here

function calendar_build_month in Calendar 5.2

Same name and namespace in other branches
  1. 6.2 includes/calendar.inc \calendar_build_month()
  2. 6.2 calendar_multiday/includes/calendar.inc \calendar_build_month()
  3. 7 includes/calendar.inc \calendar_build_month()
  4. 7 calendar_multiday/includes/calendar.inc \calendar_build_month()
  5. 7.2 includes/calendar.inc \calendar_build_month()
  6. 7.2 calendar_multiday/includes/calendar.inc \calendar_build_month()

Build one month.

1 call to calendar_build_month()
calendar_build_calendar in ./calendar.inc
Build calendar

File

./calendar.inc, line 255
All the code used while processing a calendar is stored in this file and is included only when needed.

Code

function calendar_build_month(&$curday, $view, $items, $params) {
  $month = date_format($curday, 'n');
  date_modify($curday, '-' . strval(date_format($curday, 'j') - 1) . ' days');
  $rows = array();
  do {
    $rows = array_merge($rows, calendar_build_week($curday, $view, $items, $params, TRUE));
    $curday_date = date_format($curday, DATE_FORMAT_DATE);
    $curday_month = date_format($curday, 'n');
  } while ($curday_month == $month && $curday_date <= $view->max_date_date);

  // Merge the day names in as the first row.
  if (!empty($view->mini)) {
    $len = variable_get('calendar_day_header_' . $view->name, 1);
  }
  else {
    $len = variable_get('calendar_full_day_header_' . $view->name, 3);
  }
  $rows = array_merge(array(
    calendar_week_header($view->mini, $params['with_weekno'], $len),
  ), $rows);
  return $rows;
}