<?php

class Atendimento_PrioridadeController extends Agro_Controller_Action {
	public $_paginator = false;
	public $_columnList = array(
		'id' => 'Código',
		'ds_descricao' => 'Descrição',
		'ds_chave' => 'Chave'
	);
	
	public function getForm() {
		return new Atendimento_Form_Prioridade();
	}
	
	public function getModel() {
		return new Atendimento_Model_Prioridade();
	}
	
	public function init() {
		$this->view->title = 'Atendimento » Prioridade de Chamado';
		
	}
		
	public function save() {
		
	}
	
	public function getFilter() {
		$User = Zend_Auth::getInstance()->getIdentity();
		$where = array();
		
		if ($this->getRequest()->getParam('ds_chave')) {
			$where[] = array(
				'field' => 'ds_chave',
				'operator' => ' ilike ',
				'value' => '%' . $this->getRequest()->getParam('ds_chave') . '%'
			);
		}
		
		if ($this->getRequest()->getParam('ds_descricao')) {
			$where[] = array(
				'field' => 'ds_descricao',
				'operator' => ' ilike ',
				'value' => '%' . $this->getRequest()->getParam('ds_descricao') . '%'
			);
		}
		
		if ($this->getRequest()->getParam('fl_ativo')) {
			$where[] = array(
				'field' => 'fl_ativo',
				'operator' => ' = ',
				'value' => $this->getRequest()->getParam('fl_ativo')
			);
		}

		return $where;
	}
	
}