summaryrefslogblamecommitdiffstats
path: root/application/controllers/ClientController.php
blob: 336bf9e3d4f0c91aa63a3bb2d6d07f822a15e42c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                     

                                                                     



                                     


























                                                                                     






     

 
<?php

class ClientController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
		$clientMapper = new Application_Model_ClientMapper();
		$this->view->clients = $clientMapper->fetchAll();
    }

    public function addclientAction()
    {
        $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');
    }


}