fixed sorting of DNs
This commit is contained in:
parent
723c21b13a
commit
35bf6395b8
|
@ -251,11 +251,19 @@ function cmp_array($a, $b) {
|
||||||
// sort specifies the sort column
|
// sort specifies the sort column
|
||||||
global $sort;
|
global $sort;
|
||||||
global $attr_array;
|
global $attr_array;
|
||||||
// sort by first attribute with name $sort
|
// sort by first column if no attribute is given
|
||||||
if (!$sort) $sort = strtolower($attr_array[0]);
|
if (!$sort) $sort = strtolower($attr_array[0]);
|
||||||
|
if ($sort != "dn") {
|
||||||
|
// sort by first attribute with name $sort
|
||||||
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
||||||
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($a[$sort] == $b[$sort]) return 0;
|
||||||
|
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -364,11 +364,19 @@ function cmp_array($a, $b) {
|
||||||
// sort specifies the sort column
|
// sort specifies the sort column
|
||||||
global $sort;
|
global $sort;
|
||||||
global $attr_array;
|
global $attr_array;
|
||||||
// sort by first attribute with name $sort
|
// sort by first column if no attribute is given
|
||||||
if (!$sort) $sort = strtolower($attr_array[0]);
|
if (!$sort) $sort = strtolower($attr_array[0]);
|
||||||
|
if ($sort != "dn") {
|
||||||
|
// sort by first attribute with name $sort
|
||||||
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
||||||
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($a[$sort] == $b[$sort]) return 0;
|
||||||
|
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save variables to session
|
// save variables to session
|
||||||
|
|
|
@ -355,11 +355,19 @@ function cmp_array($a, $b) {
|
||||||
// sort specifies the sort column
|
// sort specifies the sort column
|
||||||
global $sort;
|
global $sort;
|
||||||
global $attr_array;
|
global $attr_array;
|
||||||
// sort by first attribute with name $sort
|
// sort by first column if no attribute is given
|
||||||
if (!$sort) $sort = strtolower($attr_array[0]);
|
if (!$sort) $sort = strtolower($attr_array[0]);
|
||||||
|
if ($sort != "dn") {
|
||||||
|
// sort by first attribute with name $sort
|
||||||
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
if ($a[$sort][0] == $b[$sort][0]) return 0;
|
||||||
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
else if ($a[$sort][0] == max($a[$sort][0], $b[$sort][0])) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($a[$sort] == $b[$sort]) return 0;
|
||||||
|
else if ($a[$sort] == max($a[$sort], $b[$sort])) return 1;
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save variables to session
|
// save variables to session
|
||||||
|
|
|
@ -420,9 +420,17 @@ function cmp_array($a, $b) {
|
||||||
global $attr_array;
|
global $attr_array;
|
||||||
// sort by first attribute with name $sortattrib
|
// sort by first attribute with name $sortattrib
|
||||||
if (!$sortattrib) $sortattrib = strtolower($attr_array[0]);
|
if (!$sortattrib) $sortattrib = strtolower($attr_array[0]);
|
||||||
|
if ($sortattrib != "dn") {
|
||||||
|
// sort by first column if no attribute is given
|
||||||
if ($a[$sortattrib][0] == $b[$sortattrib][0]) return 0;
|
if ($a[$sortattrib][0] == $b[$sortattrib][0]) return 0;
|
||||||
else if ($a[$sortattrib][0] == max($a[$sortattrib][0], $b[$sortattrib][0])) return 1;
|
else if ($a[$sortattrib][0] == max($a[$sortattrib][0], $b[$sortattrib][0])) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($a[$sortattrib] == $b[$sortattrib]) return 0;
|
||||||
|
else if ($a[$sortattrib] == max($a[$sortattrib], $b[$sortattrib])) return 1;
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save variables to session
|
// save variables to session
|
||||||
|
|
Loading…
Reference in New Issue