| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: views_handler_argument_formula.inc,v 1.1 2008/09/03 19:21:28 merlinofchaos Exp $ 3 /** 4 * Abstract argument handler for simple formulae. 5 * 6 * Child classes of this object should implement summary_argument, at least. 7 * 8 * Definition terms: 9 * - formula: The formula to use for this handler. 10 * 11 * @ingroup views_argument_handlers 12 */ 13 class views_handler_argument_formula extends views_handler_argument { 14 var $formula = NULL; 15 /** 16 * Constructor 17 */ 18 function construct() { 19 parent::construct(); 20 21 if (!empty($this->definition['formula'])) { 22 $this->formula = $this->definition['formula']; 23 } 24 } 25 26 function get_formula() { 27 return str_replace('***table***', $this->table_alias, $this->formula); 28 } 29 30 /** 31 * Build the summary query based on a formula 32 */ 33 function summary_query() { 34 $this->ensure_my_table(); 35 // Now that our table is secure, get our formula. 36 $formula = $this->get_formula(); 37 38 // Add the field. 39 $this->base_alias = $this->name_alias = $this->query->add_field(NULL, $formula, $this->field); 40 $this->query->set_count_field(NULL, $formula, $this->field); 41 42 return $this->summary_basics(FALSE); 43 } 44 45 /** 46 * Build the query based upon the formula 47 */ 48 function query() { 49 $this->ensure_my_table(); 50 // Now that our table is secure, get our formula. 51 $formula = $this->get_formula(); 52 53 $this->query->add_where(0, "$formula = '%s'", $this->argument); 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |