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/GroupController.php | 19 +++++++++++++++++-- .../modules/user/controllers/PersonController.php | 19 ++++++++++++++++++- .../modules/user/controllers/RoleController.php | 19 ++++++++++++++++++- .../modules/user/views/scripts/group/showall.phtml | 3 ++- .../modules/user/views/scripts/person/showall.phtml | 1 + .../modules/user/views/scripts/role/index.phtml | 1 + 6 files changed, 57 insertions(+), 5 deletions(-) (limited to 'application') diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 0eb32b6..064ca60 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -292,10 +292,23 @@ class User_GroupController extends Zend_Controller_Action public function showallAction() { + $this->view->groupList = $this->groupList; + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('group'); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->groupList = $mySearch->search($this->view->groupList); + } + $this->view->searchform = $mySearch->searchForm(); + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(5); - $pagination->setElement($this->groupList); + $pagination->setElement($this->view->groupList); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/group/showall'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -305,6 +318,8 @@ class User_GroupController extends Zend_Controller_Action $this->view->userIDsNamespace = $this->userIDsNamespace; } - + public function searchAction(){ + $this->_redirect('/user/group/showall/search/'.($_GET['search'])); + } } diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php index 201b452..71a8c7d 100644 --- a/application/modules/user/controllers/PersonController.php +++ b/application/modules/user/controllers/PersonController.php @@ -276,10 +276,23 @@ class user_PersonController extends Zend_Controller_Action $this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo'); $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->personList = $this->personmapper->fetchAll(); + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('person'); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->personList = $mySearch->search($this->view->personList); + } + $this->view->searchform = $mySearch->searchForm(); + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(5); - $pagination->setElement($this->personmapper->fetchAll()); + $pagination->setElement($this->view->personList); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/person/showall'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -288,6 +301,10 @@ class user_PersonController extends Zend_Controller_Action $this->view->page = $pagination->getRequestPage(); } + public function searchAction(){ + $this->_redirect('/user/person/showall/search/'.($_GET['search'])); + } + public function showAction() { if(!Pbs_Acl::checkRight('psood')) { 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'])) { diff --git a/application/modules/user/views/scripts/group/showall.phtml b/application/modules/user/views/scripts/group/showall.phtml index 34f3e11..356ebbc 100644 --- a/application/modules/user/views/scripts/group/showall.phtml +++ b/application/modules/user/views/scripts/group/showall.phtml @@ -1,4 +1,5 @@

Groups Overview

+searchform; ?> formButton('addgroup', 'Add Group', array( 'onclick' => 'self.location="/user/group/add"', 'class' => 'addbutton')) @@ -73,7 +74,7 @@ } ?> -pagination; ?> + pagination; ?> formButton('linkgroups', 'Link Groups', array( 'onclick' => 'self.location="/user/group/link"', 'class' => 'addbutton')) diff --git a/application/modules/user/views/scripts/person/showall.phtml b/application/modules/user/views/scripts/person/showall.phtml index d605f70..d9f4cf9 100644 --- a/application/modules/user/views/scripts/person/showall.phtml +++ b/application/modules/user/views/scripts/person/showall.phtml @@ -1,6 +1,7 @@

Persons Overview



+searchform; ?> diff --git a/application/modules/user/views/scripts/role/index.phtml b/application/modules/user/views/scripts/role/index.phtml index 8ca2bd6..2dbe77d 100644 --- a/application/modules/user/views/scripts/role/index.phtml +++ b/application/modules/user/views/scripts/role/index.phtml @@ -2,6 +2,7 @@ if($this->userIDsNamespace['groupID']) { ?>

Roles

+ searchform; ?> formButton('addrole', 'Add Role', array( 'onclick' => 'self.location="/user/role/add"', 'class' => 'addbutton'))?> -- cgit v1.2.3-55-g7522
Title