SortByMultiField

The Contact Form DB SortByMultiField class.

Defined (1)

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

/SortByMultiField.php  
  1. class SortByMultiField extends SortTransform { 
  2.  
  3. var $fieldName1; 
  4. var $fieldName2; 
  5. var $fieldName3; 
  6.  
  7. function __construct($fieldName1, $fieldName2 = null, $fieldName3 = null) { 
  8. $this->fieldName1 = $fieldName1; 
  9. $this->fieldName2 = $fieldName2; 
  10. $this->fieldName3 = $fieldName3; 
  11.  
  12. public function sort($a, $b) { 
  13. $result = strcmp($a[$this->fieldName1], $b[$this->fieldName1]); 
  14. if ($result == 0 && $this->fieldName2) { 
  15. $result = strcmp($a[$this->fieldName2], $b[$this->fieldName2]); 
  16. if ($result == 0 && $this->fieldName3) { 
  17. $result = strcmp($a[$this->fieldName3], $b[$this->fieldName3]); 
  18. return $result; 
  19.