From ea3400f39cd5ffae715562b2ae6403d3f0384b03 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Tue, 5 Apr 2011 18:13:12 +0200 Subject: Search in Group, Person und Role --- .../modules/user/controllers/RoleController.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'application/modules/user/controllers/RoleController.php') diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index 86872f0..4e0aa52 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -23,10 +23,23 @@ class User_RoleController extends Zend_Controller_Action public function indexAction() { if(isset($this->userIDsNamespace['groupID'])) { + $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $this->userIDsNamespace['groupID']),true); + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('role'); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->roleList = $mySearch->search($this->view->roleList); + } + $this->view->searchform = $mySearch->searchForm(); + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(5); - $pagination->setElement($this->roleMapper->findBy(array('groupID' => $this->userIDsNamespace['groupID']),true)); + $pagination->setElement($this->view->roleList); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -40,6 +53,10 @@ class User_RoleController extends Zend_Controller_Action } } + public function searchAction(){ + $this->_redirect('/user/role/index/search/'.($_GET['search'])); + } + public function addAction() { if(isset($this->userIDsNamespace['groupID'])) { -- cgit v1.2.3-55-g7522