summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/modules/user/controllers/BootisoController.php58
-rw-r--r--application/modules/user/forms/Bootiso.php7
-rw-r--r--application/modules/user/views/scripts/bootiso/index.phtml10
3 files changed, 55 insertions, 20 deletions
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index 1b7f1c4..ba2ef91 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -78,6 +78,23 @@ class user_BootisoController extends Zend_Controller_Action
$this->view->bootisolist = array_reverse($this->view->bootisolist);
+ // Pagination
+ $perpage = 10;
+ $req_page = $this->_request->getParam('page');
+ $all = count($this->view->bootisolist);
+ $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/bootiso/index',$req_page,$numpages);
+ $this->view->page = $req_page;
+ $this->view->bootisolist = array_slice($this->view->bootisolist,$startitem,$perpage);
+
+
$prebootMapper = new Application_Model_PreBootMapper();
$this->view->prebootlist = array();
@@ -91,21 +108,24 @@ class user_BootisoController extends Zend_Controller_Action
public function downloadbootisoAction()
{
+ $page = $this->_request->getParam('page');
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
+ $page = $this->_request->getParam('page');
+
//TODO ACL Darf er BootISOs downloaden?
if(false)
- $this->_redirect('/user/bootiso/index/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/forbidden');
$prebootID = $this->_request->getParam('prebootID');
$bootisoID = $this->_request->getParam('bootisoID');
if(!is_dir("../resources/bootmedium/$prebootID/"))
- $this->_redirect('/user/bootiso/index/downloadresult/404');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/404');
if(!is_numeric($prebootID) || !is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/forbidden');
chdir("../resources/bootmedium/$prebootID/");
@@ -127,9 +147,10 @@ class user_BootisoController extends Zend_Controller_Action
public function createbootisoAction()
{
+ $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs erstellen?
if(false)
- $this->_redirect('/user/bootiso/index/addresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/forbidden');
$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
$groupID = $this->membership->getGroupID();
@@ -173,11 +194,11 @@ class user_BootisoController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/addresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/error');
//TODO Delete File & delete bootiso from DB
}
- $this->_redirect('/user/bootiso/index/addresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/ok');
}
}
@@ -186,13 +207,14 @@ class user_BootisoController extends Zend_Controller_Action
public function editbootisoAction()
{
+ $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs editieren?
if(false)
- $this->_redirect('/user/bootiso/index/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -208,7 +230,7 @@ class user_BootisoController extends Zend_Controller_Action
$this->bootisoMapper->find($bootisoID, $bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
$bootisoForm = new user_Form_Bootiso(array('action' => 'editbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => 'meta'));
$bootisoForm->populate($bootiso->toArray());
@@ -234,7 +256,7 @@ class user_BootisoController extends Zend_Controller_Action
$bootiso->getSerialnumber() != $bootisoold->getSerialnumber()){
//TODO ACL Is he allowed to edit other than Metadata?
if(false)
- $this->_redirect('/user/bootiso/index/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
}
@@ -253,11 +275,11 @@ class user_BootisoController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/modifyresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/error');
//TODO Redo Serial in Files...
}
- $this->_redirect('/user/bootiso/index/modifyresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/ok');
}
}
@@ -267,30 +289,32 @@ class user_BootisoController extends Zend_Controller_Action
public function deletebootisoAction()
{
+ $page = $this->_request->getParam('page');
+
//TODO ACL Darf er BootISOs löschen?
if(false)
- $this->_redirect('/user/bootiso/index/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
try{
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
$bootiso = new Application_Model_BootIso();
$this->bootisoMapper->find($bootisoID,$bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
$this->bootisoMapper->delete($bootiso);
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/deleteresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/error');
}
- $this->_redirect('/user/bootiso/index/deleteresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/ok');
}
}
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php
index 7c472c0..f20179f 100644
--- a/application/modules/user/forms/Bootiso.php
+++ b/application/modules/user/forms/Bootiso.php
@@ -7,6 +7,7 @@ class user_Form_Bootiso extends Zend_Form
private $groupdepth;
private $action;
private $rights;
+ private $page;
public function setRights($rights){
$this->rights = $rights;
@@ -20,6 +21,9 @@ class user_Form_Bootiso extends Zend_Form
public function setGroupdepth($groupdepth){
$this->groupdepth = $groupdepth;
}
+ public function setPage($page){
+ $this->page = $page;
+ }
public function init()
@@ -111,6 +115,9 @@ class user_Form_Bootiso extends Zend_Form
'onclick' => 'self.location="/user/bootiso"'
));
+ $this->addElement('hidden','page', array(
+ 'value' => $this->page
+ ));
?>
<script>
diff --git a/application/modules/user/views/scripts/bootiso/index.phtml b/application/modules/user/views/scripts/bootiso/index.phtml
index 4e1d15d..ce0d8ce 100644
--- a/application/modules/user/views/scripts/bootiso/index.phtml
+++ b/application/modules/user/views/scripts/bootiso/index.phtml
@@ -35,7 +35,8 @@
'controller' => 'bootiso',
'action' => 'downloadbootiso',
'prebootID' => $bootiso->getprebootID(),
- 'bootisoID' => $bootiso->getID()
+ 'bootisoID' => $bootiso->getID(),
+ 'page' => $this->page
),
'default',
true, false) ?>"><img src='/media/img/download.png' alt='Download BootMedium' /></a></td>
@@ -44,7 +45,8 @@
'module' => 'user',
'controller' => 'bootiso',
'action' => 'editbootiso',
- 'bootisoID' => $bootiso->getID()
+ 'bootisoID' => $bootiso->getID(),
+ 'page' => $this->page
),
'default',
true, false) ?>"><img src='/media/img/edit.png' alt='Edit BootISO' /></a></td>
@@ -53,13 +55,15 @@
'module' => 'user',
'controller' => 'bootiso',
'action' => 'deletebootiso',
- 'bootisoID' => $bootiso->getID()
+ 'bootisoID' => $bootiso->getID(),
+ 'page' => $this->page
),
'default',
true) ?>"><img src='/media/img/delete.png' alt='Delete BootISO'/></a></td>
</tr>
<?php endforeach; ?>
</table>
+<?php echo $this->pagination; ?>