From 431932fd6a4c3f8c3883abe5af2e2d10f516c998 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 30 Mar 2011 11:43:23 +0200 Subject: vorbereitung für pagination --- .../modules/user/controllers/ClientController.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'application/modules/user/controllers/ClientController.php') diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 163ea95..023de4a 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -46,9 +46,23 @@ class User_ClientController extends Zend_Controller_Action $clientMapper = new Application_Model_ClientMapper(); $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); + #print_a($clientsInGroup); - - $this->view->clients = $clientsInGroup; + $perpage = 5; + $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; + $this->pagination = array('max' => $numpages, 'selected' => $req_page); + + print_a($all,$numpages,$startitem,$req_page); + $pagination = new Pbs_Pagination(); + $this->pagination = $pagination->pagination('/user/client/index',$req_page,$numpages); + $this->view->clients = array_slice($clientsInGroup,$startitem,$perpage); } -- cgit v1.2.3-55-g7522