Changed SQL queries for looking up contacts to only query once and sort at the same time.

This commit is contained in:
Thomas Tanghus 2012-01-02 20:24:05 +01:00
parent 5e40653713
commit d91a4fcaf3
3 changed files with 0 additions and 33 deletions

View file

@ -61,6 +61,5 @@ foreach( $add as $propname){
$vcard->addProperty($propname, $value, $prop_parameters);
}
$id = OC_Contacts_VCard::add($aid,$vcard->serialize());
OC_Log::write('contacts','ajax/addcard.php - adding id: '.$id,OC_Log::DEBUG);
OC_Contacts_App::renderDetails($id, $vcard);

View file

@ -12,21 +12,6 @@ OC_JSON::checkAppEnabled('contacts');
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
$contacts = OC_Contacts_VCard::all($ids);
//OC_Log::write('contacts','contacts.php: '.count($contacts).' contacts.',OC_Log::DEBUG);
/*
$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser());
$contacts = array();
foreach( $addressbooks as $addressbook ){
$addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']);
foreach( $addressbookcontacts as $contact ){
if(is_null($contact['fullname'])){
continue;
}
$contacts[] = $contact;
}
}
usort($contacts,'contacts_namesort');
*/
$tmpl = new OC_TEMPLATE("contacts", "part.contacts");
$tmpl->assign('contacts', $contacts);
$page = $tmpl->fetchPage();

View file

@ -42,23 +42,6 @@ OC_App::setActiveNavigationEntry( 'contacts_index' );
// Load a specific user?
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
/*
// sort addressbooks (use contactsort)
usort($addressbooks,'contacts_namesort');
$contacts = array();
foreach( $addressbooks as $addressbook ){
$addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']);
foreach( $addressbookcontacts as $contact ){
if(is_null($contact['fullname'])){
continue;
}
$contacts[] = $contact;
}
}
usort($contacts,'contacts_namesort');
*/
$details = array();
// FIXME: This cannot work..?