<?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 28/jul/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 FrmLabelLayout extends GnutecaForm
{
    public function __construct()
    {
        $this->setAllFunctions('LabelLayout', null, 'labelLayoutId', array('description'));
        parent::__construct();
        $this->setFocus('description');
    }


    public function createFields()
    {
        $fields[] = new MTextField("description", null, _M("Description", $this->module), FIELD_DESCRIPTION_SIZE);
 //       $fields[] = new MTextField("topMargin", null, _M("Top margin", $this->module), FIELD_ID_SIZE);

        $lblTopMargin = new MLabel(_M('Top margin', $this->module) . ':');
        $lblTopMargin->setWidth(FIELD_LABEL_SIZE);
        $topMargin    = new MTextField('topMargin', $this->topMargin->value, null, FIELD_ID_SIZE);
        $lblAjuda     = new MLabel(_M('Utilize ponto para separar casas decimais', $this->module) );
        $fields[]     = new MHContainer('hctTopMargin', array($lblTopMargin, $topMargin, $lblAjuda));

        $fields[] = new MTextField("leftMargin", null, _M("Left margin", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("verticalSpacing", null, _M("Vertical spacing", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("horizontalSpacing", null, _M("Horizontal spacing", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("height", null, _M("Height", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("width_", null, _M("Width", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("lines", null, _M("Lines", $this->module), FIELD_ID_SIZE);
        $fields[] = new MTextField("columns_", null, _M("Columns", $this->module), FIELD_ID_SIZE);
        $fields[] = new GnutecaSelection("pageFormat", null, _M("Page format", $this->module), GnutecaUtils::getPageFormats());

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

        $validators[] = new MRequiredValidator('description');
        $validators[] = new MFloatValidator("topMargin", null, '.', null, 'required');
        $validators[] = new MFloatValidator("leftMargin", null, '.', null, 'required');
        $validators[] = new MFloatValidator("verticalSpacing", null, '.', null, 'required');
        $validators[] = new MFloatValidator("horizontalSpacing", null, '.', null, 'required');
        $validators[] = new MFloatValidator("height", null, '.', null, 'required');
        $validators[] = new MFloatValidator("width_", null, '.', null, 'required');
        $validators[] = new MFloatValidator("lines", null, '.', null, 'required');
        $validators[] = new MFloatValidator("columns_", null, '.', null, 'required');

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