summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-06-17 21:47:15 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-06-17 21:47:15 +0200
commit46a771d2e6261fae20f2bcadb2355c05954920d4 (patch)
treebc47d89aea0691cb83245fbf405f3fc6e94607fd /apps/contacts/ajax
parentfb700de4a40432f26209911548045390a10499b8 (diff)
downloadnextcloud-server-46a771d2e6261fae20f2bcadb2355c05954920d4.tar.gz
nextcloud-server-46a771d2e6261fae20f2bcadb2355c05954920d4.zip
Sort addressbooks.
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r--apps/contacts/ajax/contacts.php9
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();