MinField

The Contact Form DB MinField class.

Defined (1)

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

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