You are here

function views_handler_arg_monthyear in Views (for Drupal 7) 5

1 string reference to 'views_handler_arg_monthyear'
node_views_arguments in modules/views_node.inc

File

modules/views_node.inc, line 613

Code

function views_handler_arg_monthyear($op, &$query, $argtype, $arg = '') {
  $timezone = _views_get_timezone();
  switch ($op) {
    case 'summary':
      $fieldinfo['field'] = "DATE_FORMAT(FROM_UNIXTIME(node.created+{$timezone}), '%Y%m')";
      $fieldinfo['fieldname'] = 'name';
      $query
        ->add_field('created');
      return $fieldinfo;
      break;
    case 'sort':
      $query
        ->add_orderby(NULL, "DATE_FORMAT(FROM_UNIXTIME(node.created+{$timezone}), '%Y%m')", $argtype, "name");
      break;
    case 'filter':
      $query
        ->add_where("DATE_FORMAT(FROM_UNIXTIME(node.created+{$timezone}), '%Y%m') = '%s'", $arg);
      break;
    case 'link':
      return l(format_date($query->created, 'custom', 'F, Y'), "{$arg}/{$query->name}");
    case 'title':
      return format_date(strtotime("{$query}15"), 'custom', 'F, Y', 0);
  }
}