summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authormichael pereira2011-03-08 20:57:39 +0100
committermichael pereira2011-03-08 20:57:39 +0100
commit8f5309d8b3764d463f2a1c5da34eeb59261c2260 (patch)
tree4c9aceb27e40075316ef1124de2071e40e01e404 /application/controllers
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-8f5309d8b3764d463f2a1c5da34eeb59261c2260.tar.gz
pbs2-8f5309d8b3764d463f2a1c5da34eeb59261c2260.tar.xz
pbs2-8f5309d8b3764d463f2a1c5da34eeb59261c2260.zip
BootMenu Order fertig
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/BootmenuController.php16
-rw-r--r--application/controllers/BootosController.php2
2 files changed, 13 insertions, 5 deletions
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index b7909b4..41cee9d 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -14,12 +14,14 @@ class BootmenuController extends Zend_Controller_Action
$bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
$bootosmapper = new Application_Model_BootOsMapper();
+ $this->view->bootosmapper = $bootosmapper;
$this->view->bootmenulist = $bootmenumapper->fetchAll();
$bootmenuentries = array();
foreach ($this->view->bootmenulist as $bootmenu){
$bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID());
}
+
$this->view->bootmenuentrylist = $bootmenuentries;
}
@@ -143,18 +145,18 @@ class BootmenuController extends Zend_Controller_Action
$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
$bootmenuID = $this->_request->getParam('bootmenuID');
$bootosmapper = new Application_Model_BootOsMapper();
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
if (!isset($_POST["editbootmenuentry"])){
$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){
$this->_redirect('/bootmenu');
} else {
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+
$bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
-
+
$editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder')));
-
$editbootmenuentryForm->populate($bootmenuentry->toArray());
}
}else{
@@ -170,7 +172,13 @@ class BootmenuController extends Zend_Controller_Action
$bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
try {
+ if($bootmenuentry->getOrder() < $this->_request->getParam('oldorder'))
+ $bootmenuentrymapper->orderbefore($bootmenuentry, $this->_request->getParam('oldorder'));
+ else
+ $bootmenuentrymapper->orderafter($bootmenuentry, $this->_request->getParam('oldorder'));
+
$bootmenuentrymapper->save($bootmenuentry);
+
}catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";
diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php
index 358204b..a644a5c 100644
--- a/application/controllers/BootosController.php
+++ b/application/controllers/BootosController.php
@@ -57,7 +57,7 @@ class BootosController extends Zend_Controller_Action
} else {
$bootos = new Application_Model_BootOs();
$bootosmapper = new Application_Model_BootOsMapper();
- $bootosmapper->find($bootosID, $bootos);
+ $bootos = $bootosmapper->find($bootosID);
$editbootosForm = new Application_Form_BootosEdit();
$editbootosForm->populate($bootos->toArray());