<?php

class Sinistro_MotivoquadranaovistoriadaController extends Agro_Controller_Action {
	public $_columnList = array('ds_motivo' => 'Motivo');
	
	public function init() {
		$this->view->title = 'Sistema » Cadastro » Motivo quadra não vistoriada';
	}
	
	public function setBack() {
		$this->view->back = '/sistema/motivoquadranaovistoriada';
	}
	
	public function getModel() {
		return new Sinistro_Model_MotivoQuadraNaoVistoriada();
	}
	
	public function getForm() {
		return new Sinistro_Form_MotivoQuadraNaoVistoriada();
	}
	
	public function getFilter() {
		$where = array();
		
		if ($this->getRequest()->getParam('ds_motivo')) {
			$where[] = array (
				'field' => 'ds_motivo',
				'operator' => 'ilike',
				'value' => '%'.$this->getRequest()->getParam('ds_motivo').'%'
			);
		}
				
		if ($this->getRequest()->getParam('fl_ativo')) {
			$where[] = array (
				'field' => 'fl_ativo',
				'operator' => ' = ',
				'value' => $this->getRequest()->getParam('fl_ativo')
			);
		}		
		
		return $where;
	}
}