diff options
Diffstat (limited to 'application/modules/user/controllers/ClientController.php')
| -rw-r--r-- | application/modules/user/controllers/ClientController.php | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index a8d0d3d..bd111cf 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -2,7 +2,7 @@ class User_ClientController extends Zend_Controller_Action { - private $this->membership; + private $membership; public function init() { /* Initialize action controller here */ @@ -15,15 +15,24 @@ class User_ClientController extends Zend_Controller_Action { // TODO: ACL: is he athorized to see this ? - // Get the Clients which booted with a bootiso of this group - $groupID = $this->membership->getGroupID(); - $bootisoMapper = new Application_Model_BootIsoMapper(); - $bootisos = $bootisoMapper->findby('groupID',$groupID); - - $sessions - - - + // Get the Clients which booted with a bootiso of this group + $result = $this->_request->getParam('result'); + switch($result){ + case "forbidden": + echo "<div class='errorbox'>Not allowed to delete this</div>"; + break; + case "ok": + echo "<div class='checkbox'>Delete sucessful</div>"; + break; + case "error": + echo "<div class='warningbox'>There was an error deleting</div>"; + break; + } + $clientMapper = new Application_Model_ClientMapper(); + $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); + # print_a($clientsInGroup); + + $this->view->clients = $clientsInGroup; } @@ -34,6 +43,23 @@ class User_ClientController extends Zend_Controller_Action public function removeclientAction() { + $clientID = $this->_request->getParam('clientID'); + // TODO: ACL: is he authorized to delete clients? + $clientMapper = new Application_Model_ClientMapper(); + if(is_numeric($clientID)){ + $client = new Application_Model_Client(); + $clientMapper->find($clientID,$client); + // TODO: ACL: Is He authorized to delete + if($client->getGroupID() == $this->membership->getGroupID()){ + $clientMapper = new Application_Model_ClientMapper(); + $clientMapper->delete($client); + $this->_redirect('/user/client/index/result/ok'); + } + else{ + $this->_redirect('/user/client/index/result/forbidden'); + } + } + $this->_redirect('/user/client/index/result/error'); // action body } |
