diff options
| author | michael pereira | 2011-03-05 18:59:46 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-05 18:59:46 +0100 |
| commit | aa1aea290b8034e3187a4f223cacb53ea7837a31 (patch) | |
| tree | fb1140701f4f7acddae9a7790bc91b7a9c253be3 /application/controllers/BootosController.php | |
| parent | filter-oberffäche fertig, nun zur auswahl des bootmenus && funktion toArray ... (diff) | |
| download | pbs2-aa1aea290b8034e3187a4f223cacb53ea7837a31.tar.gz pbs2-aa1aea290b8034e3187a4f223cacb53ea7837a31.tar.xz pbs2-aa1aea290b8034e3187a4f223cacb53ea7837a31.zip | |
BootOS create, edit und delete done
Diffstat (limited to 'application/controllers/BootosController.php')
| -rw-r--r-- | application/controllers/BootosController.php | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php index 7ce4ae3..5f096a6 100644 --- a/application/controllers/BootosController.php +++ b/application/controllers/BootosController.php @@ -39,8 +39,7 @@ class BootosController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; } - echo "BootOS erfolgreich angelegt. <br/>"; - return; + $this->_redirect('/bootos'); } } @@ -49,12 +48,63 @@ class BootosController extends Zend_Controller_Action public function editbootosAction() { - // action body + $bootosID = $this->_request->getParam('bootosID'); + + if (!isset($_POST["editbootos"])){ + $bootosID = $this->_request->getParam('bootosID'); + if (!isset($bootosID)){ + $this->_redirect('/bootos'); + } else { + $bootos = new Application_Model_BootOs(); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootosmapper->find($bootosID, $bootos); + + $editbootosForm = new Application_Form_BootosEdit(); + $editbootosForm->populate($bootos->toArray()); + } + }else{ + $editbootosForm = new Application_Form_BootosEdit($_POST); + + if ($editbootosForm->isValid($_POST)) { + + $bootos = new Application_Model_BootOs($_POST); + if($bootos->getConfigID() == '') + $bootos->setConfigID(NULL); + $bootosmapper = new Application_Model_BootOsMapper(); + $date = new DateTime(); + $bootos->setCreated($date->getTimestamp()); + $bootos->setID($bootosID); + + try { + $bootosmapper->save($bootos); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + } + + $this->_redirect('/bootos'); + } + + } + + $this->view->editbootosForm = $editbootosForm; + } public function deletebootosAction() { - // action body + $bootosID = $this->_request->getParam('bootosID'); + if (!isset($bootosID)){ + $this->_redirect('/bootos'); + } else { + $bootos = new Application_Model_BootOs(); + $bootos->setID($bootosID); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootosmapper->delete($bootos); + } + $this->_redirect('/bootos'); + } |
