diff options
| author | Simon | 2011-03-07 13:57:04 +0100 |
|---|---|---|
| committer | Simon | 2011-03-07 13:57:04 +0100 |
| commit | 5688b750744f8568414dc745961747e5629bd194 (patch) | |
| tree | d8821314ada6f422d3d362666e7060af502709a3 /application/controllers/PoolController.php | |
| parent | view variable in application.ini hinzugefügt (diff) | |
| download | pbs2-5688b750744f8568414dc745961747e5629bd194.tar.gz pbs2-5688b750744f8568414dc745961747e5629bd194.tar.xz pbs2-5688b750744f8568414dc745961747e5629bd194.zip | |
Pool actions zum bearbeiten von Pools hinzugefügt
Diffstat (limited to 'application/controllers/PoolController.php')
| -rw-r--r-- | application/controllers/PoolController.php | 84 |
1 files changed, 81 insertions, 3 deletions
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php index f9e54be..27e81a3 100644 --- a/application/controllers/PoolController.php +++ b/application/controllers/PoolController.php @@ -11,24 +11,98 @@ class PoolController extends Zend_Controller_Action public function indexAction() { $poolMapper = new Application_Model_PoolMapper(); - $this->view->pools = $poolMapper->fetchAll(); + $this->view->pools = $poolMapper->fetchAll(); } public function createpoolAction() { - // action body + if (!isset($_POST["add"])){ + $addfilterform = new Application_Form_Pool(); + $this->view->addpool = $addfilterform; + }else { + $addpoolform = new Application_Form_Pool($_POST); + if ($addpoolform->isValid($_POST)) { + try{ + $pool = new Application_Model_Pool($_POST); + $poolmapper = new Application_Model_PoolMapper(); + $poolmapper->save($pool); + $this->_redirect('/pool'); + return; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + } } public function deletepoolAction() { - // action body + $poolID = $this->_request->getParam('poolID'); + // TODO: ACL implementieren ob er den pool löschen darf + if(is_numeric($poolID)){ + $deletepool = new Application_Model_Pool(); + $deletepool->setID($poolID); + $poolmapper = new Application_Model_PoolMapper(); + $poolmapper->delete($deletepool); + } + $this->_redirect('/pool'); } public function editpoolAction() { + if (!isset($_POST["add"])){ + $poolID = $this->_request->getParam('poolID'); + + $pool = new Application_Model_Pool(); + $poolmapper = new Application_Model_PoolMapper(); + $poolmapper->find($poolID,$pool); + $poolArray = $pool->toArray(); + + $editpool = new Application_Form_Pool(); + $editpool->populate($poolArray); + $this->view->editpoolform = $editpool; + + }else { + $addpoolform = new Application_Form_Pool($_POST); + if ($addpoolform->isValid($_POST)) { + try{ + $pool = new Application_Model_Pool($_POST); + $pool->setID($this->_request->getParam('poolID')); + $poolmapper = new Application_Model_PoolMapper(); + $poolmapper->save($pool); + $this->_redirect('/pool'); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + } + } + + public function linkclientAction() + { // action body } + public function unlinkclientAction() + { + $poolentriesID = $this->_request->getParam('poolentriesID'); + + // TODO: ACL implementieren ob er den filter löschen darf + if(is_numeric($poolentriesID)){ + $deletepoolentries = new Application_Model_PoolEntries(); + $deletepoolentries->setID($poolentriesID); + echo "<pre style='border:1px solid black;background-color:#F5B800'>"; + print_r($deletepoolentries); + echo "</pre>"; + + $deletepoolentriesmapper = new Application_Model_PoolEntriesMapper(); + $deletepoolentriesmapper->delete($deletepoolentries); + echo "ok"; + } +# echo "ready"; + $this->_redirect('/pool'); + } + } @@ -38,3 +112,7 @@ class PoolController extends Zend_Controller_Action + + + + |
