"sort users/groups by account_display pref"

This commit is contained in:
Ralf Becker 2008-08-09 04:43:31 +00:00
parent 666e6793a7
commit 785189d884

View File

@ -114,17 +114,34 @@ class ui_acl
function selectlist($right,$users_only=false) function selectlist($right,$users_only=false)
{ {
foreach ($GLOBALS['egw']->accounts->get_list() as $num => $account) switch($GLOBALS['egw_info']['user']['preferences']['common']['account_display'])
{ {
if(!($users_only && $account['account_lastname'] == 'Group')) case 'firstname':
case 'firstall':
$order = 'n_given,n_family';
break;
case 'lastall':
case 'lastname':
$order = 'n_family,n_given';
break;
default:
$order = 'account_lid,n_family,n_given';
break;
}
foreach ($GLOBALS['egw']->accounts->search(array(
'type' => 'both',
'order' => $order,
)) as $num => $account)
{
if(!($users_only && $account['account_type'] == 'g'))
{ {
$selectlist .= '<option value="' . $account['account_id'] . '"'; $selectlist .= '<option value="' . $account['account_id'] . '"';
if($this->rights[$account['account_id']] & $right) if($this->rights[$account['account_id']] & $right)
{ {
$selectlist .= ' selected="selected"'; $selectlist .= ' selected="selected"';
} }
$selectlist .= '>' . $account['account_firstname'] . ' ' . $account['account_lastname'] $selectlist .= '>' . $GLOBALS['egw']->common->display_fullname($account['account_lid'],$account['account_firstname'],
. ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n"; $account['account_lastname'],$account['account_id']) . '</option>' . "\n";
} }
} }
return $selectlist; return $selectlist;