diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-06-17 21:47:15 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-06-17 21:47:15 +0200 |
commit | 46a771d2e6261fae20f2bcadb2355c05954920d4 (patch) | |
tree | bc47d89aea0691cb83245fbf405f3fc6e94607fd /apps/contacts/ajax | |
parent | fb700de4a40432f26209911548045390a10499b8 (diff) | |
download | nextcloud-server-46a771d2e6261fae20f2bcadb2355c05954920d4.tar.gz nextcloud-server-46a771d2e6261fae20f2bcadb2355c05954920d4.zip |
Sort addressbooks.
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r-- | apps/contacts/ajax/contacts.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php index 773f027dc64..beed3f05d5d 100644 --- a/apps/contacts/ajax/contacts.php +++ b/apps/contacts/ajax/contacts.php @@ -6,6 +6,13 @@ * See the COPYING-README file. */ +function cmp($a, $b) +{ + if ($a['displayname'] == $b['displayname']) { + return 0; + } + return ($a['displayname'] < $b['displayname']) ? -1 : 1; +} OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); @@ -39,6 +46,8 @@ foreach($contacts_addressbook as $addressbook_id => $contacts) { } } +usort($contacts_addressbook, 'cmp'); + $tmpl = new OCP\Template("contacts", "part.contacts"); $tmpl->assign('books', $contacts_addressbook, false); $page = $tmpl->fetchPage(); |