summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/BootisoController.php
diff options
context:
space:
mode:
authorSimon2011-04-01 16:34:13 +0200
committerSimon2011-04-01 16:34:13 +0200
commitcd230aefd78797219cb3814cda29fc8178520a22 (patch)
tree9e460a6493323e35a98fd9921be680c70a3c541d /application/modules/user/controllers/BootisoController.php
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-cd230aefd78797219cb3814cda29fc8178520a22.tar.gz
pbs2-cd230aefd78797219cb3814cda29fc8178520a22.tar.xz
pbs2-cd230aefd78797219cb3814cda29fc8178520a22.zip
Pagination in ettlichen Controllern + aufgeräumt
Diffstat (limited to 'application/modules/user/controllers/BootisoController.php')
-rw-r--r--application/modules/user/controllers/BootisoController.php83
1 files changed, 49 insertions, 34 deletions
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index ba2ef91..ad3244a 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -5,11 +5,11 @@ class user_BootisoController extends Zend_Controller_Action
protected $bootisoMapper;
protected $membershipMapper;
- protected $membership;
+ protected $membership;
+ protected $page;
public function init()
- {
- error_reporting(E_ALL);
+ {
if (Zend_Auth::getInstance()->hasIdentity()) {
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
if($userIDsNamespace['membershipID'] ==''){
@@ -26,6 +26,7 @@ class user_BootisoController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -79,7 +80,7 @@ class user_BootisoController extends Zend_Controller_Action
$this->view->bootisolist = array_reverse($this->view->bootisolist);
// Pagination
- $perpage = 10;
+ $perpage = 2;
$req_page = $this->_request->getParam('page');
$all = count($this->view->bootisolist);
$numpages = ceil($all/$perpage);
@@ -108,24 +109,23 @@ 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/page/'.$page.'/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
$prebootID = $this->_request->getParam('prebootID');
$bootisoID = $this->_request->getParam('bootisoID');
if(!is_dir("../resources/bootmedium/$prebootID/"))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/404');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404');
if(!is_numeric($prebootID) || !is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/downloadresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
chdir("../resources/bootmedium/$prebootID/");
@@ -147,10 +147,9 @@ 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/page/'.$page.'/addresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden');
$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
$groupID = $this->membership->getGroupID();
@@ -160,12 +159,21 @@ class user_BootisoController extends Zend_Controller_Action
$prebootMapper = new Application_Model_PreBootMapper();
$prebootlist = $prebootMapper->findBy("groupID", $groupID);
-
if (!isset($_POST["createbootiso"])){
- $bootisoForm = new user_Form_Bootiso(array('action' => 'createbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => null));
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => null,
+ 'page'=>$this->page));
} else {
- $bootisoForm = new user_Form_Bootiso(array('action' => 'createbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => null),$_POST);
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => null,
+ 'page'=>$this->page),$_POST);
if ($bootisoForm->isValid($_POST)) {
@@ -194,11 +202,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/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error');
//TODO Delete File & delete bootiso from DB
- }
- $this->_redirect('/user/bootiso/index/page/'.$page.'/addresult/ok');
+ }
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok');
}
}
@@ -207,14 +215,13 @@ 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/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -230,13 +237,23 @@ class user_BootisoController extends Zend_Controller_Action
$this->bootisoMapper->find($bootisoID, $bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
- $bootisoForm = new user_Form_Bootiso(array('action' => 'editbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => 'meta'));
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => 'meta',
+ 'page' => $this->page));
$bootisoForm->populate($bootiso->toArray());
}else{
- $bootisoForm = new user_Form_Bootiso(array('action' => 'editbootiso','prebootlist' => $prebootlist, 'groupdepth' => $childgroups, 'rights' => 'meta'),$_POST);
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'rights' => 'meta',
+ 'page' => $this->page),$_POST);
if ($bootisoForm->isValid($_POST)) {
@@ -256,7 +273,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/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
}
@@ -275,11 +292,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/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error');
//TODO Redo Serial in Files...
}
- $this->_redirect('/user/bootiso/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok');
}
}
@@ -288,33 +305,31 @@ 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/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
try{
$bootisoID = $this->_request->getParam('bootisoID');
if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
$bootiso = new Application_Model_BootIso();
$this->bootisoMapper->find($bootisoID,$bootiso);
if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->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/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error');
}
- $this->_redirect('/user/bootiso/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok');
}
}