<?php
/**
 * UserGroup 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 29/07/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 FrmUserGroup extends GnutecaForm
{
    function __construct()
    {
        $this->setAllFunctions('UserGroup', array('linkIdS','descriptionS'), 'linkId', 'description');
        parent::__construct();
        $this->setFocus('description');
    }


    public function createFields()
    {
        if($this->function != 'insert')
        {
            $linkId = new MTextField('linkId', $this->linkId->value, _M('Code', $this->module), FIELD_ID_SIZE);
            $linkId->setReadOnly(true);
            $fields[] = $linkId;
        }

        $description = new MTextField('description', $this->description->value, _M('Description',$this->module), FIELD_DESCRIPTION_SIZE);
        $fields[] = $description;
        $validators[] = new MRequiredValidator('description');

        $level = new MTextField('level', $this->level->value, _M('Level',$this->module), FIELD_ID_SIZE);
        $fields[] = $level;
        $validators[] = new MIntegerValidator('level', null, 'required');

        // isVisibleToPerson
        $lbl = new MLabel( _M('Is visible to person', $this->module) . ':' );
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $isVisibleToPerson = new MRadioButtonGroup('isVisibleToPerson', null, GnutecaUtils::listYesNo(1), null, null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctIVTP', array($lbl, $isVisibleToPerson));

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