diff options
| author | Simon | 2011-04-01 16:54:09 +0200 |
|---|---|---|
| committer | Simon | 2011-04-01 16:54:09 +0200 |
| commit | ef66c5f34a986bdf8a7fc12368e7c3f5d5475b33 (patch) | |
| tree | 4169c8f3f96f537da09428ef9c316a1de7c7a6e2 /application/modules | |
| parent | merge (diff) | |
| download | pbs2-ef66c5f34a986bdf8a7fc12368e7c3f5d5475b33.tar.gz pbs2-ef66c5f34a986bdf8a7fc12368e7c3f5d5475b33.tar.xz pbs2-ef66c5f34a986bdf8a7fc12368e7c3f5d5475b33.zip | |
Pagination in Bootmenu
Diffstat (limited to 'application/modules')
| -rw-r--r-- | application/modules/user/controllers/BootmenuController.php | 20 | ||||
| -rw-r--r-- | application/modules/user/views/scripts/bootmenu/index.phtml | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index 7d829de..0f2fdd4 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 = 5; + $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/client/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; } diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml index d0b8391..3109497 100644 --- a/application/modules/user/views/scripts/bootmenu/index.phtml +++ b/application/modules/user/views/scripts/bootmenu/index.phtml @@ -117,6 +117,7 @@ <?php endif; ?> <?php endforeach; ?> </table> + <?php echo $this->pagination; ?> |
