diff options
| author | sf34 | 2011-03-05 19:57:06 +0100 |
|---|---|---|
| committer | sf34 | 2011-03-05 19:57:06 +0100 |
| commit | 5016fdbdeacefa697856c3576f7b57537536f031 (patch) | |
| tree | 02cda90db98a659eaec19eb7576605bbb8bfbd5d /application/controllers/BootosController.php | |
| parent | Primary Key inn filterentries eingeführt um meherere Elemente eines Filterty... (diff) | |
| parent | BootOS create, edit und delete done (diff) | |
| download | pbs2-5016fdbdeacefa697856c3576f7b57537536f031.tar.gz pbs2-5016fdbdeacefa697856c3576f7b57537536f031.tar.xz pbs2-5016fdbdeacefa697856c3576f7b57537536f031.zip | |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
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'); + } |
