<?php
/**
 * SearchFormat 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 28/11/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
 */


/**
 * Form to manipulate a preference
 **/
class FrmRulesToCompleteFieldsMarc extends GnutecaForm
{
	public $busMarcTagListingOption;
	
	
    public function __construct()
    {
    	global $MIOLO, $module;
    	$this->busMarcTagListingOption = $MIOLO->getBusiness($module, 'BusMarcTagListingOption');
        $this->setAllFunctions('RulesToCompleteFieldsMarc', null, array('rulesToCompleteFieldsMarcId'), array('category', 'affectRecordsCompleted'));
        parent::__construct();
       	$this->setFocus('category');    
    }


    public function createFields()
    {
        if ( $this->function == 'update' )
        {
            $rulesToCompleteFieldsMarcId = new MTextField('rulesToCompleteFieldsMarcId', null, _M('Code', $this->module), FIELD_ID_SIZE);
            $rulesToCompleteFieldsMarcId->setReadOnly(TRUE);
            $fields[] = $rulesToCompleteFieldsMarcId;
            $validators[] = new MRequiredValidator('rulesToCompleteFieldsMarcId');
        }

        $fields[] = new GnutecaSelection('category', null, _M('Category', $this->module), $this->busMarcTagListingOption->listMarcTagListingOption('CATEGORY'));
        $validators[] = new MRequiredValidator('category');
        $fields[] = new MMultiLineField('originField', null, _M('Origin field', $this->module), null, FIELD_MULTILINE_ROWS_SIZE, FIELD_MULTILINE_COLS_SIZE);
        $validators[] = new MRequiredValidator('originField');
        $fields[] = new MMultiLineField('fateField', null, _M('Fate field', $this->module), null, FIELD_MULTILINE_ROWS_SIZE, FIELD_MULTILINE_COLS_SIZE);
        $validators[] = new MRequiredValidator('fateField');
        
        $lbl = new MLabel(_M('Affected records completed', $this->module) . ':');
        $lbl->setWidth(FIELD_LABEL_SIZE);
        $affectRecordsCompleted = new MRadioButtonGroup('affectRecordsCompleted', null, GnutecaUtils::listYesNo(1), 'f', null, MRadioButtonGroup::LAYOUT_HORIZONTAL);
        $fields[] = new MHContainer('hctAffectRecordsCompleted', array($lbl, $affectRecordsCompleted));
        
        $this->setFields($fields);
        $this->setValidators($validators);
    }
}
?>
