function views_handler_arg_week in Views (for Drupal 7) 5
1 string reference to 'views_handler_arg_week'
- node_views_arguments in modules/
views_node.inc
File
- modules/
views_node.inc, line 588
Code
function views_handler_arg_week($op, &$query, $argtype, $arg = '') {
$timezone = _views_get_timezone();
switch ($op) {
case 'summary':
// The 3 makes the week 1-53, the first week of the year has at least 3 days
$fieldinfo['field'] = "WEEK(FROM_UNIXTIME(node.created+{$timezone}), 3)";
$fieldinfo['fieldname'] = "name";
$query
->add_field('created');
return $fieldinfo;
break;
case 'sort':
$query
->add_orderby(NULL, "WEEK(FROM_UNIXTIME(node.created+{$timezone}), 3)", $argtype, 'name');
break;
case 'filter':
// The 3 makes the week 1-53, the first week of the year has at least 3 days
$week = intval($arg);
$query
->add_where("WEEK(FROM_UNIXTIME(node.created+{$timezone}), 3) = {$week}");
break;
case 'link':
return l("Week {$query->name}", "{$arg}/{$query->name}");
case 'title':
return check_plain($query);
}
}