summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/ClientController.php
diff options
context:
space:
mode:
authorSimon Franz2011-03-16 16:19:28 +0100
committerSimon Franz2011-03-16 16:19:28 +0100
commit7bb045fa152dec51a75f1ba8c45c016ba96c587c (patch)
tree4dae9da1ce80771ee43b387d8e6d81ff253c1cd1 /application/modules/user/controllers/ClientController.php
parentsql-newdata korrigiert (diff)
downloadpbs2-7bb045fa152dec51a75f1ba8c45c016ba96c587c.tar.gz
pbs2-7bb045fa152dec51a75f1ba8c45c016ba96c587c.tar.xz
pbs2-7bb045fa152dec51a75f1ba8c45c016ba96c587c.zip
ClientController geändert, Forms können in FBGui und User nicht benutzt werden
Diffstat (limited to 'application/modules/user/controllers/ClientController.php')
-rw-r--r--application/modules/user/controllers/ClientController.php55
1 files changed, 37 insertions, 18 deletions
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index bd111cf..f5f1810 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -16,17 +16,10 @@ 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
- $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;
+ $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());
@@ -53,19 +46,45 @@ class User_ClientController extends Zend_Controller_Action
if($client->getGroupID() == $this->membership->getGroupID()){
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->delete($client);
- $this->_redirect('/user/client/index/result/ok');
+ $this->_redirect('/user/client/index/deleteresult/ok');
}
else{
- $this->_redirect('/user/client/index/result/forbidden');
+ $this->_redirect('/user/client/index/deleteresult/forbidden');
}
}
- $this->_redirect('/user/client/index/result/error');
- // action body
+ $this->_redirect('/user/client/index/deleteresult/error');
}
- public function editclientAction()
- {
- // action body
+ 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()){
+ # print_a($this);die();
+ $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;
+ }
}