$friendspicker = $vars['friendspicker']; } $users = array(); $activeletters = array(); // Are we displaying form tags and submit buttons? // (If we've been given a target, then yes! Otherwise, no.) if (isset($vars['formtarget'])) { $formtarget = $vars['formtarget']; } else { $formtarget = false; } // Sort users by letter if (is_array($friends) && sizeof($friends)) { foreach ($friends as $friend) { $letter = elgg_substr($friend->name, 0, 1); $letter = elgg_strtoupper($letter); if (!elgg_substr_count($chararray, $letter)) { $letter = "*"; } if (!isset($users[$letter])) { $users[$letter] = array(); } $users[$letter][$friend->guid] = $friend; } } if (!$callback) { ?> <div class="friends-picker-main-wrapper"> <?php
} else { $friendspicker = $vars['friendspicker']; } $users = array(); $activeletters = array(); // Are we displaying form tags and submit buttons? // (If we've been given a target, then yes! Otherwise, no.) if (isset($vars['formtarget'])) { $formtarget = $vars['formtarget']; } else { $formtarget = false; } // Sort users by letter if (is_array($vars['entities']) && sizeof($vars['entities'])) { foreach ($vars['entities'] as $user) { $letter = elgg_strtoupper(elgg_substr($user->name, 0, 1)); if (!elgg_substr_count($chararray, $letter)) { $letter = "*"; } if (!isset($users[$letter])) { $users[$letter] = array(); } $users[$letter][$user->guid] = $user; } } // sort users in letters alphabetically foreach ($users as $letter => $letter_users) { usort($letter_users, create_function('$a, $b', ' return strcasecmp($a->name, $b->name); ')); $users[$letter] = $letter_users;