optimized sorting

This commit is contained in:
Roland Gruber 2009-11-27 14:25:58 +00:00
parent 2c1c8b9bf7
commit 7e3833182d
1 changed files with 3 additions and 7 deletions

View File

@ -298,16 +298,12 @@ class lamList {
* @return integer 0 if both are equal, 1 if $a is greater, -1 if $b is greater
*/
protected function cmp_array(&$a, &$b) {
// sort specifies the sort column
$sort = $this->sortColumn;
// sort by first column if no attribute is given
if (!$sort) $sort = strtolower($this->attrArray[0]);
if ($sort != "dn") {
if ($this->sortColumn != "dn") {
// sort by first attribute with name $sort
return @strnatcasecmp($a[$sort][0], $b[$sort][0]) * $this->sortDirection;
return @strnatcasecmp($a[$this->sortColumn][0], $b[$this->sortColumn][0]) * $this->sortDirection;
}
else {
return strnatcasecmp($a[$sort], $b[$sort]) * $this->sortDirection;
return strnatcasecmp($a[$this->sortColumn], $b[$this->sortColumn]) * $this->sortDirection;
}
}