Now all modules are in core modules folder
This commit is contained in:
parent
5ba1cdfa0b
commit
05b6a91b0c
1907 changed files with 0 additions and 0 deletions
54
modules/views/handlers/views_handler_argument_formula.inc
Normal file
54
modules/views/handlers/views_handler_argument_formula.inc
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Abstract argument handler for simple formulae.
|
||||
*
|
||||
* Child classes of this object should implement summary_argument, at least.
|
||||
*
|
||||
* Definition terms:
|
||||
* - formula: The formula to use for this handler.
|
||||
*
|
||||
* @ingroup views_argument_handlers
|
||||
*/
|
||||
class views_handler_argument_formula extends views_handler_argument {
|
||||
var $formula = NULL;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the summary query based on a formula
|
||||
*/
|
||||
function summary_query() {
|
||||
$this->ensure_my_table();
|
||||
// Now that our table is secure, get our formula.
|
||||
$formula = $this->get_formula();
|
||||
|
||||
// Add the field.
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the query based upon the formula
|
||||
*/
|
||||
function query() {
|
||||
$this->ensure_my_table();
|
||||
// Now that our table is secure, get our formula.
|
||||
$formula = $this->get_formula();
|
||||
|
||||
$this->query->add_where(0, "$formula = '%s'", $this->argument);
|
||||
}
|
||||
}
|
Reference in a new issue