<?php
/**
 *
 * ExemplaryFutureStatusDefined 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]
 * Sandro Roberto Weisheimer [sandrow@solis.coop.br]
 *
 * @since
 * Class created on 21/10/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 FrmExemplaryFutureStatusDefinedSearch extends GnutecaForm
{
    public $busExemplaryStatus;
    public $busLibraryUnit;


    public function __construct()
    {
        $MIOLO  = MIOLO::getInstance();
        $module = MIOLO::getCurrentModule();
        $this->busExemplaryStatus = $MIOLO->getBusiness($module, 'BusExemplaryStatus');
        $this->busLibraryUnit     = $MIOLO->getBusiness($module, 'BusLibraryUnit');
        $this->setAllFunctions('ExemplaryFutureStatusDefined', array('exemplaryStatusId'));
        parent::__construct();
        if ( $this->primeiroAcessoAoForm() && strlen(MIOLO::_REQUEST('event')) == 0 )
        {
            $this->setFocus('exemplaryFutureStatusDefinedIdS');
        }
    }


    public function createFields()
    {
        $exemplaryFutureStatusDefinedIdS = new MTextField('exemplaryFutureStatusDefinedIdS', $this->exemplaryFutureStatusDefinedIdS->value, _M('Code', $this->module), FIELD_ID_SIZE);
        $fields[] = $exemplaryFutureStatusDefinedIdS;
        $validators[] = new MIntegerValidator('exemplaryFutureStatusDefinedIdS');

        $fields[] = new GnutecaSelection('exemplaryStatusIdS', $this->exemplaryStatusIdS->value, _M('Exemplary status', $this->module), $this->busExemplaryStatus->listExemplaryStatus());

        $this->busLibraryUnit->filterOperator = TRUE;
        $this->busLibraryUnit->labelAllLibrary = TRUE;
        $fields[] = new GnutecaSelection('libraryUnitIdS',   $this->libraryUnitId->value, _M('Library unit', $this->module), $this->busLibraryUnit->listLibraryUnit(), null, null, null, TRUE);

        $itemNumberS = new MTextField('itemNumberS', $this->itemNumberS->value, _M('Item number', $this->module), FIELD_ID_SIZE);
        $fields[] = $itemNumberS;

        $fields[] = new GnutecaSelection('appliedS', $this->appliedS->value, _M('Applied', $this->module), GnutecaUtils::getYesNo());

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

        $operatorS = new MTextField('operatorS', $this->operatorS->value, _M('Operator', $this->module), 30);
        $fields[] = $operatorS;

        $observationS = new MTextField('observationS', $this->observationS->value, _M('Observation', $this->module), 30);
        $fields[] = $observationS;

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