<?

class Produto_Form_ValidacoesVariedadeDensidade extends Agro_Form {
	public $id;
	public $ds_nome_grupo_densidade;
	
	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->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->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);		
		
		$Densidade = new Produto_Model_Validacoesgrupodensidade();
		$this->id_grupo_densidade = $this->createElement('select', 'id_grupo_densidade');
		$this->id_grupo_densidade->setDecorators($this->elementDecorator);
		$this->id_grupo_densidade->addMultiOptions($Densidade->getCombo(true, null, $this->id_validacao_filtro));
		$this->id_grupo_densidade->setRequired(true);
		$this->id_grupo_densidade->setLabel('Grupo Densidade');
		$this->addElement($this->id_grupo_densidade);	
		
		$Variedades = new Produto_Model_ValidacoesVariedades();
		$this->id_grupo_variedade = $this->createElement('select', 'id_grupo_variedade');
		$this->id_grupo_variedade->setDecorators($this->elementDecorator);
		$this->id_grupo_variedade->addMultiOptions($Variedades->getCombo(true, null, $this->id_validacao_filtro));
		$this->id_grupo_variedade->setRequired(true);
		$this->id_grupo_variedade->setLabel('Grupo de Variedades');
		$this->addElement($this->id_grupo_variedade);

  		$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->save = $this->createElement('button', 'salvardensidade', 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);
	}
}