summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorSimon2011-03-06 19:56:24 +0100
committerSimon2011-03-06 19:56:24 +0100
commitdee12ef18da0dc4db4f1a87c62aa98d321b76bac (patch)
tree3fab7bd3fdc9cc218424e1ec8a97e430e0e7eb2f /application/controllers
parentClient und Pool-Controller hinzugefügt && addclientAction hinzugefügt (diff)
downloadpbs2-dee12ef18da0dc4db4f1a87c62aa98d321b76bac.tar.gz
pbs2-dee12ef18da0dc4db4f1a87c62aa98d321b76bac.tar.xz
pbs2-dee12ef18da0dc4db4f1a87c62aa98d321b76bac.zip
clients hinzufügen und entfernen && sql-data erweitert
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/ClientController.php33
-rw-r--r--application/controllers/FilterController.php4
2 files changed, 33 insertions, 4 deletions
diff --git a/application/controllers/ClientController.php b/application/controllers/ClientController.php
index 6c72fc3..336bf9e 100644
--- a/application/controllers/ClientController.php
+++ b/application/controllers/ClientController.php
@@ -10,12 +10,39 @@ class ClientController extends Zend_Controller_Action
public function indexAction()
{
- // action body
+ $clientMapper = new Application_Model_ClientMapper();
+ $this->view->clients = $clientMapper->fetchAll();
}
public function addclientAction()
{
- // action body
+ $mac = $this->_request->getParam('mac');
+ $hh = $this->_request->getParam('hh');
+
+ if($mac != '' && $hh != ''){
+ $client = new Application_Model_Client();
+ $client->setMacadress($mac);
+ $client->setHardwarehash($hh);
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ print_a('inserted');
+ }
+ else{
+ print_a('no insert');
+ }
+ }
+
+ public function removeclientAction()
+ {
+ $clientID = $this->_request->getParam('clientID');
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($clientID)){
+ $removeClient = new Application_Model_Client();
+ $removeClient->setID($clientID);
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientMapper->delete($removeClient);
+ }
+ $this->_redirect('/client');
}
@@ -23,3 +50,5 @@ class ClientController extends Zend_Controller_Action
+
+
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index ab24ce2..1305689 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -25,9 +25,9 @@ class FilterController extends Zend_Controller_Action
$this->view->filterentries = $filterentries->fetchAll();
- }catch (Zend_Exception $e) {
+ }catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- }
+ }
}
public function addfilterAction()