From d4ceeed0570fb10d95adeb115cbe127461bda1db Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 30 Mar 2011 12:48:08 +0200 Subject: Pagination in clients --- application/modules/user/controllers/ClientController.php | 14 ++++++-------- application/modules/user/views/scripts/client/index.phtml | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'application') diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 023de4a..7d0e7e7 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -48,7 +48,7 @@ class User_ClientController extends Zend_Controller_Action $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); #print_a($clientsInGroup); - $perpage = 5; + $perpage = 10; $req_page = $this->_request->getParam('page'); $all = count($clientsInGroup); $numpages = ceil($all/$perpage); @@ -56,12 +56,11 @@ class User_ClientController extends Zend_Controller_Action $req_page = 0; if($req_page >= $numpages) $req_page = $numpages-1; - $startitem = $req_page * $perpage; - $this->pagination = array('max' => $numpages, 'selected' => $req_page); + $startitem = $req_page * $perpage; - print_a($all,$numpages,$startitem,$req_page); - $pagination = new Pbs_Pagination(); - $this->pagination = $pagination->pagination('/user/client/index',$req_page,$numpages); + $pagination = new Pbs_Pagination(); + $str = $pagination->pagination('/user/client/index',$req_page,$numpages); + $this->view->pagination = $str; $this->view->clients = array_slice($clientsInGroup,$startitem,$perpage); } @@ -80,8 +79,7 @@ class User_ClientController extends Zend_Controller_Action $this->view->addclient = $addclient; } else{ - $addclient = new user_Form_Client(array('buttontext' => 'Create Client'),$_POST); - print_a($_POST); + $addclient = new user_Form_Client(array('buttontext' => 'Create Client'),$_POST); if ($addclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); $mac = ($mac!='')?$mac:$_POST['macadress']; diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index dd791ad..dd7aad2 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -36,7 +36,7 @@ - + pagination; ?>

There are no clients to display.

-- cgit v1.2.3-55-g7522