From 9be5110682262d8933b93043790c715c3b848a7a Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 31 Mar 2011 17:28:01 +0200 Subject: pagination auf client, pool und filter hinzugefügt --- .../modules/user/controllers/ClientController.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 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 b9399b2..c9bfd84 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -60,6 +60,7 @@ class User_ClientController extends Zend_Controller_Action $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); } @@ -77,7 +78,7 @@ class User_ClientController extends Zend_Controller_Action $addclient = new user_Form_Client(array('buttontext' => 'Create Client')); $this->view->addclient = $addclient; } - else{ + else{ $addclient = new user_Form_Client(array('buttontext' => 'Create Client'),$_POST); if ($addclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); @@ -97,6 +98,7 @@ class User_ClientController extends Zend_Controller_Action public function removeclientAction() { $clientID = $this->_request->getParam('clientID'); + $page = $this->_request->getParam('page'); // ACL: is he authorized to delete clients? if(!Pbs_Acl::checkRight('cld')) @@ -109,13 +111,13 @@ class User_ClientController extends Zend_Controller_Action if($client->getGroupID() == $this->membership->getGroupID()){ $clientMapper = new Application_Model_ClientMapper(); $clientMapper->delete($client); - $this->_redirect('/user/client/index/deleteresult/ok'); + $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/ok'); } else{ - $this->_redirect('/user/client/index/deleteresult/forbidden'); + $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/forbidden'); } } - $this->_redirect('/user/client/index/deleteresult/error'); + $this->_redirect('/user/client/index/page/'.$page.'/deleteresult/error'); } public function editclientAction(){ @@ -125,6 +127,7 @@ class User_ClientController extends Zend_Controller_Action if (!isset($_POST["add"])){ $clientID = $this->_request->getParam('clientID'); + $page = $this->_request->getParam('page'); $client = new Application_Model_Client(); $mapper = new Application_Model_ClientMapper(); $mapper->find($clientID,$client); @@ -132,17 +135,19 @@ class User_ClientController extends Zend_Controller_Action if($client->getGroupID() == $this->membership->getGroupID()){ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client')); $editclient->populate($client->toArray()); + $editclient->setPage($page); $this->view->editclient = $editclient; } else{ - $this->_redirect('/user/client/index/modifyresult/error'); + $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/error'); } } else{ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client'),$_POST); if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); - $client->setID($this->_request->getParam('clientID')); + $client->setID($this->_request->getParam('clientID')); + $page = $this->_request->getParam('page'); $dbclient = new Application_Model_Client(); $clientMapper = new Application_Model_ClientMapper(); @@ -152,10 +157,10 @@ class User_ClientController extends Zend_Controller_Action $client->setGroupID($this->membership->getGroupID()); $clientmapper = new Application_Model_ClientMapper(); $clientmapper->save($client); - $this->_redirect('/user/client/index/modifyresult/ok'); + $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/ok'); } else{ - $this->_redirect('/user/client/index/modifyresult/error'); + $this->_redirect('/user/client/index/page/'.$page.'/modifyresult/error'); } } $this->view->editclient = $editclient; -- cgit v1.2.3-55-g7522