diff options
| author | michael pereira | 2011-03-07 02:17:29 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-07 02:17:29 +0100 |
| commit | f7996a02542d145a682dcb1c059bd05cc573a942 (patch) | |
| tree | 98e53b783dec4935526b91ad5d05eb997a72a4bc /application/controllers/BootisoController.php | |
| parent | bootstrap für benutzung von globalem css vorbereitet (diff) | |
| download | pbs2-f7996a02542d145a682dcb1c059bd05cc573a942.tar.gz pbs2-f7996a02542d145a682dcb1c059bd05cc573a942.tar.xz pbs2-f7996a02542d145a682dcb1c059bd05cc573a942.zip | |
BootIso Interface fertig
Diffstat (limited to 'application/controllers/BootisoController.php')
| -rw-r--r-- | application/controllers/BootisoController.php | 112 |
1 files changed, 112 insertions, 0 deletions
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 @@ +<?php + +class BootisoController extends Zend_Controller_Action +{ + + public function init() + { + $db = Zend_Db_Table::getDefaultAdapter(); + } + + public function indexAction() + { + $bootisomapper = new Application_Model_BootIsoMapper(); + $this->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) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + + } + $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) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + } + + $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'); + } + + +} + + + + + + + |
