Permalink
Browse files

Ability to filter database admin module.

  • Loading branch information...
1 parent 38baa7d commit 443936568706d243bf55b045b7a8e1d2004ad34e @splitice committed Jul 31, 2012
@@ -32,6 +32,11 @@ function getColumns(){
$ct = $this->getCreateTable();
return $ct->toArray();
}
+
+ function getWhere(){
+ if(isset($this->where)) return $this->where;
+ }
+
/**
* @return the $table
*/
@@ -32,6 +32,7 @@ protected function _T($template,$vars){
if(Request::Context() == Request::CONTEXT_OUTER){
return new Template($template,$vars,'admin');
}
+
$menu = new Menu($this->getModuleName());
$vars['menu'] = $menu;
return new Templates\ContainerTemplate($template,$vars,'admin');
@@ -133,17 +133,22 @@ function GET(){
echo $form->toHTML();
break;
case 'view':
+ //Get Table Management
+ $tableManagement = $this->table->getTableManagement();
+
$vars = array();
$per_page = 30;
- $vars['count'] = ceil($this->table->getAll()->getCount()/$per_page);
+ $where = $tableManagement->getWhere();
+ $vars['count'] = ceil($this->table->getAll($where)->getCount()/$per_page);
$pagination = new \Utility\Net\URL\Pagination\QueryMethod();
$vars['pagination'] = $pagination;
- $vars['data'] = $this->table->getAll($pagination->getLimit($per_page));
+ $sql = $pagination->getLimit($per_page);
+ if($where) $sql->where($where);
+ $vars['data'] = $this->table->getAll($sql);
//Get Columns
- $tableManagement = $this->table->getTableManagement();
$vars['cols'] = $tableManagement->getColumns();
return $this->_T('Database/admin_table_view',$vars,'admin');

0 comments on commit 4439365

Please sign in to comment.