You are here

function date_api_argument_handler::get_query_fields in Date 6.2

Same name and namespace in other branches
  1. 6 date_api.views.inc \date_api_argument_handler::get_query_fields()
2 calls to date_api_argument_handler::get_query_fields()
date_api_argument_handler::query in includes/date_api_argument_handler.inc
Set up the query for this argument.
date_api_argument_handler::summary_query in includes/date_api_argument_handler.inc
Create a summary query that matches the granularity.

File

includes/date_api_argument_handler.inc, line 267
Views argument handler.

Class

date_api_argument_handler
Date API argument handler.

Code

function get_query_fields() {
  if (!empty($this->definition['base'])) {
    $fields = date_api_fields($this->definition['base']);
  }
  else {
    $fields = date_api_fields($this->view->base_table);
  }
  $fields = $fields['name'];
  $min_date = isset($this->min_date) ? $this->min_date : NULL;
  $min_utc = isset($this->min_utc) ? $this->min_utc : NULL;
  $max_date = isset($this->max_date) ? $this->max_date : NULL;
  $max_utc = isset($this->max_utc) ? $this->max_utc : NULL;
  $this->query_fields = array();
  foreach ($this->options['date_fields'] as $delta => $name) {
    if (array_key_exists($name, $fields) && ($field = $fields[$name])) {
      $date_handler = new date_sql_handler();
      $date_handler
        ->construct($field['sql_type'], date_default_timezone_name());
      $date_handler->granularity = $this->options['granularity'];
      date_views_set_timezone($date_handler, $this, $field);
      $this->query_fields[] = array(
        'field' => $field,
        'date_handler' => $date_handler,
      );
    }
  }
}