summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/BootmenuController.php64
1 files changed, 60 insertions, 4 deletions
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index 1dfa641..dba15a7 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -11,11 +11,18 @@ class BootmenuController extends Zend_Controller_Action
public function indexAction()
{
$bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentries = array();
$this->view->bootmenulist = $bootmenumapper->fetchAll();
+ foreach ($this->view->bootmenulist as $bootmenu){
+ $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->find($bootmenu->getID());
+ }
+ $this->view->bootmenuentrylist = $bootmenuentries;
}
public function addbootmenuentryAction()
{
+ $bootmenuID = $this->_request->getParam('bootmenuID');
if (!isset($_POST["addbootmenuentry"])){
$addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd();
} else {
@@ -25,6 +32,7 @@ class BootmenuController extends Zend_Controller_Action
if ($addbootmenuentryForm->isValid($_POST)) {
$bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenuID);
$bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
try {
@@ -119,18 +127,67 @@ class BootmenuController extends Zend_Controller_Action
public function editbootmenuentryAction()
{
- // action body
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+
+ 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();
+ $editbootmenuentryForm->populate($bootmenuentry->toArray());
+ }
+ }else{
+ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit($_POST);
+
+ if ($editbootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenuID);
+ $bootmenuentry->setID($bootmenuentryID);
+
+ $bootmenumapper = new Application_Model_BootMenuEntriesMapper();
+
+ try {
+ $bootmenuentrymapper->save($bootmenuentry);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/bootmenu');
+ }
+
+ }
+
+ $this->view->editbootmenuentryForm = $editbootmenuentryForm;
+
}
public function removebootmenuentryAction()
{
- // action body
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){
+ $this->_redirect('/bootmenu');
+ } else {
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentry->setID($bootmenuentryID);
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentrymapper->delete($bootmenuentry);
+ }
+ $this->_redirect('/bootmenu');
}
public function deletebootmenuAction()
{
$bootmenuID = $this->_request->getParam('bootmenuID');
- if (!isset($bootmenuID)){
+ if (!isset($bootmenuID) || !is_numeric($bootmenuID)){
$this->_redirect('/bootmenu');
} else {
$bootmenu = new Application_Model_BootMenu();
@@ -139,7 +196,6 @@ class BootmenuController extends Zend_Controller_Action
$bootmenumapper->delete($bootmenu);
}
$this->_redirect('/bootmenu');
- // action body
}