<?php
/**
 * Policy 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 04/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 FrmPolicySearch extends GnutecaForm
{
    public $businessPrevilegeGroup;

    public function __construct()
    {
        $this->setAllFunctions('Policy', array('privilegeGroupIdS','descriptionS') );
        $this->businessPrevilegeGroup = MIOLO::getInstance()->getBusiness( MIOLO::getCurrentModule() , 'BusPrivilegeGroup');
        parent::__construct();
        if ( $this->primeiroAcessoAoForm() && strlen(MIOLO::_REQUEST('event')) == 0 )
        {
            $this->setFocus('privilegeGroupIdS');
        }
    }


    public function createFields()
    {
        $privilegeGroupIdS = new GnutecaSelection('privilegeGroupIdS', $this->privilegeGroupIdS->value, _M('Privilege group',$this->module), $this->businessPrevilegeGroup->listPrivilegeGroup());
        $fields[] = $privilegeGroupIdS;

        $linkIdLabelS = new MLabel (_M('Link code:',$this->module));
        $linkIdLabelS->width = FIELD_LABEL_SIZE;
        $linkIdS = new MLookupTextField ('linkIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $linkIdS->setContext($this->module, $this->module, 'Link', 'filler', 'linkIdS,linkIdDescriptionS');
        $linkIdS->baseModule = 'gnuteca3';
        $linkIdDescriptionS = new MTextField ('linkIdDescriptionS','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $linkIdDescriptionS->setReadOnly(true);
        $linkIdContainerS = new MHcontainer('linkIdContainerS', array ($linkIdLabelS, $linkIdS, $linkIdDescriptionS,));
        $fields[] = $linkIdContainerS;

        $materialGenderIdLabelS = new MLabel (_M('Material gender code',$this->module));
        $materialGenderIdLabelS->width = FIELD_LABEL_SIZE;
        $materialGenderIdLabelS->baseModule = 'gnuteca3';
        $materialGenderIdS = new MLookupTextField ('materialGenderIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $materialGenderIdS->setContext($this->module, $this->module, 'materialGender', 'filler', 'materialGenderIdS,materialGenderIdDescriptionS');
        $materialGenderIdDescriptionS = new MTextField ('materialGenderIdDescriptionS','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $materialGenderIdDescriptionS->setReadOnly(true);
        $materialGenderIdContainerS = new MHcontainer('materialGenderIdContainerS', array ($materialGenderIdLabelS, $materialGenderIdS, $materialGenderIdDescriptionS,));
        $fields[] = $materialGenderIdContainerS;

        $lblDate             = new MLabel(_M('Loan date', $this->module) . ':');
        $lblDate->setWidth(FIELD_LABEL_SIZE);
        $beginLoanDateS     = new MCalendarField('beginLoanDateS', $this->beginLoanDateS->value, null, FIELD_DATE_SIZE, null, 'calendar-win2k-1');
        $endLoanDateS       = new MCalendarField('endLoanDateS', $this->endLoanDateS->value, null, FIELD_DATE_SIZE, null, 'calendar-win2k-1');
        $fields[] = new MHContainer('hctDates', array($lblDate, $beginLoanDateS, $endLoanDateS));

        $loanDaysS = new MTextField('loanDaysS', $this->loanDays->value, _M('Days of loan',$this->module), FIELD_ID_SIZE);
        $fields[] = $loanDaysS;

        $loanLimitS = new MTextField('loanLimitS', $this->loanLimit->value, _M('Limit of loan',$this->module), FIELD_ID_SIZE);
        $fields[] = $loanLimitS;

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