diff options
| author | michael pereira | 2011-04-04 17:14:53 +0200 |
|---|---|---|
| committer | michael pereira | 2011-04-04 17:14:53 +0200 |
| commit | b1a3923f98348f5145713315180b8e80e6ee89c0 (patch) | |
| tree | bff2b1b25fc41d1581d78c9b858897419780c7a0 /application/modules/user/controllers/ClientController.php | |
| parent | WICHTIG findBy Methode geändert & alles angepasst, siehe Ticket (diff) | |
| parent | client-suche verändert (diff) | |
| download | pbs2-b1a3923f98348f5145713315180b8e80e6ee89c0.tar.gz pbs2-b1a3923f98348f5145713315180b8e80e6ee89c0.tar.xz pbs2-b1a3923f98348f5145713315180b8e80e6ee89c0.zip | |
merges
Diffstat (limited to 'application/modules/user/controllers/ClientController.php')
| -rw-r--r-- | application/modules/user/controllers/ClientController.php | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index e26075b..87e764d 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -49,23 +49,32 @@ class User_ClientController extends Zend_Controller_Action $clientMapper = new Application_Model_ClientMapper(); $clientsInGroup = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()),true); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $search; + $clientsInGroup = $mySearch->search($clientsInGroup); + } - $perpage = 10; - $req_page = $this->_request->getParam('page'); - $all = count($clientsInGroup); - $numpages = ceil($all/$perpage); - if($req_page < 0 || !is_numeric($req_page) ) - $req_page = 0; - if($req_page >= $numpages) - $req_page = $numpages-1; - $startitem = $req_page * $perpage; - + // Pagination $pagination = new Pbs_Pagination(); - $this->view->pagination = $pagination->pagination('/user/client/index',$req_page,$numpages); - $this->view->page = $req_page; - $this->view->clients = array_slice($clientsInGroup,$startitem,$perpage); + $pagination->setPerPage(10); + $pagination->setElement($clientsInGroup); + $pagination->setRequestPage($this->_request->getParam('page')); + $pagination->setPageUrl('/user/client/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); + $clientsInGroup = $pagination->getElements(); + + $this->view->pagination = $pagination->pagination($pageurl); + $this->view->page = $pagination->getRequestPage(); + $this->view->clients = $clientsInGroup; } + public function searchAction(){ + $this->_redirect('/user/client/index/search/'.$_GET['search']); + } public function addclientAction() { |
