<?

class Produto_Form_ProdutoGeral extends Agro_Form {
	public $id;
	public $ds_nome_produto_geral;
	
	public function init() {
		$this->id = $this->createElement('hidden', 'id');
		$this->id->setDecorators($this->buttonDecorator);
		$this->addElement($this->id);
		
		$Tipo = new Produto_Model_Tipos();
		$this->id_tipo_produto = $this->createElement('select', 'id_tipo_produto');
		$this->id_tipo_produto->setDecorators($this->elementDecorator);
		$this->id_tipo_produto->addMultiOptions($Tipo->getCombo());
		$this->id_tipo_produto->setRequired(true);
		$this->id_tipo_produto->setLabel('Tipo');
		$this->addElement($this->id_tipo_produto);
		
		$this->tp_epoca_cultivo = $this->createElement('select', 'tp_epoca_cultivo');
		$this->tp_epoca_cultivo->setDecorators($this->elementDecorator);
		$this->tp_epoca_cultivo->addMultiOptions(array('N' => '', 'I' => 'Inverno', 'V' => 'Verão'));
		$this->tp_epoca_cultivo->setRequired(false);
		$this->tp_epoca_cultivo->setLabel('Época de Cultivo');
		$this->addElement($this->tp_epoca_cultivo);
		
		$Cultura = new Produto_Model_Culturas();
		$this->id_cultura = $this->createElement('select', 'id_cultura');
		$this->id_cultura->setDecorators($this->elementDecorator);
		$this->id_cultura->addMultiOptions($Cultura->getCombo());
		$this->id_cultura->setRequired(true);
		$this->id_cultura->setLabel('Cultura');
		$this->addElement($this->id_cultura);
		
		$Ramo = new Produto_Model_Ramos();
		$this->id_ramo = $this->createElement('select', 'id_ramo');
		$this->id_ramo->setDecorators($this->elementDecorator);
		$this->id_ramo->addMultiOptions($Ramo->getCombo());
		$this->id_ramo->setRequired(true);
		$this->id_ramo->setLabel('Ramo');
		$this->addElement($this->id_ramo);
		
		$this->ds_nome_produto_geral = $this->createElement('text', 'ds_nome_produto_geral');
		$this->ds_nome_produto_geral->setDecorators($this->elementDecorator);
		$this->ds_nome_produto_geral->setRequired(true);
		$this->ds_nome_produto_geral->setAttrib('size', '50');
		$this->ds_nome_produto_geral->setAttrib('maxlength', '40');
		$this->ds_nome_produto_geral->setLabel('Nome');
		$this->addElement($this->ds_nome_produto_geral);
		
		
		$this->cd_produto_geral_seguradora = $this->createElement('text', 'cd_produto_geral_seguradora');
		$this->cd_produto_geral_seguradora->setDecorators($this->elementDecorator);
		$this->cd_produto_geral_seguradora->setRequired(false);
		$this->cd_produto_geral_seguradora->setAttrib('size', '20');
		$this->cd_produto_geral_seguradora->setAttrib('maxlength', '5');
		$this->cd_produto_geral_seguradora->setLabel('Código Produto Geral Seguradora');
		$this->addElement($this->cd_produto_geral_seguradora);
		
		
		$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/produtogeral'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}