<?php
/**
 * Z3950Servers business
 *
 * @author Sandro Roberto Weisheimer [sandrow@solis.coop.br]
 *
 * @version $Id$
 *
 * \b Maintainers \n
 * Eduardo Bonfandini [eduardo@solis.coop.br]
 * Jamiel Spezia [jamiel@solis.coop.br]
 * Luiz Gregory Filho [luiz@solis.coop.br]
 * Moises Heberle [moises@solis.coop.br]
 * Sandro Roberto Weisheimer [sandrow@solis.coop.br]
 *
 * @since
 * Class created on 05/05/2009
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2009 SOLIS - Cooperativa de Solucoes Livres \n
 *
 * \b License: \n
 * Licensed under GPL (for further details read the COPYING file or http://www.gnu.org/copyleft/gpl.html )
 *
 * \b History: \n
 * See history in SVN repository: http://gnuteca.solis.coop.br
 */
class BusinessGnuteca3BusZ3950Servers extends GnutecaBusiness
{
    public $serverId;
    public $description;
    public $host;
    public $recordType;
    public $userName;
    public $password;
    public $country;

    public $pkeys;
    public $cols;
    public $columns;
    public $table;


    public function __construct()
    {

    	$this->table = 'gtcZ3950Servers';
    	$this->pkeys = 'serverId';
    	$this->cols  = 'description,
                  host,
                  recordType,
                  sintax,
                  userName,
                  password,
                  country';
        parent::__construct($this->table, $this->pkeys, $this->cols);
        $this->columns  = $this->pkeys . ',' . $this->cols;
    }


    public function listZ3950Servers()
    {
        $this->clear();
        return $this->autoList();
    }


    public function getServer($serverId)
    {
        parent::clear();
        parent::setColumns($this->columns);
        parent::setTables($this->tables);
        parent::setWhere("$this->pkeys = ?");
        $sql = parent::select(array($serverId));
        $r = parent::query($sql, true);
        return $r[0];
    }


    public function searchZ3950Servers($toObject = FALSE)
    {
        $filters = array(
            'serverId'         => 'equals',
            'description'      => 'ilike'
        );
        $this->clear();
        return $this->autoSearch($filters, $toObject);
    }
}
?>
