<?php

class Atendimento_ContatocategoriaController extends Agro_Controller_Action {
	public $_columnList = array(
		'id' => 'Código',
 		'ds_nome_categoria' => 'Nome'
	);
	
	public function getForm() {
		return new Atendimento_Form_ContatoCategoria();
	}
	
	public function getModel() {
		return new Atendimento_Model_Contatocategoria();
	}
	
	public function init() {
		$this->view->title = 'Atendimento » Categorias de Contatos';
	}

	public function getFilter() {
		$where = array();

		
		if ($this->getRequest()->getParam('ds_nome_categoria')) {
			$where[] = array(
				'field' => 'ds_nome_categoria',
				'operator' => ' ilike ',
				'value' => '%' . $this->getRequest()->getParam('ds_nome_categoria') . '%'
			);
		}
		
		if ($this->getRequest()->getParam('fl_ativo')) {
			$where[] = array(
				'field' => 'fl_ativo',
				'operator' => ' = ',
				'value' => $this->getRequest()->getParam('fl_ativo')
			);
		}

		return $where;
	}
}