diff --git a/app/app_controller.php b/app/app_controller.php index 286d30d23..f7520d260 100644 --- a/app/app_controller.php +++ b/app/app_controller.php @@ -21,7 +21,12 @@ class AppController extends Controller 'Session', //core components - 'DebugKit.Toolbar', 'Core.Cron', 'Core.Config' + 'DebugKit.Toolbar', 'Core.Cron', 'Core.Config', + + // components + 'Filter.Filter' => array( + 'actions' => array('admin_index') + ) ); /** diff --git a/app/plugins/blog/controllers/comments_controller.php b/app/plugins/blog/controllers/comments_controller.php index dc7ac9013..f3ca0d905 100644 --- a/app/plugins/blog/controllers/comments_controller.php +++ b/app/plugins/blog/controllers/comments_controller.php @@ -23,14 +23,8 @@ class CommentsController extends BlogAppController var $uses = array( 'Core.Comment' ); - function admin_index( $active = null ) + function admin_index() { - $conditions = array(); - if ( $active !== null ) - { - $conditions = array( 'Comment.active' => $active ); - } - $this->paginate = array( 'fields' => array( 'Comment.id', @@ -42,7 +36,6 @@ function admin_index( $active = null ) 'Comment.foreign_id', 'Comment.created', ), - 'conditions' => $conditions, 'order' => array( 'Comment.active' => 'ASC', 'Comment.created' => 'ASC', diff --git a/app/plugins/blog/controllers/posts_controller.php b/app/plugins/blog/controllers/posts_controller.php index 4b5a61ef7..be77c9119 100644 --- a/app/plugins/blog/controllers/posts_controller.php +++ b/app/plugins/blog/controllers/posts_controller.php @@ -181,39 +181,11 @@ function admin_dashboard() $this->set( 'dashboardCommentsCount', $this->Post->Comment->getCounts( 'Blog.Post' ) ); } - function admin_index( $active = null ) + function admin_index() { - $conditions = array(); - if ( $active !== null ) - { - $conditions = array( 'Post.active' => $active ); - } - -// $this->Post->recursive = 0; -// -// $this->paginate = array( -// 'fields' => array( -// 'Post.id', -// 'Post.title', -// 'Post.slug', -// 'Post.intro', -// 'Post.active', -// 'Post.views', -// 'Post.comment_count', -// 'Post.created', -// 'Post.locked', -// 'Post.locked_by', -// 'Post.locked_since', -// ), -// 'conditions' => $conditions -// ); - $this->Post->recursive = 0; - $this->set( 'posts', $this->paginate() ); - - //$posts = $this->paginate( 'Post' ); - - //$this->set( compact( 'posts' ) ); + $posts = $this->paginate( null, $this->Filter->filter ); + $this->set( compact( 'posts' ) ); } function admin_add() diff --git a/app/plugins/blog/views/elements/actions.ctp b/app/plugins/blog/views/elements/actions.ctp index bb8413e3b..c8b95c376 100644 --- a/app/plugins/blog/views/elements/actions.ctp +++ b/app/plugins/blog/views/elements/actions.ctp @@ -22,14 +22,14 @@