<?php

class Solicitacao_TarefatipoController extends Agro_Controller_Action {
	public $_columnList = array(
		'ds_nome_departamento' => 'Departamento',
		'ds_nome_tipo' => 'Tipo',
		'vl_ordem' => array('label'=>'Ordem', 'align' => 'center')
	);
	
	public function init() { $this->view->title = 'Solicitações » Configurações » Tipo'; }
	
	public function getModel() { return new Solicitacao_Model_TarefaTipo(); }
	
	public function getForm() { return new Solicitacao_Form_TarefaTipo(); }
	
	public function getFilter() {
		$where = array();
		
		if ($this->getRequest()->getParam('id_departamento')) {
			$where[] = array (
				'field' => 'id_departamento',
				'operator' => '=',
				'value' => $this->getRequest()->getParam('id_departamento')
			);
		}
		
		if ($this->getRequest()->getParam('ds_nome_tipo')) {
			$where[] = array (
				'field' => 'ds_nome_tipo',
				'operator' => 'ilike',
				'value' => '%'.$this->getRequest()->getParam('ds_nome_tipo').'%'
			);
		}
		
		return $where;
	}
}