From ef66c5f34a986bdf8a7fc12368e7c3f5d5475b33 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 1 Apr 2011 16:54:09 +0200 Subject: Pagination in Bootmenu --- .../modules/user/controllers/BootmenuController.php | 20 +++++++++++++++++++- .../modules/user/views/scripts/bootmenu/index.phtml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'application/modules/user') 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 @@ + pagination; ?> -- cgit v1.2.3-55-g7522 From aa8252b0a4fd482611bf948ab927aa8260fc309f Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 1 Apr 2011 16:56:01 +0200 Subject: Pagination in Bootmenu part 2 --- .../modules/user/views/scripts/bootmenu/index.phtml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'application/modules/user') diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml index 3109497..dbb7048 100644 --- a/application/modules/user/views/scripts/bootmenu/index.phtml +++ b/application/modules/user/views/scripts/bootmenu/index.phtml @@ -1,7 +1,7 @@
@@ -33,7 +34,8 @@
'module' => 'user',
'controller' => 'bootmenu',
'action' => 'deletebootmenu',
- 'bootmenuID' => $bootmenu->getID()
+ 'bootmenuID' => $bootmenu->getID(),
+ 'page' => $this->page
),
'default',
true) ?>">
@@ -43,7 +45,8 @@
'controller' => 'bootmenu',
'action' => 'addbootmenuentry',
'bootmenuID' => $bootmenu->getID(),
- 'maxorder' => count($this->bootmenuentrylist[$bootmenu->getID()])
+ 'maxorder' => count($this->bootmenuentrylist[$bootmenu->getID()]),
+ 'page' => $this->page
),
'default',
true) ?>">
@@ -75,7 +78,8 @@
'controller' => 'resource',
'action' => 'getbootmenuentry',
'bootmenuentryID' => $bootmenuentry->getID(),
- 'alpha' => $_SESSION['alphasessionID']
+ 'alpha' => $_SESSION['alphasessionID'],,
+ 'page' => $this->page
),
'default',
true, false) ?>">
@@ -96,7 +100,8 @@
'bootmenuentryID' => $bootmenuentry->getID(),
'bootmenuID' => $bootmenu->getID(),
'maxorder' => count($this->bootmenuentrylist[$bootmenu->getID()]),
- 'oldorder' => $bootmenuentry->getOrder()
+ 'oldorder' => $bootmenuentry->getOrder(),
+ 'page' => $this->page
),
'default',
true, false) ?>">
@@ -105,7 +110,8 @@
'module' => 'user',
'controller' => 'bootmenu',
'action' => 'removebootmenuentry',
- 'bootmenuentryID' => $bootmenuentry->getID()
+ 'bootmenuentryID' => $bootmenuentry->getID(),
+ 'page' => $this->page
),
'default',
true) ?>">
--
cgit v1.2.3-55-g7522
From 64fe85e2680b97050b10dba913c7ea598ff58d8e Mon Sep 17 00:00:00 2001
From: Simon
Date: Fri, 1 Apr 2011 17:02:18 +0200
Subject: pagination in Bootmenu
---
.../modules/user/controllers/BootmenuController.php | 20 ++++++++++----------
application/modules/user/forms/Bootmenu.php | 12 ++++++++----
application/modules/user/forms/BootmenuEntries.php | 12 ++++++++----
.../modules/user/views/scripts/bootmenu/index.phtml | 2 +-
4 files changed, 27 insertions(+), 19 deletions(-)
(limited to 'application/modules/user')
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index 2c9d2b5..58da07e 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -81,7 +81,7 @@ class user_BootmenuController extends Zend_Controller_Action
}
// Pagination
- $perpage = 5;
+ $perpage = 2;
$req_page = $this->_request->getParam('page');
$all = count($bootmenu);
$numpages = ceil($all/$perpage);
@@ -92,7 +92,7 @@ class user_BootmenuController extends Zend_Controller_Action
$startitem = $req_page * $perpage;
$pagination = new Pbs_Pagination();
- $this->view->pagination = $pagination->pagination('/user/client/index',$req_page,$numpages);
+ $this->view->pagination = $pagination->pagination('/user/bootmenu/index',$req_page,$numpages);
$this->view->page = $req_page;
$this->view->bootmenulist = array_slice($bootmenu,$startitem,$perpage);
@@ -109,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)) {
@@ -154,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)) {
@@ -225,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)) {
@@ -281,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());
@@ -293,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/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php
index 67c76d8..1aaf808 100644
--- a/application/modules/user/forms/Bootmenu.php
+++ b/application/modules/user/forms/Bootmenu.php
@@ -3,7 +3,8 @@
class user_Form_Bootmenu extends Zend_Form
{
private $action;
- private $rights;
+ private $rights;
+ private $page;
public function setRights($rights){
$this->rights = $rights;
@@ -14,10 +15,13 @@ class user_Form_Bootmenu extends Zend_Form
}
public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
+ $this->grouplist = $grouplist;
}
+ public function setPage($page){
+ $this->page = $page;
+ }
+
public function init()
{
$this->setName($this->action);
@@ -49,7 +53,7 @@ class user_Form_Bootmenu extends Zend_Form
));
$this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootmenu"'
+ 'onclick' => 'self.location="/user/bootmenu/index/page/'.$this->page.'"'
));
}
diff --git a/application/modules/user/forms/BootmenuEntries.php b/application/modules/user/forms/BootmenuEntries.php
index c7463f0..447f09e 100644
--- a/application/modules/user/forms/BootmenuEntries.php
+++ b/application/modules/user/forms/BootmenuEntries.php
@@ -6,7 +6,8 @@ class user_Form_BootmenuEntries extends Zend_Form
private $configlist;
private $maxorder;
private $action;
- private $rights;
+ private $rights;
+ private $page;
public function setRights($rights){
$this->rights = $rights;
@@ -26,10 +27,13 @@ class user_Form_BootmenuEntries extends Zend_Form
}
public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
+ $this->configlist = $configlist;
}
+ public function setPage($page){
+ $this->page = $page;
+ }
+
public function init()
{
@@ -146,7 +150,7 @@ class user_Form_BootmenuEntries extends Zend_Form
));
$this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootmenu"'
+ 'onclick' => 'self.location="/user/bootmenu/index/page/'.$this->page.'"'
));
}
diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml
index dbb7048..72051ab 100644
--- a/application/modules/user/views/scripts/bootmenu/index.phtml
+++ b/application/modules/user/views/scripts/bootmenu/index.phtml
@@ -78,7 +78,7 @@
'controller' => 'resource',
'action' => 'getbootmenuentry',
'bootmenuentryID' => $bootmenuentry->getID(),
- 'alpha' => $_SESSION['alphasessionID'],,
+ 'alpha' => $_SESSION['alphasessionID'],
'page' => $this->page
),
'default',
--
cgit v1.2.3-55-g7522
From 08827c1d34d0b8d67cb6b127cc9336ef291ad659 Mon Sep 17 00:00:00 2001
From: Simon
Date: Fri, 1 Apr 2011 17:04:32 +0200
Subject: Bugfixing(Pagination) im Pool-Controller
---
application/modules/user/controllers/PoolController.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'application/modules/user')
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{
--
cgit v1.2.3-55-g7522