2011-12-11 19:26:00 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2012-04-17 21:31:29 +04:00
|
|
|
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('contacts');
|
2011-12-11 19:26:00 +04:00
|
|
|
|
2012-05-01 20:50:31 +04:00
|
|
|
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
|
2012-06-25 19:16:34 +04:00
|
|
|
$allcontacts = OC_Contacts_VCard::all($ids);
|
|
|
|
$contacts = array();
|
|
|
|
foreach($allcontacts as $contact) { // try to conserve some memory
|
|
|
|
$contacts[] = array('id' => $contact['id'], 'addressbookid' => $contact['addressbookid'], 'fullname' => $contact['fullname']);
|
|
|
|
}
|
|
|
|
unset($allcontacts);
|
|
|
|
$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
|
|
|
|
|
2012-05-07 01:00:36 +04:00
|
|
|
$tmpl = new OCP\Template("contacts", "part.contacts");
|
2011-12-11 19:26:00 +04:00
|
|
|
$tmpl->assign('contacts', $contacts);
|
|
|
|
$page = $tmpl->fetchPage();
|
|
|
|
|
2012-05-03 14:23:29 +04:00
|
|
|
OCP\JSON::success(array('data' => array( 'page' => $page )));
|
2011-12-11 19:26:00 +04:00
|
|
|
?>
|