mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-14 03:54:29 +01:00
- if $selected is a string it gets now explode with ','
- already selected accounts are shown in front of users and groups, good for multiselections with less lines then content
This commit is contained in:
parent
7d74f12e84
commit
5a1be7c203
@ -69,7 +69,7 @@
|
|||||||
//echo "<p>uiaccountsel::selection('$name',".print_r($selected,True).",'$use',$lines,$not,'$options')</p>\n";
|
//echo "<p>uiaccountsel::selection('$name',".print_r($selected,True).",'$use',$lines,$not,'$options')</p>\n";
|
||||||
if (!is_array($selected))
|
if (!is_array($selected))
|
||||||
{
|
{
|
||||||
$selected = $selected ? array($selected) : array();
|
$selected = $selected ? explode(',',$selected) : array();
|
||||||
}
|
}
|
||||||
$account_sel = $this->account_selection;
|
$account_sel = $this->account_selection;
|
||||||
$app = False;
|
$app = False;
|
||||||
@ -125,7 +125,7 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$users = $groups = array();
|
$already_selected = $users = $groups = array();
|
||||||
$use_keys = count($select) && !isset($select[0]); // id's are the keys
|
$use_keys = count($select) && !isset($select[0]); // id's are the keys
|
||||||
foreach($select as $key => $val)
|
foreach($select as $key => $val)
|
||||||
{
|
{
|
||||||
@ -135,7 +135,11 @@
|
|||||||
{
|
{
|
||||||
continue; // dont display that one
|
continue; // dont display that one
|
||||||
}
|
}
|
||||||
if ($this->get_type($id) == 'u')
|
if (in_array($id,$selected)) // show already selected accounts first
|
||||||
|
{
|
||||||
|
$already_selected[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id);
|
||||||
|
}
|
||||||
|
elseif ($this->get_type($id) == 'u')
|
||||||
{
|
{
|
||||||
$users[$id] = !is_array($val) ? $GLOBALS['phpgw']->common->grab_owner_name($id) :
|
$users[$id] = !is_array($val) ? $GLOBALS['phpgw']->common->grab_owner_name($id) :
|
||||||
$GLOBALS['phpgw']->common->display_fullname(
|
$GLOBALS['phpgw']->common->display_fullname(
|
||||||
@ -147,9 +151,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort users and groups alphabeticaly and put the groups behind the users
|
// sort users and groups alphabeticaly and put the groups behind the users
|
||||||
|
uasort($already_selected,strcasecmp);
|
||||||
uasort($users,strcasecmp);
|
uasort($users,strcasecmp);
|
||||||
uasort($groups,strcasecmp);
|
uasort($groups,strcasecmp);
|
||||||
$select = $users + $groups;
|
$select = $already_selected + $users + $groups;
|
||||||
|
|
||||||
if (count($selected) && !isset($selected[0])) // id's are the keys
|
if (count($selected) && !isset($selected[0])) // id's are the keys
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user