<?php
/**
 * Group right 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 01/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 FrmGroupRightSearch extends GnutecaForm
{
    public $module;
    public $businessPrivilegeGroup;
    public $businessOperation;
    public $businessMaterialGender;
    public $businessUserGroup;

    public function __construct()
    {
        $this->module = MIOLO::getCurrentModule();
        $this->businessPrivilegeGroup = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusPrivilegeGroup');
        $this->businessOperation = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusOperation');
        $this->businessMaterialGender = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusMaterialGender');
        $this->businessUserGroup = MIOLO::getInstance()->getBusiness(MIOLO::getCurrentModule(), 'BusUserGroup');
        $this->setAllFunctions('Right', array('privilegeGroupIdS','linkIdS, materialGenderIdS') );
        $this->setGrid('GrdGroupRight');
        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->businessPrivilegeGroup->listPrivilegeGroup());
        $fields[] = $privilegeGroupIdS;

      /*  $linkLabel = new MLabel (_M('Link code', $this->module) . ':');
        $linkLabel->width = FIELD_LABEL_SIZE;
        $linkIdS = new MLookupTextField('linkIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $linkIdS->setContext($this->module, $this->module, 'link', 'filler', 'linkIdS,linkDescription');
        $linkIdS->baseModule = $this->module;
        $linkIdSName = new MTextField ('linkDescription','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $linkIdSName->setReadOnly(true);
        $linkCont = new MHcontainer('linkCont', array ($linkLabel, $linkIdS, $linkIdSName));
        $fields[] = $linkCont;*/
        $linkId = new GnutecaSelection('linkIdS', $this->linkId->value, _M('Link code',$this->module), $this->businessUserGroup->listUserGroup());
        $fields[] = $linkId;
        $this->setFields( $fields );

      /*  $materialGenderLabel = new MLabel (_M('Material gender code', $this->module) . ':');
        $materialGenderLabel->width = FIELD_LABEL_SIZE;
        $materialGenderIdS = new MLookupTextField ('materialGenderIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $materialGenderIdS->setContext($this->module, $this->module, 'materialGender', 'filler', 'materialGenderIdS,materialGenderDescription');
        $materialGenderIdS->baseModule = $this->module;
        $materialGenderIdSName = new MTextField ('materialGenderDescription','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $materialGenderIdSName->setReadOnly(true);
        $materialGenderCont = new MHcontainer('materialGenderCont', array ($materialGenderLabel, $materialGenderIdS, $materialGenderIdSName));
        $fields[] = $materialGenderCont;*/
        $materialGenderId = new GnutecaSelection('materialGenderIdS', $this->materialGenderId->value, _M('Material gender code',$this->module), $this->businessMaterialGender->listMaterialGender());
        $fields[] = $materialGenderId;
        $this->setFields( $fields );

    /*    $operationLabel = new MLabel (_M('Operation code',$this->module) . ':');
        $operationLabel->width = FIELD_LABEL_SIZE;
        $operationIdS = new MLookupTextField ('operationIdS','','',FIELD_LOOKUPFIELD_SIZE);
        $operationIdS->setContext($this->module, $this->module, 'operation', 'filler', 'operationIdS,operationDescription');
        $operationIdS->baseModule = $this->module;
        $operationIdSName = new MTextField ('operationDescription','',null, FIELD_DESCRIPTION_LOOKUP_SIZE);
        $operationIdSName->setReadOnly(true);
        $operationCont = new MHcontainer('operationCont', array ($operationLabel, $operationIdS, $operationIdSName));
        $fields[] = $operationCont;*/
        $operationId = new GnutecaSelection('operationIdS', $this->operationId->value, _M('Operation code',$this->module), $this->businessOperation->listOperation());
        $fields[] = $operationId;
        $this->setFields( $fields );
    }
}
?>
