diff options
| author | michael pereira | 2011-03-16 16:35:20 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-16 16:35:20 +0100 |
| commit | b09352fc9ec322ea0ae744077a66fcaf61465ed5 (patch) | |
| tree | b9e45999ce4d1eaa08035601bfd8f14f91547d30 /application/modules/user/controllers | |
| parent | KCLAppend hinzugefuegt, KCL fertig :-) (diff) | |
| parent | ClientController geändert, Forms können in FBGui und User nicht benutzt werden (diff) | |
| download | pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.gz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.xz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.zip | |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/modules/user/controllers')
4 files changed, 132 insertions, 10 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 4721616..76dc243 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -11,6 +11,7 @@ class User_AuthController extends Zend_Controller_Action public function indexAction() { // action body + $_SESSION['membershipID'] = 1; } diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 54280f4..f5f1810 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -2,17 +2,97 @@ class User_ClientController extends Zend_Controller_Action { - + private $membership; public function init() { /* Initialize action controller here */ + $membershipMapper = new Application_Model_MembershipMapper(); + $this->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()){ + # 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; + } + } + } + + + + + + diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php index 1d41157..8b295e0 100644 --- a/application/modules/user/controllers/IndexController.php +++ b/application/modules/user/controllers/IndexController.php @@ -2,20 +2,26 @@ class User_IndexController extends Zend_Controller_Action { - public function init() { /* Initialize action controller here */ } - public function indexAction() - { - $n = new Pbs_PbsSession(); - $session = new Application_Model_Session(); - $session->setID('1'); - $n->createsession($session); + public function indexAction() + { + if (!Zend_Auth::getInstance()->hasIdentity()) { + $this->view->text = 'Your not logged in, please log in first <a href="/user/auth/">here</a>.'; + } + else{ + $this->view->text = "You're Welcome"; + $links = array( + '/user/person' => 'Change your Details', + '/user/person/request' => 'Request Membership in a Group', + '/user/config' => 'Create your own Configuration', + '/user/bootmenu' => 'Create your Bootmenu', + ); + } + $this->view->links = $links; } - - } diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index caa7dd4..cf4dfe7 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -13,6 +13,41 @@ class User_PoolController extends Zend_Controller_Action // action body } + public function createpoolAction() + { + // action body + } + + public function deletepoolAction() + { + // action body + } + + public function editpoolAction() + { + // action body + } + + public function linkclientAction() + { + // action body + } + + public function unlinkclientAction() + { + // action body + } + } + + + + + + + + + + |
