summaryrefslogtreecommitdiffstats
path: root/application/modules/dev/controllers/RoleController.php
diff options
context:
space:
mode:
authorSebastian Schmelzer2012-01-11 15:22:32 +0100
committerSebastian Schmelzer2012-01-11 15:22:32 +0100
commit83767be80c29e3d3ca99f4a7d2eaab97f8256d1b (patch)
tree354ee1ba3343291cd389aea69582d677fb7b8a26 /application/modules/dev/controllers/RoleController.php
parentfix stylecode output (diff)
downloadpbs2-83767be80c29e3d3ca99f4a7d2eaab97f8256d1b.tar.gz
pbs2-83767be80c29e3d3ca99f4a7d2eaab97f8256d1b.tar.xz
pbs2-83767be80c29e3d3ca99f4a7d2eaab97f8256d1b.zip
remove unused stuff
Diffstat (limited to 'application/modules/dev/controllers/RoleController.php')
-rw-r--r--application/modules/dev/controllers/RoleController.php280
1 files changed, 0 insertions, 280 deletions
diff --git a/application/modules/dev/controllers/RoleController.php b/application/modules/dev/controllers/RoleController.php
deleted file mode 100644
index db39f46..0000000
--- a/application/modules/dev/controllers/RoleController.php
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
-* This program is free software distributed under the GPL version 2.
-* See http://gpl.openslx.org/
-*
-* If you have any feedback please consult http://feedback.openslx.org/ and
-* send your suggestions, praise, or complaints to feedback@openslx.org
-*
-* General information about OpenSLX can be found at http://openslx.org/
-*/
-
-class dev_RoleController extends Zend_Controller_Action {
- protected $roleMapper;
- protected $rightMapper;
- protected $rightRolesMapper;
-
- public function init() {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->roleMapper = new Application_Model_RoleMapper();
- $this->rightMapper = new Application_Model_RightMapper();
- $this->rightRolesMapper = new Application_Model_RightRolesMapper();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- }
-
- public function indexAction() {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- $roleList = $this->roleMapper->findBy(array('groupID' => $roleNamespace['groupID']), true);
- $this->view->groupID = $roleNamespace['groupID'];
- $this->view->roleList = $roleList;
- } else {
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
- }
-
- public function addAction() {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- if (!isset($_POST["add"])) {
- $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList));
- } else {
- $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList), $_POST);
- if ($addForm->isValid($_POST)) {
-
- $_POST['groupID'] = $roleNamespace['groupID'];
- $role = new Application_Model_Role($_POST);
- try {
- $this->roleMapper->save($role);
- } catch(Zend_Exception $e) {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- $this->view->addForm = $addForm;
- } else {
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
- }
-
- public function editAction() {
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- $addForm = new dev_Form_RoleAdd();
- $this->view->addForm = $addForm;
- return;
- }
- if (!isset($_POST["save"])) {
- $role = $this->roleMapper->find($roleID);
- $_POST['title'] = $role->getTitle();
- $_POST['description'] = $role->getDescription();
- $_POST['groupID'] = $role->getGroupID();
- $_POST['inheritance'] = $role->getInheritance();
- $editForm = new dev_Form_RoleEdit();
- } else {
- $editForm = new dev_Form_RoleEdit($_POST);
- if ($editForm->isValid($_POST)) {
- $role = new Application_Model_Role($_POST);
- $role->setID($this->_request->getParam('roleID'));
- try {
- $this->roleMapper->save($role);
- } catch(Zend_Exception $e) {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
- $this->view->editForm = $editForm;
- }
-
- public function showAction() {
- $roleID = $this->_request->getParam('roleID');
- if($roleID) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
- if(count($rightroles) > 0) {
- foreach($rightroles as $rightrole) {
- $right = $this->rightMapper->find($rightrole['rightID']);
- $rightsList[] = $right;
- }
- if(is_array($rightsList)) {
- $this->view->rightsList = $rightsList;
- }
- }
- $this->view->role = $this->roleMapper->find($roleID);
- $this->view->roleID = $roleID;
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function deleteAction() {
- $this->_helper->viewRenderer->setNoRender();
- $roleID = $this->_request->getParam('roleID');
- if (isset($roleID)) {
- $role = $this->roleMapper->find($roleID);
- try {
- $this->roleMapper->delete($role);
- } catch(Zend_Exception $e) {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function linkrightAction() {
- $roleID = $this->_request->getParam('roleID');
- if(isset($roleID)) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
- $rights = $this->rightMapper->fetchAll();
- if(count($rightroles) > 0) {
- if(count($rights) > 0) {
- foreach($rights as $right) {
- foreach($rightroles as $rightrole) {
- if($right->getID() == $rightrole['rightID']) {
- $found = true;
- break;
- }
- }
- if(!$found) {
- $rightlist[] = $right;
- }
- $found = false;
- }
- }
- } else {
- $rightlist = $rights;
- }
- if(count($rightlist) > 0) {
- if (!isset($_POST["link"])) {
- $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
- } else {
- $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist), $_POST);
- if ($linkForm->isValid($_POST)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($_POST['rightID']);
- $rightroles->setRoleID($roleID);
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e) {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- }
- $this->view->linkForm = $linkForm;
- } else {
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function unlinkrightAction() {
- $this->_helper-> viewRenderer-> setNoRender();
- $rightRolesID = $this->_request->getParam('rightrolesID');
- if(isset($rightRolesID)) {
- $rightRolesID = explode('-', $rightRolesID);
- $roleID = $rightRolesID[0];
- $rightID = $rightRolesID[1];
- if (isset($roleID) && isset($rightID)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRoleID($roleID);
- $rightroles->setRightID($rightID);
- try {
- $this->rightRolesMapper->delete($rightroles);
- } catch(Zend_Exception $e) {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function groupselectAction() {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- $this->_helper->redirector('', 'role');
- } else {
- if(isset($_POST['selectgroup'])) {
- $roleSession = new Zend_Session_Namespace('role');
- $roleSession->groupID = $_POST['groupID'];
- $this->_helper->redirector('', 'role');
- return;
- } else {
- $personMapper = new Application_Model_PersonMapper();
- $result = $personMapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $membershipMapper = new Application_Model_MembershipMapper();
- $memberships = $membershipMapper->findBy(array("personID" => $person->getID(), true));
- $groupMapper = new Application_Model_GroupMapper();
- if(isset($memberships)) {
- foreach($memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $groupList[] = $group;
- }
- }
- $groupSelectForm = new dev_Form_GroupSelect(array('grouplist' => $groupList));
- $this->view->groupSelectForm = $groupSelectForm;
- }
- }
- }
-
- public function changegroupAction() {
- $this->_helper-> viewRenderer-> setNoRender();
- Zend_Session::namespaceUnset('role');
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
-
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-