getAddressbookSearchParams() public static method

Determines parameters needed to do an address search
public static getAddressbookSearchParams ( ) : array
return array An array with two keys: 'fields' and 'sources'.
Esempio n. 1
0
 /**
  */
 protected function _getAddressbookSearchParams()
 {
     $params = Kronolith::getAddressbookSearchParams();
     $ob = new stdClass();
     $ob->fields = $params['fields'];
     $ob->sources = $params['sources'];
     return $ob;
 }
Esempio n. 2
0
    exit;
}
/* Get the lists of address books through API */
$source_list = $registry->call('contacts/sources');
/* If we self-submitted, use that source. Otherwise, choose a good
 * source. */
$source = Horde_Util::getFormData('source');
if (empty($source) || !isset($source_list[$source])) {
    /* We don't just pass the second argument to getFormData() because
     * we want to trap for invalid sources, not just no source. */
    $source = key($source_list);
}
/* Get the search as submitted (defaults to '' which should list everyone). */
$search = Horde_Util::getFormData('search');
if ($search || $prefs->getValue('display_contact')) {
    $searchpref = Kronolith::getAddressbookSearchParams();
    $fields = isset($searchpref[$source]) ? array($source => $searchpref[$source]) : array();
    try {
        $results = $registry->call('contacts/search', array($search, array('fields' => $fields, 'sources' => array($source))));
    } catch (Exception $e) {
        $results = array();
    }
} else {
    $results = array();
}
/* The results list returns an array for each source searched - at least
   that's how it looks to me. Make it all one array instead. */
$addresses = array();
foreach ($results as $r) {
    $addresses = array_merge($addresses, $r);
}
Esempio n. 3
0
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     Horde_Core_Prefs_Ui_Widgets::addressbooksInit();
     $search = Kronolith::getAddressbookSearchParams();
     return Horde_Core_Prefs_Ui_Widgets::addressbooks(array('fields' => $search['fields'], 'sources' => $search['sources']));
 }