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