views_handler_argument_formula.inc in Views (for Drupal 7) 6.3
File
handlers/views_handler_argument_formula.inc
View source
<?php
class views_handler_argument_formula extends views_handler_argument {
var $formula = NULL;
function construct() {
parent::construct();
if (!empty($this->definition['formula'])) {
$this->formula = $this->definition['formula'];
}
}
function get_formula() {
return str_replace('***table***', $this->table_alias, $this->formula);
}
function summary_query() {
$this
->ensure_my_table();
$formula = $this
->get_formula();
$this->base_alias = $this->name_alias = $this->query
->add_field(NULL, $formula, $this->field);
$this->query
->set_count_field(NULL, $formula, $this->field);
return $this
->summary_basics(FALSE);
}
function query() {
$this
->ensure_my_table();
$formula = $this
->get_formula();
$this->query
->add_where(0, "{$formula} = '%s'", $this->argument);
}
}