• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

handlers/views_handler_argument_formula.inc

00001 <?php
00012 class views_handler_argument_formula extends views_handler_argument {
00013   var $formula = NULL;
00017   function construct() {
00018     parent::construct();
00019 
00020     if (!empty($this->definition['formula'])) {
00021       $this->formula = $this->definition['formula'];
00022     }
00023   }
00024 
00025   function get_formula() {
00026     return str_replace('***table***', $this->table_alias, $this->formula);
00027   }
00028 
00032   function summary_query() {
00033     $this->ensure_my_table();
00034     // Now that our table is secure, get our formula.
00035     $formula = $this->get_formula();
00036 
00037     // Add the field.
00038     $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field);
00039     $this->query->set_count_field(NULL, $formula, $this->field);
00040 
00041     return $this->summary_basics(FALSE);
00042   }
00043 
00047   function query($group_by = FALSE) {
00048     $this->ensure_my_table();
00049     // Now that our table is secure, get our formula.
00050     $placeholder = $this->placeholder();
00051     $formula = $this->get_formula() .' = ' . $placeholder;
00052     $placeholders = array(
00053       $placeholder => $this->argument,
00054     );
00055     $this->query->add_where(0, $formula, $placeholders, 'formula');
00056   }
00057 }

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1