<?

class Produto_Form_LaudoPreliminar extends Agro_Form {
	public $ds_controller;
	
	public function init() {

		$this->addElement('hidden', 'id', array('decorators' => $this->elementDecorator));
		
		$Safra = new Produto_Model_Safras();
		$this->addElement('select', 'id_safra', array(
			'RegisterInArrayValidator' => false,
			'MultiOptions' => $Safra->getCombo(0, true),
			'decorators' => $this->elementDecorator,
			'label' => 'Safra',
			'required' => true
		));
		
		$this->addElement('select', 'id_produto', array(
			'decorators' => $this->elementDecorator,
			'RegisterInArrayValidator' => false,
			'label' => 'Produto',
			'required' => true
		));
		
		$Cobertura = new Produto_Model_Coberturas();
		$this->addElement('select', 'id_cobertura', array(
			'MultiOptions' => $Cobertura->getCombo(),
			'decorators' => $this->elementDecorator,
			'label' => 'Cobertura',
			'required' => true
		));
		
		$this->ds_controller = $this->createElement('text', 'ds_controller');
		$this->ds_controller->setDecorators($this->elementDecorator);
		$this->ds_controller->setRequired(true);
		$this->ds_controller->setAttrib('size','30');
		$this->ds_controller->setAttrib('maxlength','40');
		$this->ds_controller->setLabel('Controller');
		$this->addElement($this->ds_controller);
		
		$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/laudopreliminar'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
		
		$this->addDisplayGroup(array('salvar', 'cancelar'), 'buttons');
	}
}