Hermes::listClients PHP Method

listClients() public static method

Returns a list of available clients.
public static listClients ( string $name = '' ) : array
$name string The string to search for in the client name.
return array A hash of client_id => client_name.
    public static function listClients($name = '')
    {
        if (isset(self::$_clients[$name])) {
            return self::$_clients[$name];
        }
        self::$_clients[$name] = array();
        try {
            $result = $GLOBALS['registry']->clients->searchClients(array($name), array('name'), true);
        } catch (Horde_Exception $e) {
            Horde::log($e, 'WARN');
            return self::$_clients[$name];
        }
        if (!empty($result)) {
            $result = $result[$name];
            foreach ($result as $client) {
                self::$_clients[$name][$client['id']] = $client[$GLOBALS['conf']['client']['field']];
            }
        }
        uasort(self::$_clients[$name], 'strcoll');
        return self::$_clients[$name];
    }

Usage Example

Beispiel #1
0
 public function getClientsType()
 {
     try {
         $clients = Hermes::listClients();
     } catch (Exception $e) {
         return array('invalid', array(sprintf(_("An error occurred listing clients: %s"), $e->getMessage())));
     }
     $clients = array('' => _("- - None - -")) + $clients;
     return array('multienum', array($clients));
 }
All Usage Examples Of Hermes::listClients