summaryrefslogtreecommitdiffstats
path: root/application/controllers/ClientController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/ClientController.php')
-rw-r--r--application/controllers/ClientController.php33
1 files changed, 31 insertions, 2 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
+
+