<?php

class Manual_TipoController extends Agro_Controller_Action {
    public $_columnList = array (
        'id' => 'Id',
        'ds_nome_tipo' => 'Tipo'
    );

    public function init() {
        $this->view->title = 'Manuais » Tipo';
    }

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

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

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

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

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

        return $where;
    }

}
