diff --git a/appinfo/app.php b/appinfo/app.php index 524cc640..1e9f8811 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -1,4 +1,5 @@ 10, 'href' => OC_Helper::linkTo( 'contacts', 'index.php' ), 'icon' => OC_Helper::imagePath( 'settings', 'users.svg' ), - 'name' => 'Contacts' )); + 'name' => $l->t('Contacts') )); OC_APP::registerPersonal('contacts','settings'); +require_once('apps/contacts/lib/search.php'); \ No newline at end of file diff --git a/lib/search.php b/lib/search.php new file mode 100644 index 00000000..97638821 --- /dev/null +++ b/lib/search.php @@ -0,0 +1,29 @@ + 0){ + $searchquery = explode(' ', $query); + }else{ + $searchquery[] = $query; + } + $l = new OC_l10n('contacts'); + foreach($addressbooks as $addressbook){ + $vcards = OC_Contacts_VCard::all($addressbook['id']); + foreach($vcards as $vcard){ + if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){ + $link = OC_Helper::linkTo('apps/contacts', 'index.php?id='.urlencode($vcard['id'])); + $results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type + } + } + } + return $results; + } +} +new OC_Search_Provider_Contacts();