function views_handler_argument_string::summary_query

3.x views_handler_argument_string.inc views_handler_argument_string::summary_query()
2.x views_handler_argument_string.inc views_handler_argument_string::summary_query()

Build the summary query based on a string

Overrides views_handler_argument::summary_query

File

handlers/views_handler_argument_string.inc, line 118

Class

views_handler_argument_string
Basic argument handler to implement string arguments that may have length limits.

Code

function summary_query() {
  if (empty($this->definition['many to one'])) {
    $this->ensure_my_table();
  }
  else {
    $this->table_alias = $this->helper->summary_join();
  }

  if (empty($this->options['glossary'])) {
    // Add the field.
    if (empty($this->options['ignorecase'])) {
      $this->base_alias = $this->name_alias = $this->query->add_field($this->table_alias, $this->real_field);
      $this->query->set_count_field($this->table_alias, $this->real_field);
    }
    else {
      $this->base_alias = $this->name_alias = $this->query->add_field($this->table_alias, 'LOWER(' . $this->real_field . ')');
      $this->query->set_count_field($this->table_alias, 'LOWER(' . $this->real_field . ')');
    }
  }
  else {
    // Add the field.
    $formula = $this->get_formula();
    if (empty($this->options['ignorecase'])) {
      $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field . '_truncated');
      $this->query->set_count_field(NULL, $formula, $this->field, $this->field . '_truncated');
    }
    else {
      $this->base_alias = $this->name_alias = $this->query->add_field(NULL, 'LOWER(' . $formula . ')', $this->field . '_truncated');
      $this->query->set_count_field(NULL, $formula, $this->field, $this->field . '_truncated');
    }
  }

  return $this->summary_basics(FALSE);
}