diff options
Diffstat (limited to 'application/modules/user/controllers')
-rw-r--r-- | application/modules/user/controllers/BootmenuController.php | 36 | ||||
-rw-r--r-- | application/modules/user/controllers/PoolController.php | 6 |
2 files changed, 30 insertions, 12 deletions
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index d0c25ac..79c3ee7 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -7,6 +7,7 @@ class user_BootmenuController extends Zend_Controller_Action protected $bootmenuentriesMapper; protected $membershipMapper; protected $membership; + protected $page; public function init() { @@ -26,6 +27,7 @@ class user_BootmenuController extends Zend_Controller_Action } else { $this->_helper->redirector('login', 'auth'); } + $this->page = $this->_request->getParam('page'); } public function indexAction() @@ -77,8 +79,24 @@ class user_BootmenuController extends Zend_Controller_Action $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle()); } } + + // Pagination + $perpage = 2; + $req_page = $this->_request->getParam('page'); + $all = count($bootmenu); + $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 = new Pbs_Pagination(); + $this->view->pagination = $pagination->pagination('/user/bootmenu/index',$req_page,$numpages); + $this->view->page = $req_page; + $this->view->bootmenulist = array_slice($bootmenu,$startitem,$perpage); + - $this->view->bootmenulist = $bootmenu; $this->view->bootmenuentrylist = $bootmenuentries; } @@ -91,10 +109,10 @@ class user_BootmenuController extends Zend_Controller_Action $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/addresult/forbidden'); if (!isset($_POST["createbootmenu"])){ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all')); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all','page' => $this->page)); } else { - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all'),$_POST); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all','page' => $this->page),$_POST); if ($bootmenuForm->isValid($_POST)) { @@ -136,11 +154,11 @@ class user_BootmenuController extends Zend_Controller_Action if (!isset($_POST["editbootmenu"])){ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all')); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all','page' => $this->page)); $bootmenuForm->populate($bootmenu->toArray()); }else{ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all'),$_POST); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all','page' => $this->page),$_POST); if ($bootmenuForm->isValid($_POST)) { @@ -207,14 +225,14 @@ class user_BootmenuController extends Zend_Controller_Action $configmapper = new Application_Model_ConfigMapper(); if (!isset($_POST["addbootmenuentry"])){ - $addbootmenuentryForm = new user_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll())); + $addbootmenuentryForm = new user_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(),'page' => $this->page)); $addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder'))); unset($_POST['kcl']); unset($_POST['configID']); $addbootmenuentryForm->populate($_POST); } else { - $addbootmenuentryForm = new user_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()),$_POST); + $addbootmenuentryForm = new user_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(),'page' => $this->page),$_POST); if ($addbootmenuentryForm->isValid($_POST)) { @@ -263,7 +281,7 @@ class user_BootmenuController extends Zend_Controller_Action $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry); - $editbootmenuentryForm = new user_Form_BootmenuEntries(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl())); + $editbootmenuentryForm = new user_Form_BootmenuEntries(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl(),'page' => $this->page)); if(!isset($_POST['configID'])){ $editbootmenuentryForm->populate($bootmenuentry->toArray()); @@ -275,7 +293,7 @@ class user_BootmenuController extends Zend_Controller_Action } } }else{ - $editbootmenuentryForm = new user_Form_BootmenuEntries(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl()),$_POST); + $editbootmenuentryForm = new user_Form_BootmenuEntries(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl(),'page' => $this->page),$_POST); if ($editbootmenuentryForm->isValid($_POST)) { diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index bdf23b3..d5cab09 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -110,7 +110,7 @@ class User_PoolController extends Zend_Controller_Action $this->view->addpool = $addfilterform; }else { $addpoolform = new user_Form_Pool(array( - 'buttontext' => 'Create Pool' + 'buttontext' => 'Create Pool', 'page' => $this->page),$_POST); if ($addpoolform->isValid($_POST)) { try{ @@ -167,7 +167,7 @@ class User_PoolController extends Zend_Controller_Action if($pool->getGroupID() == $this->membership->getGroupID()){ $poolArray = $pool->toArray(); $editpool = new user_Form_Pool(array( - 'buttontext' => 'Edit Pool' + 'buttontext' => 'Edit Pool', 'page' => $this->page)); $editpool->populate($poolArray); $this->view->editpool = $editpool; @@ -177,7 +177,7 @@ class User_PoolController extends Zend_Controller_Action } }else { $editpoolform = new user_Form_Pool(array( - 'buttontext' => 'Edit Pool' + 'buttontext' => 'Edit Pool', 'page' => $this->page),$_POST); if ($editpoolform->isValid($_POST)) { try{ |