Ejemplo n.º 1
0
 /**
  * Display member quotas
  *
  * @return  void
  */
 public function displayTask()
 {
     // Incoming
     $filters = array('search' => urldecode(Request::getState($this->_option . '.quotas.search', 'search', '')), 'search_field' => urldecode(Request::getState($this->_option . '.quotas.search_field', 'search_field', 'name')), 'sort' => Request::getState($this->_option . '.quotas.sort', 'filter_order', 'user_id'), 'sort_Dir' => Request::getState($this->_option . '.quotas.sortdir', 'filter_order_Dir', 'ASC'), 'class_alias' => Request::getState($this->_option . '.quotas.class_alias', 'class_alias', ''));
     $cats = Category::blank()->getTableName();
     $users = Member::blank()->getTableName();
     $entries = Quota::all();
     $entries->select($entries->getTableName() . '.*')->select($cats . '.alias', 'class_alias')->select($users . '.name')->select($users . '.username')->join($cats, $cats . '.id', $entries->getTableName() . '.class_id', 'left')->join($users, $users . '.id', $entries->getTableName() . '.user_id', 'left');
     if ($filters['search']) {
         $entries->whereLike($users . '.name', strtolower((string) $filters['search']), 1)->orWhereLike($users . '.username', strtolower((string) $filters['search']), 1)->resetDepth();
     }
     if ($filters['class_alias']) {
         $entries->whereEquals('class_alias', $filters['class_alias']);
     }
     // Get records
     $rows = $entries->order($filters['sort'], $filters['sort_Dir'])->paginated('limitstart', 'limit')->rows();
     $classes = Category::all()->ordered()->rows();
     // Output the HTML
     $this->view->set('rows', $rows)->set('classes', $classes)->set('filters', $filters)->display();
 }