1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Sort addressbooks.

This commit is contained in:
Thomas Tanghus 2012-06-17 21:47:15 +02:00
parent 53365e4b48
commit 085be8dc4b

View File

@ -6,6 +6,13 @@
* See the COPYING-README file. * 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::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts'); 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 = new OCP\Template("contacts", "part.contacts");
$tmpl->assign('books', $contacts_addressbook, false); $tmpl->assign('books', $contacts_addressbook, false);
$page = $tmpl->fetchPage(); $page = $tmpl->fetchPage();