function calendar_filter_week in Calendar 5.2
Same name and namespace in other branches
- 5 calendar.module \calendar_filter_week()
Callback for week filter. Build year, month, day, min, and max into query object.
Parameters
object $query:
integer $arg:
2 calls to calendar_filter_week()
- calendar_handler_arg_week in ./
calendar.module - Custom views handlers for the week argument.
- _calendar_views_query_alter in ./
calendar.inc - @file All the code used while processing a calendar is stored in this file and is included only when needed.
File
- ./
calendar.module, line 227 - Adds calendar filtering and displays to Views.
Code
function calendar_filter_week(&$query, $arg) {
$now = date_now();
if (!isset($query->year)) {
calendar_filter_year($query, date_format($now, 'Y'));
}
$arg = str_replace('W', '', $arg);
$query->calendar_type = 'week';
$query->week = calendar_part_is_valid($arg, 'week') ? $arg : NULL;
$range = date_week_range($query->week, $query->year);
$query->month = date_format($range[0], 'n');
$query->day = date_format($range[0], 'j');
}