You are here

function calendar_filter_month in Calendar 5

Same name and namespace in other branches
  1. 5.2 calendar.module \calendar_filter_month()

Callback for month filter. Build year, month, day, min, and max into query object.

Parameters

object $query:

integer $arg:

3 calls to calendar_filter_month()
calendar_filter_day in ./calendar.module
Callback for day filter. Build year, month, day, min, and max into query object.
calendar_handler_arg_month in ./calendar.module
Custom views handler for the month argument.
calendar_views_query_alter in ./calendar.module
Implementation of hook_views_query() Insert filters into the query based on the current calendar view and the selected fields Used when the actual view arguments don't provide enough info to construct the query. i.e. on a view with no arguments…

File

./calendar.module, line 583
Adds calendar filtering and displays to Views.

Code

function calendar_filter_month(&$query, $arg) {
  calendar_load_calendar_api();
  $query->calendar_type = 'month';
  if (!isset($query->year)) {
    calendar_filter_year($query, calendar_user_date('year'));
  }
  $query->month = calendar_part_is_valid($arg, 'month') ? $arg : calendar_user_date('month');
  $query->day = CALENDAR_EMPTY_ARG;
  $query->min .= '-' . sprintf('%02d', $query->month);
  $query->max .= '-' . sprintf('%02d', $query->month);
}