diff options
Diffstat (limited to 'application/controllers/BootmenuController.php')
| -rw-r--r-- | application/controllers/BootmenuController.php | 16 |
1 files changed, 12 insertions, 4 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/>"; |
