1 date_views_argument_handler_simple.inc date_views_argument_handler_simple::summary_query()

Inject a test for valid date range before the summary query.

Overrides views_handler_argument_formula::summary_query

File

core/modules/date/views/date_views_argument_handler_simple.inc, line 302
Date API views argument handler.

Class

date_views_argument_handler_simple

Code

function summary_query() {

  // @TODO The summary values are computed by the database.
  // Unless the database has built-in timezone handling it will use
  // a fixed offset, which will not be right for all dates.
  // The only way I can see to make this work right is to store the offset
  // for each date in the database so it can be added to the base
  // date value before the database formats the result. Because this is a huge
  // architectural change, it won't go in until we start a new branch.
  $this->formula = $this->date_handler->sql_format($this->sql_format, $this->date_handler->sql_field("***table***.$this->real_field"));
  $this->ensure_my_table();
  // Now that our table is secure, get our formula.
  $formula = $this->get_formula();

  // Add the field, give it an alias that does NOT match the actual
  // field name or grouping won't work right.
  $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field . '_summary');
  $this->query->set_count_field(NULL, $formula, $this->field);

  $this->summary_basics(FALSE);
}