From f7996a02542d145a682dcb1c059bd05cc573a942 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Mon, 7 Mar 2011 02:17:29 +0100 Subject: BootIso Interface fertig --- application/controllers/BootisoController.php | 112 ++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 application/controllers/BootisoController.php (limited to 'application/controllers/BootisoController.php') diff --git a/application/controllers/BootisoController.php b/application/controllers/BootisoController.php new file mode 100644 index 0000000..771a48d --- /dev/null +++ b/application/controllers/BootisoController.php @@ -0,0 +1,112 @@ +view->bootisolist = $bootisomapper->fetchAll(); + } + + public function createbootisoAction() + { + if (!isset($_POST["createbootiso"])){ + $createbootisoForm = new Application_Form_BootisoCreate(); + } else { + + $createbootisoForm = new Application_Form_BootisoCreate($_POST); + + if ($createbootisoForm->isValid($_POST)) { + + $bootiso = new Application_Model_BootIso($_POST); + $bootiso->setMembershipID('1'); + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootiso->setCreated(time()); + + try { + $bootisomapper->save($bootiso); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "
"; + echo "Message: " . $e->getMessage() . "
"; + + } + $this->_redirect('/bootiso'); + } + } + + $this->view->createbootisoForm = $createbootisoForm; + } + + public function editbootisoAction() + { + $bootisoID = $this->_request->getParam('bootisoID'); + + if (!isset($_POST["editbootiso"])){ + $bootisoID = $this->_request->getParam('bootisoID'); + if (!isset($bootisoID) || !is_numeric($bootisoID)){ + $this->_redirect('/bootiso'); + } else { + $bootiso = new Application_Model_BootIso(); + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootisomapper->find($bootisoID, $bootiso); + + $editbootisoForm = new Application_Form_BootisoEdit(); + $editbootisoForm->populate($bootiso->toArray()); + } + }else{ + $editbootisoForm = new Application_Form_BootisoEdit($_POST); + + if ($editbootisoForm->isValid($_POST)) { + + $bootiso = new Application_Model_BootIso($_POST); + $bootiso->setMembershipID('1'); + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootiso->setCreated(time()); + $bootiso->setID($bootisoID); + + try { + $bootisomapper->save($bootiso); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "
"; + echo "Message: " . $e->getMessage() . "
"; + } + + $this->_redirect('/bootiso'); + } + + } + + $this->view->editbootisoForm = $editbootisoForm; + } + + public function deletebootisoAction() + { + $bootisoID = $this->_request->getParam('bootisoID'); + if (!isset($bootisoID)){ + $this->_redirect('/bootiso'); + } else { + $bootiso = new Application_Model_BootIso(); + $bootiso->setID($bootisoID); + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootisomapper->delete($bootiso); + } + $this->_redirect('/bootiso'); + } + + +} + + + + + + + -- cgit v1.2.3-55-g7522