Ejemplo n.º 1
0
 /**
  * Retona a condição de filtro que será usado
  * para listar os dados de uma tabela e assim
  * poderá ser usado nas ações de grid, retrieve e etc...
  *
  * @return ZendT_Db_Where_Group
  */
 public function getWherePostData()
 {
     $param = $this->getRequest()->getParams();
     $whereGroup = new ZendT_Db_Where_Group('AND');
     if ($this->_mapper instanceof ZendT_Db_View) {
         $columns = $this->getMapper()->getColumns()->getColumnsMapper();
         $columns->add('*', $this->getModel()->getMapperName());
     } else {
         $columns = $this->getModel()->getColumnsMapper();
     }
     /**
      * Pega do filtro que é usado em tela.
      */
     if (isset($param['isSearch'])) {
         $where1 = ZendT_Db_Where::fromPostDataSearch($param, $columns);
         $whereGroup->addWhere($where1);
     }
     /**
      *
      */
     if (isset($param['_search'])) {
         $where2 = ZendT_Db_Where::fromAutoFilter($param, $columns);
         $whereGroup->addWhere($where2);
     }
     /**
      * Pega o filtro usado usado em json
      */
     if ($param['filter_json']) {
         $where3 = ZendT_Db_Where::fromJson(stripslashes($param['filter_json']));
         $whereGroup->addWhere($where3);
     }
     return $whereGroup;
 }