<?php
/**
 *
 * Class Layout form
 *
 * @author Luiz Gilberto Gregory Filho [luiz@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 13/08/08
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2007 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 FrmExemplaryStatus extends GnutecaForm
{
    function __construct()
    {
        $this->setAllFunctions('ExemplaryStatus', null, array('exemplaryStatusId'), array('exemplaryStatusId','description') );
        parent::__construct();
        $this->setFocus('description');
    }


    public function createFields()
    {
        $fields[] = new MTextField("description",                    $this->description->value,                  _M("Description",                       $this->module), FIELD_DESCRIPTION_SIZE);
        $fields[] = new MTextField("mask",                           $this->mask->value,                         _M("Mask",                              $this->module), FIELD_DESCRIPTION_SIZE);
        $fields[] = new GnutecaSelection('level',                          $this->level->value,                        _M("Level",                             $this->module), array(1 => _M("Initial", $this->module), 2 => _M("Transition", $this->module)), null, null, null, TRUE);
        $validators[] = new MRequiredValidator('level');

        $lbl = new MLabel(_M('Execute loan', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $executeLoan = new MRadioButtonGroup('executeLoan', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctExecuteLoan', array($lbl, $executeLoan));

        $lbl = new MLabel(_M('Momentary loan', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $momentaryLoan = new MRadioButtonGroup('momentaryLoan', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctMomentaryLoan', array($lbl, $momentaryLoan));

        $fields[] = new MTextField("daysOfMomentaryLoan",            $this->daysOfMomentaryLoan->value,          _M("Days of momentary loan",            $this->module), FIELD_ID_SIZE);

        $lbl = new MLabel(_M('Execute reserve', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $executeReserve = new MRadioButtonGroup('executeReserve', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctExecuteReserve', array($lbl, $executeReserve));

        $lbl = new MLabel(_M('Execute reserve in initial level', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $executeReserveInInitialLevel = new MRadioButtonGroup('executeReserveInInitialLevel', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctExecuteReserveInInitialLevel', array($lbl, $executeReserveInInitialLevel));

        $lbl = new MLabel(_M('Meet reserve', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $meetReserve = new MRadioButtonGroup('meetReserve', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctMeetReserve', array($lbl, $meetReserve));

        $lbl = new MLabel(_M('Is reserve status', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $isReserveStatus = new MRadioButtonGroup('isReserveStatus', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctIsReserveStatus', array($lbl, $isReserveStatus));

        $lbl = new MLabel(_M('Is low status', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $isLowStatus = new MRadioButtonGroup('isLowStatus', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctIsLowStatus', array($lbl, $isLowStatus));


        $lbl = new MLabel(_M('Schedule interchange status for request', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $scheduleChangeStatusForRequest = new MRadioButtonGroup('scheduleChangeStatusForRequest', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctScheduleChangeStatusForRequest', array($lbl, $scheduleChangeStatusForRequest));


        $fields[] = new MMultiLIneField  ("observation", $this->observation->value,  _M("Observation",   $this->module), null, FIELD_MULTILINE_ROWS_SIZE, FIELD_MULTILINE_COLS_SIZE);


        if($this->function == 'update')
        {
            $fields[] = new MHiddenField('exemplaryStatusId', MIOLO::_REQUEST('exemplaryStatusId'));
        }

        // set Search Form Fileds
        $this->setFields( $fields );
        $validators[] = new MRequiredValidator  ("description", _M("Description",   $this->module) );
        $this->setValidators($validators);
    }
}
?>
