<?

class Produto_Form_Validacoesvariedades extends Agro_Form {
	public $id;
	public $ds_nome_grupo_variedade;
	public $id_validacao_filtro;

	public function __construct($id=null) {
		$this->id_validacao_filtro = $id;
		parent::__construct(array());
	}
	
	public function init() {

		$this->id = $this->createElement('hidden', 'id');
		$this->id->setDecorators($this->buttonDecorator);
		$this->addElement($this->id);
		
		$this->id_validacao = $this->createElement('hidden', 'id_validacao');
		$this->id_validacao->setDecorators($this->buttonDecorator);
		$this->addElement($this->id_validacao);
		
		$this->ds_nome_grupo_variedade = $this->createElement('text', 'ds_nome_grupo_variedade');
		$this->ds_nome_grupo_variedade->setDecorators($this->elementDecorator);
		$this->ds_nome_grupo_variedade->setRequired(true);
		$this->ds_nome_grupo_variedade->setAttrib('size', '50');
		$this->ds_nome_grupo_variedade->setAttrib('maxlength', '40');
		$this->ds_nome_grupo_variedade->setLabel('Nome');
		$this->addElement($this->ds_nome_grupo_variedade);

		$this->ds_nome_grupo_portaenxerto = $this->createElement('text', 'ds_nome_grupo_portaenxerto');
		$this->ds_nome_grupo_portaenxerto->setDecorators($this->elementDecorator);
		$this->ds_nome_grupo_portaenxerto->setRequired(true);
		$this->ds_nome_grupo_portaenxerto->setAttrib('size', '50');
		$this->ds_nome_grupo_portaenxerto->setAttrib('maxlength', '40');
		$this->ds_nome_grupo_portaenxerto->setLabel('Nome');
		$this->addElement($this->ds_nome_grupo_portaenxerto);	

		$this->id_grupo_variedade = $this->createElement('select', 'id_grupo_variedade');
		$this->id_grupo_variedade->setDecorators($this->elementDecorator);
		$this->id_grupo_variedade->setRequired(true);
		$this->id_grupo_variedade->setLabel('Grupo de Variedades');
		$this->addElement($this->id_grupo_variedade);

        $this->id_grupo_portaenxerto = $this->createElement('select', 'id_grupo_portaenxerto');
        $this->id_grupo_portaenxerto->setDecorators($this->elementDecorator);
        $this->id_grupo_portaenxerto->setRequired(true);
        $this->id_grupo_portaenxerto->setLabel('Grupo de Portaenxerto');
        $this->addElement($this->id_grupo_portaenxerto);

        $this->id_grupo_portaenxerto_valores = $this->createElement('select', 'id_grupo_portaenxerto_valores');
        $this->id_grupo_portaenxerto_valores->setDecorators($this->elementDecorator);
        $this->id_grupo_portaenxerto_valores->setRequired(true);
        $this->id_grupo_portaenxerto_valores->setLabel('Grupo de Portaenxerto');
        $this->addElement($this->id_grupo_portaenxerto_valores);

        $this->id_grupo_densidade = $this->createElement('select', 'id_grupo_densidade');
        $this->id_grupo_densidade->setDecorators($this->elementDecorator);
        $this->id_grupo_densidade->setRequired(true);
        $this->id_grupo_densidade->setLabel('Grupo de Densidade');
        $this->addElement($this->id_grupo_densidade);

        $this->vl_densidade_minima = $this->createElement('text', 'vl_densidade_minima');
        $this->vl_densidade_minima->setDecorators($this->elementDecorator);
        $this->vl_densidade_minima->setRequired(true);
        $this->vl_densidade_minima->setAttrib('size', '20');
        $this->vl_densidade_minima->setAttrib('class', 'integer');
        $this->vl_densidade_minima->setAttrib('maxlength', '40');
        $this->vl_densidade_minima->setLabel('Densidade Mínima');
        $this->addElement($this->vl_densidade_minima);

        $this->vl_densidade_maxima = $this->createElement('text', 'vl_densidade_maxima');
        $this->vl_densidade_maxima->setDecorators($this->elementDecorator);
        $this->vl_densidade_maxima->setRequired(true);
        $this->vl_densidade_maxima->setAttrib('size', '20');
        $this->vl_densidade_maxima->setAttrib('class', 'integer');
        $this->vl_densidade_maxima->setAttrib('maxlength', '40');
        $this->vl_densidade_maxima->setLabel('Densidade Máxima');
        $this->addElement($this->vl_densidade_maxima);

        $this->ds_nome_grupo_densidade = $this->createElement('text', 'ds_nome_grupo_densidade');
        $this->ds_nome_grupo_densidade->setDecorators($this->elementDecorator);
        $this->ds_nome_grupo_densidade->setRequired(true);
        $this->ds_nome_grupo_densidade->setAttrib('size', '50');
        $this->ds_nome_grupo_densidade->setAttrib('maxlength', '40');
        $this->ds_nome_grupo_densidade->setLabel('Nome');
        $this->addElement($this->ds_nome_grupo_densidade);
		
  		$this->vl_minimo = $this->createElement('text', 'vl_minimo');
		$this->vl_minimo->setDecorators($this->elementDecorator);
		$this->vl_minimo->setRequired(true);
		$this->vl_minimo->setAttrib('size', '20');
		$this->vl_minimo->setAttrib('class', 'integer');
		$this->vl_minimo->setAttrib('maxlength', '40');
		$this->vl_minimo->setLabel('Valor Mínimo');
		$this->addElement($this->vl_minimo);
		
		$this->vl_maximo = $this->createElement('text', 'vl_maximo');
		$this->vl_maximo->setDecorators($this->elementDecorator);
		$this->vl_maximo->setRequired(true);
		$this->vl_maximo->setAttrib('size', '20');
		$this->vl_maximo->setAttrib('class', 'integer');
		$this->vl_maximo->setAttrib('maxlength', '40');
		$this->vl_maximo->setLabel('Valor Máximo');
		$this->addElement($this->vl_maximo);
  
  		$this->nu_idade = $this->createElement('text', 'nu_idade');
		$this->nu_idade->setDecorators($this->elementDecorator);
		$this->nu_idade->setRequired(true);
		$this->nu_idade->setAttrib('size', '20');
		$this->nu_idade->setAttrib('class', 'integer');
		$this->nu_idade->setAttrib('maxlength', '40');
		$this->nu_idade->setLabel('Idade');
		$this->addElement($this->nu_idade);	

        $this->fl_ativo = $this->createElement('select', 'fl_ativo');
        $this->fl_ativo->setDecorators($this->elementDecorator);
        $this->fl_ativo->addMultiOptions(array(""=>"Todos", "t"=>"Ativos", "f"=>"Inativos"));
        $this->fl_ativo->setRequired(false);
        $this->fl_ativo->setLabel('Listar Validações');
        $this->addElement($this->fl_ativo);	
		
		$this->save = $this->createElement('button', 'salvar', array('type'=>'submit'));
		$this->save->setDecorators($this->buttonDecorator);
		$this->save->setLabel('Salvar');
		$this->addElement($this->save);
		
		$this->cancel = $this->createElement('button', 'cancelar', array('onclick'=>"location.href='/produto/validacoes'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}
