Exemplo n.º 1
0
 protected function processRequestFilters(QC $qc)
 {
     // paging
     $page = $this->request->getVar('page', 1);
     $count = $this->request->getVar('count', 10);
     $qc->limit(($page - 1) * $count, $count);
     // sorting
     $sorting = $this->request->getVar('sorting', null);
     if (is_array($sorting)) {
         foreach ($sorting as $key => $type) {
             $qc->orderBy($key . ' ' . ($type == 'asc' ? 'ASC' : 'DESC'));
         }
     }
     $this->setData(array('total' => QC::create('users')->select('count(*) cnt')->use('cnt')->executeOne(), 'page' => $page, 'count' => $count), 'paging');
     $this->setData($sorting, 'sorting');
 }