Re: [api] $registry->contacts->search

Michael J Rubinsky <[email protected]>
Newsgroups gmane.comp.horde.turba
Message-ID <20130914110657.Horde.xCm-b4HtA-LdyXTM2cTcCw9@h4.theupstairsroom.com>
Quoting Jonah Dekeyzer <[email protected]>:

> I want to make use of the turba API in order to search for items in  
> my adresbook in an own module 'advocaat'.
>
> Turba has an adresbook with the sourcename 'advocaat' with several contacts.
>
> When I use the contacts->search api I get en empty result, even  
> looking for 'a' .
>
> My php-file looks like this:
> <?php
> require_once __DIR__ . '/../lib/Application.php';
> Horde_Registry::appInit('advocaat');
> $term = $_GET['term'];
> $args = array('sources' => array('advocaat'),
>               'names' => array('a'),
>               );
>
> $cns = $registry->contacts->search($args);
>
>
> Has my code an error?

1) What is $term? It's not used anywhere.
2) Related to 1, you are not passing the search term correctly.

It should be something like this:

$registry->contacts->search($search_term, array('fields' =>  
array('fields', 'to', 'search'), 'sources' => array('advocaat')));

You should look at turba/lib/Api.php Turba_Api::search() for all the  
options and the method signature.
-- 
mike

The Horde Project (www.horde.org)
[email protected]

-- 
turba mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
smime.p7s (application/pkcs7-signature, 5.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.