summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/RoleController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user/controllers/RoleController.php')
-rw-r--r--application/modules/user/controllers/RoleController.php182
1 files changed, 91 insertions, 91 deletions
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 312a647..4a4640f 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -28,7 +28,7 @@ class User_RoleController extends Zend_Controller_Action
$this->rightMapper = new Application_Model_RightMapper();
$this->rightRolesMapper = new Application_Model_RightRolesMapper();
$this->membershipMapper = new Application_Model_MembershipMapper();
-
+
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
@@ -45,60 +45,60 @@ class User_RoleController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('ro')) {
$this->_redirect('/user');
}
- $this->view->membership = $this->membership;
- $groupID = $this->membership->getGroupID();
- $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID),true);
+ $this->view->membership = $this->membership;
+ $groupID = $this->membership->getGroupID();
+ $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID),true);
- $roles = array();
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $parents = $groupGroupsMapper->getParentGroups($groupID);
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- $crawled = array();
- foreach($parents as $p){
- foreach($p as $a){
- if(!in_array($a,$crawled)){
- $crawled[] = $a;
- $group = $groupMapper->find($a);
- if($groupID != $a)
- $r = $roleMapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
- else
- $r = $roleMapper->findBy(array('groupID' => $a));
- foreach($r as $d){
- $roles[$group->getTitle()][] = $d;
- }
+ $roles = array();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $parents = $groupGroupsMapper->getParentGroups($groupID);
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ $crawled = array();
+ foreach($parents as $p){
+ foreach($p as $a){
+ if(!in_array($a,$crawled)){
+ $crawled[] = $a;
+ $group = $groupMapper->find($a);
+ if($groupID != $a)
+ $r = $roleMapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
+ else
+ $r = $roleMapper->findBy(array('groupID' => $a));
+ foreach($r as $d){
+ $roles[$group->getTitle()][] = $d;
}
}
}
- $this->view->roleList = $roles;
+ }
+ $this->view->roleList = $roles;
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('role');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->roleList = $mySearch->search($this->view->roleList);
- }
- $this->view->searchform = $mySearch->searchForm();
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('role');
+ if($search != ''){
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->roleList = $mySearch->search($this->view->roleList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->roleList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->roleList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
+ $this->view->roleList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->addRight = Pbs_Acl::checkRight('ra');
+ $this->view->editRight = Pbs_Acl::checkRight('re');
+ $this->view->deleteRight = Pbs_Acl::checkRight('rd');
+ $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
- $this->view->roleList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->addRight = Pbs_Acl::checkRight('ra');
- $this->view->editRight = Pbs_Acl::checkRight('re');
- $this->view->deleteRight = Pbs_Acl::checkRight('rd');
- $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
- $this->view->userIDsNamespace = $this->userIDsNamespace;
-
}
public function searchAction(){
@@ -113,53 +113,53 @@ class User_RoleController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('ra')) {
$this->_redirect('/user');
}
-
- $roleID = $this->userIDsNamespace['roleID'];
- $rights = $this->rightMapper->fetchAll();
- if(count($rights) > 0) {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- foreach($rights as $right) {
- $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
- $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
- }
+
+ $roleID = $this->userIDsNamespace['roleID'];
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rights) > 0) {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
}
- if (!isset($_POST["add"])){
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
- } else {
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')),$_POST);
- if ($addForm->isValid($_POST)) {
- $_POST['groupID'] = $this->userIDsNamespace['groupID'];
- $role = new Application_Model_Role($_POST);
- try {
- $this->roleMapper->save($role);
- $db = Zend_Db_Table::getDefaultAdapter();
- $insertedRoleID = $db->lastInsertId();
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- foreach($_POST['rights'] as $rightID => $bool) {
- if($bool == 1) {
- $rightrole = new Application_Model_RightRoles();
- $rightrole->setRightID($rightID);
- $rightrole->setRoleID($insertedRoleID);
- try {
- $this->rightRolesMapper->save($rightrole);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
+ }
+ if (!isset($_POST["add"])){
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
+ } else {
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')),$_POST);
+ if ($addForm->isValid($_POST)) {
+ $_POST['groupID'] = $this->userIDsNamespace['groupID'];
+ $role = new Application_Model_Role($_POST);
+ try {
+ $this->roleMapper->save($role);
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $insertedRoleID = $db->lastInsertId();
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightrole = new Application_Model_RightRoles();
+ $rightrole->setRightID($rightID);
+ $rightrole->setRoleID($insertedRoleID);
+ try {
+ $this->rightRolesMapper->save($rightrole);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
}
}
- $this->_helper->redirector('', 'role');
- return;
}
+ $this->_helper->redirector('', 'role');
+ return;
}
- $this->view->addForm = $addForm;
+ }
+ $this->view->addForm = $addForm;
}
public function editAction()
@@ -377,7 +377,7 @@ class User_RoleController extends Zend_Controller_Action
$rightroles = new Application_Model_RightRoles();
$rightroles->setRightID($rightID);
$rightroles->setRoleID($roleID);
-
+
try {
$this->rightRolesMapper->save($rightroles);
} catch(Zend_Exception $e)