MaxField

The Contact Form DB MaxField class.

Defined (1)

The class is defined in the following location(s).

/MaxField.php  
  1. class MaxField extends HistogramTransform { 
  2.  
  3.  
  4. /** 
  5. * @var string field holding the value 
  6. */ 
  7. var $valueField; 
  8.  
  9. /** 
  10. * @var string field to group by 
  11. */ 
  12. var $groupByField; 
  13.  
  14. function __construct($valueField, $groupByField = null) { 
  15. $this->valueField = $valueField; 
  16. $this->groupByField = $groupByField; 
  17.  
  18. public function addEntry(&$entry) { 
  19. if (array_key_exists($this->valueField, $entry) && is_numeric($entry[$this->valueField])) { 
  20. $value = $entry[$this->valueField]; 
  21. $groupByName = empty($this->groupByField) ? $this->valueField : $entry[$this->groupByField]; 
  22.  
  23. if ($value !== null && $value !== '') { 
  24. if (!array_key_exists($groupByName, $this->values)) { 
  25. $this->values[$groupByName] = $value; 
  26. } else if ($value > $this->values[$groupByName]) { 
  27. $this->values[$groupByName] = $value;