<?php

class formEventos extends Agro_Form {
	public $id_cobertura;
	public $eventos;
	
	public function init() {
		$this->id_cobertura = $this->createElement('hidden', 'id_cobertura');
		$this->id_cobertura->setDecorators($this->buttonDecorator);
		$this->addElement($this->id_cobertura);
		
		$Evento = new Produto_Model_Eventos();
		$arrayEventos = $Evento->fetchAll('fl_ativo = true')->toArray();
		$this->eventos = $this->createElement('multiCheckbox', 'eventos');
		$this->eventos->setDecorators($this->elementDecorator);
		$this->eventos->addDecorator(array('tag'=>'fieldset'));
		foreach($arrayEventos as $item){
			$this->eventos->addMultiOption($item['id'], $item['ds_nome_evento']);
		}
		$this->addElement($this->eventos);
		
		$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/cobertura'"));
		$this->cancel->setDecorators($this->buttonDecorator);
		$this->cancel->setLabel('Cancelar');
		$this->addElement($this->cancel);
	}
}