aliroObjectSorter.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class aliroObjectSorter {
00007     var $_keyname = '';
00008     var $_direction = 0;
00009     var $_object_array = array();
00010 
00011     public function __construct (&$a, $k, $sort_direction=1) {
00012         $this->_keyname = $k;
00013         $this->_direction = $sort_direction;
00014         $this->_object_array =& $a;
00015         $this->sort();
00016     }
00017 
00018     public function mosObjectCompare (&$a, &$b) {
00019         $key = $this->_keyname;
00020         if ($a->$key > $b->$key) return $this->_direction;
00021         if ($a->$key < $b->$key) return -$this->_direction;
00022         return 0;
00023     }
00024 
00025     public function sort () {
00026         usort($this->_object_array, array($this,'mosObjectCompare'));
00027     }
00028 
00029 }

Generated on Thu Apr 17 13:03:26 2008 for ALIRO by  doxygen 1.5.5