membership = new Application_Model_Membership(); $membershipMapper->find($_SESSION['membershipID'],$this->membership); } public function indexAction() { // TODO: ACL: is he athorized to see this ? // Get the Clients which booted with a bootiso of this group $result = $this->_request->getParam('deleteresult'); if($result != ""){ $pbsNotifier = new Pbs_Notifier(); $this->view->notification = $pbsNotifier->notify('delete',$result); } $clientMapper = new Application_Model_ClientMapper(); $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); # print_a($clientsInGroup); $this->view->clients = $clientsInGroup; } public function addclientAction() { // action body } 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/deleteresult/ok'); } else{ $this->_redirect('/user/client/index/deleteresult/forbidden'); } } $this->_redirect('/user/client/index/deleteresult/error'); } public function editclientAction(){ if (!isset($_POST["add"])){ $clientID = $this->_request->getParam('clientID'); $client = new Application_Model_Client(); $mapper = new Application_Model_ClientMapper(); $mapper->find($clientID,$client); if($client->getGroupID() == $this->membership->getGroupID()){ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client')); $editclient->populate($client->toArray()); $this->view->editclient = $editclient; } else{ $this->_redirect('/user/client/index/modifyresult/error'); } } else{ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client','groups'=>$groups),$_POST); if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); $client->setID($this->_request->getParam('clientID')); $clientmapper = new Application_Model_ClientMapper(); $clientmapper->save($client); print_a('updated'); $this->_redirect('/dev/client'); } $this->view->editclient = $editclient; } } }