From 0e017ebdc1edbbf230f0f0160f103c39ef675725 Mon Sep 17 00:00:00 2001
From: michael pereira
Date: Sun, 6 Mar 2011 20:12:36 +0100
Subject: datenbank erweitert, BootMenu, Config fertig
---
application/controllers/BootmenuController.php | 85 ++++++++++++++++++++++++--
1 file changed, 80 insertions(+), 5 deletions(-)
(limited to 'application/controllers/BootmenuController.php')
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index 20f471e..e20ef23 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -5,12 +5,13 @@ class BootmenuController extends Zend_Controller_Action
public function init()
{
- /* Initialize action controller here */
- }
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
public function indexAction()
{
- // action body
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $this->view->bootmenulist = $bootmenumapper->fetchAll();
}
public function addbootmenuentryAction()
@@ -20,12 +21,76 @@ class BootmenuController extends Zend_Controller_Action
public function createbootmenuAction()
{
- // action body
+ if (!isset($_POST["createbootmenu"])){
+ $createbootmenuForm = new Application_Form_BootmenuCreate();
+ } else {
+
+ $createbootmenuForm = new Application_Form_BootmenuCreate($_POST);
+
+ if ($createbootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setMembershipID('1');
+ $bootmenu->setCreated(time());
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+
+ try {
+ $bootmenumapper->save($bootmenu);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "
";
+ echo "Message: " . $e->getMessage() . "
";
+
+ }
+ $this->_redirect('/bootmenu');
+ }
+ }
+
+ $this->view->createbootmenuForm = $createbootmenuForm;
}
public function editbootmenuAction()
{
- // action body
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+
+ if (!isset($_POST["editbootmenu"])){
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!isset($bootmenuID) || !is_numeric($bootmenuID)){
+ $this->_redirect('/bootmenu');
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenumapper->find($bootmenuID, $bootmenu);
+
+ $editbootmenuForm = new Application_Form_BootmenuEdit();
+ $editbootmenuForm->populate($bootmenu->toArray());
+ }
+ }else{
+ $editbootmenuForm = new Application_Form_BootmenuEdit($_POST);
+
+ if ($editbootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setMembershipID('1');
+ $bootmenu->setCreated(time());
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+
+ $bootmenu->setID($bootmenuID);
+
+ try {
+ $bootmenumapper->save($bootmenu);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "
";
+ echo "Message: " . $e->getMessage() . "
";
+ }
+
+ $this->_redirect('/bootmenu');
+ }
+
+ }
+
+ $this->view->editbootmenuForm = $editbootmenuForm;
}
public function editbootmenuentryAction()
@@ -40,6 +105,16 @@ class BootmenuController extends Zend_Controller_Action
public function deletebootmenuAction()
{
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!isset($bootmenuID)){
+ $this->_redirect('/bootmenu');
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenu->setID($bootmenuID);
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenumapper->delete($bootmenu);
+ }
+ $this->_redirect('/bootmenu');
// action body
}
--
cgit v1.2.3-55-g7522