Note Submitter: topvic at mail dot ru
----
// Fixed ldap_multi_sort
//
function ldap_multi_sort(&$entries, $attribs)
{
for ($i=1; $i<$entries['count']; $i++)
{
$index = $entries[$i];
$j = $i;
do {
$a = $b = "";
foreach ($attribs as $attrib)
{
$a .= (isSet($entries[$j-1][$attrib][0]) ? $entries[$j-1][$attrib][0] : " ");
$b .= (isSet($index[$attrib][0]) ? $index[$attrib][0] : " ");
}
// do the comparison
if ($a > $b)
{
$is_greater = true;
$entries[$j] = $entries[$j-1];
$j = $j - 1;
} else {
$is_greater = false;
}
} while ($j > 0 AND $is_greater);
$entries[$j] = $index;
}
return $entries;
}
// Example
//
$info = ldap_multi_sort($info, array('department', 'displayname'));
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.