<?php
/**
 *
 * Bond search form
 *
 * @author Moises Heberle [moises@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]
 *
 * @since
 * Class created on 06/08/2008
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2008 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 FrmBondSearch extends GnutecaForm
{
    public function __construct()
    {
        $this->setAllFunctions('Bond');
        $this->setGrid('GrdBond', 'personIdS');
        parent::__construct();
        if ( $this->primeiroAcessoAoForm() && strlen(MIOLO::_REQUEST('event')) == 0 )
        {
       	    $this->setFocus('personIdS');
        }
    }


    public function createFields()
    {
        $personLabel = new MLabel (_M('Person code',$this->module));
        $personLabel->width = FIELD_LABEL_SIZE;
        $personIdS = new MLookupTextField ('personIdS','','', FIELD_LOOKUPFIELD_SIZE);
        $personIdS->setContext($this->module, $this->module, 'Person', 'filler', 'personIdS,personIdName');
        $personIdName = new MTextField ('personIdName','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $personIdName->setReadOnly(true);
        $personCont = new MHcontainer('personCont', array ($personLabel, $personIdS, $personIdName));
        $fields[] = $personCont;

        $linkLabel = new MLabel (_M('User group code',$this->module));
        $linkLabel->width = FIELD_LABEL_SIZE;
        $linkIdS = new MLookupTextField ('linkIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $linkIdS->setContext($this->module, $this->module, 'link', 'filler', 'linkIdS,linkIdName');
        $linkIdName = new MTextField ('linkIdName','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $linkIdName->setReadOnly(true);
        $linkCont = new MHcontainer('linkCont', array ($linkLabel, $linkIdS, $linkIdName));
        $fields[] = $linkCont;

        $lblDate             = new MLabel(_M('Date validate', $this->module) . ':');
        $lblDate->setWidth(FIELD_LABEL_SIZE);
        $beginDateValidateS     = new MCalendarField('beginDateValidateS', $this->beginDateValidateS->value, null, FIELD_DATE_SIZE, null, 'calendar-win2k-1');
        $endDateValidateS       = new MCalendarField('endDateValidateS', $this->endDateValidateS->value, null, FIELD_DATE_SIZE, null, 'calendar-win2k-1');
        $fields[] = new MHContainer('hctDates', array($lblDate, $beginDateValidateS, $endDateValidateS));
        $validators[] = new MDateDMYValidator('beginDateValidateS');

        $this->setFields($fields);
        $this->setValidators($validators);
    }
}
?>
