<?php

class Atendimento_TiporecusaController extends Agro_Controller_Action {
    public $_columnList = array (
        'id' => 'Código',
        'ds_tipo_recusa' => 'Tipo',
        'ds_chave' => 'Chave'
    );

    public function init() {
        $this->view->title = 'Atendimento » Configurações » Tipo Recusa';
    }

    public function getForm() {
        return new Atendimento_Form_TipoRecusa();
    }

    public function getModel() {
        return new Atendimento_Model_TipoRecusaSinistro();
    }

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

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

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

        return $where;
    }
}
