protected function _cmp(Turba_Object $a, Turba_Object $b)
{
foreach ($this->_usortCriteria as $field) {
$f = $field['field'];
switch ($field['sortmethod']) {
case 'int':
$result = $a->getValue($f) > $b->getValue($f) ? 1 : -1;
break;
case 'text':
if (!isset($a->sortValue[$f])) {
$a->sortValue[$f] = Horde_String::lower($a->getValue($f), true, 'UTF-8');
}
if (!isset($b->sortValue[$f])) {
$b->sortValue[$f] = Horde_String::lower($b->getValue($f), true, 'UTF-8');
}
// Use strcoll for locale-safe comparisons.
$result = strcoll($a->sortValue[$f], $b->sortValue[$f]);
break;
}
if ($result != 0) {
return ($field['ascending'] ? 1 : -1) * $result;
}
}
return 0;
}