aliroObjectSorter Class Reference

List of all members.

Public Member Functions

 __construct (&$a, $k, $sort_direction=1)
 mosObjectCompare (&$a, &$b)
 sort ()

Public Attributes

 $_keyname = ''
 $_direction = 0
 $_object_array = array()


Detailed Description

Sorts an Array of objects

Definition at line 6 of file aliroObjectSorter.php.


Constructor & Destructor Documentation

aliroObjectSorter::__construct ( &$  a,
k,
sort_direction = 1 
)

Definition at line 11 of file aliroObjectSorter.php.

References sort().

00011                                                              {
00012         $this->_keyname = $k;
00013         $this->_direction = $sort_direction;
00014         $this->_object_array =& $a;
00015         $this->sort();
00016     }


Member Function Documentation

aliroObjectSorter::mosObjectCompare ( &$  a,
&$  b 
)

Definition at line 18 of file aliroObjectSorter.php.

00018                                                 {
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     }

aliroObjectSorter::sort (  ) 

Definition at line 25 of file aliroObjectSorter.php.

Referenced by __construct().

00025                             {
00026         usort($this->_object_array, array($this,'mosObjectCompare'));
00027     }


Member Data Documentation

aliroObjectSorter::$_keyname = ''

Definition at line 7 of file aliroObjectSorter.php.

aliroObjectSorter::$_direction = 0

Definition at line 8 of file aliroObjectSorter.php.

aliroObjectSorter::$_object_array = array()

Definition at line 9 of file aliroObjectSorter.php.


The documentation for this class was generated from the following file:

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