diff options
| author | Simon | 2011-03-14 16:09:03 +0100 |
|---|---|---|
| committer | Simon | 2011-03-14 16:09:03 +0100 |
| commit | b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c (patch) | |
| tree | fcef50ad1ddf831f457d6aecd83e7fdc63297a1c /application/modules/dev/controllers/BootisoController.php | |
| parent | footer bleibt am fensterbottom (diff) | |
| download | pbs2-b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c.tar.gz pbs2-b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c.tar.xz pbs2-b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c.zip | |
Application in 3 Modules gesplittet, Dev = unsere entwicklungsumgebung, user = die weboberfläche fr anwender mit acl etc, fbgui = für die fbgui truppe - links in dev müssen noch angepasst werden
Diffstat (limited to 'application/modules/dev/controllers/BootisoController.php')
| -rw-r--r-- | application/modules/dev/controllers/BootisoController.php | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/application/modules/dev/controllers/BootisoController.php b/application/modules/dev/controllers/BootisoController.php new file mode 100644 index 0000000..078c962 --- /dev/null +++ b/application/modules/dev/controllers/BootisoController.php @@ -0,0 +1,125 @@ +<?php + +class BootisoController extends Zend_Controller_Action +{ + + public function init() + { + $db = Zend_Db_Table::getDefaultAdapter(); + } + + public function indexAction() + { + $bootisomapper = new Application_Model_BootIsoMapper(); + $groupmapper = new Application_Model_GroupMapper(); + $membershipmapper = new Application_Model_MembershipMapper(); + $personmapper = new Application_Model_PersonMapper(); + + $this->view->bootisolist = $bootisomapper->fetchAll(); + + foreach ($this->view->bootisolist as $bootiso){ + $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupmapper->find($bootiso->getGroupID())->getTitle()); + $bootiso->setMembershipID("[".$bootiso->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootiso->getMembershipID())->getPersonID())->getFirstname()); + } + + } + + public function createbootisoAction() + { + $groupmapper = new Application_Model_GroupMapper(); + + if (!isset($_POST["createbootiso"])){ + $createbootisoForm = new Application_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll())); + } else { + + $createbootisoForm = new Application_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll()),$_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'); + $groupmapper = new Application_Model_GroupMapper(); + + 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(array('grouplist' => $groupmapper->fetchAll())); + $editbootisoForm->populate($bootiso->toArray()); + } + }else{ + $editbootisoForm = new Application_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll()),$_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'); + } + + +} + + + + + + + |
