diff options
| author | Simon | 2011-04-14 13:39:56 +0200 |
|---|---|---|
| committer | Simon | 2011-04-14 13:39:56 +0200 |
| commit | 4ef5ef67e07245296fe73d3948d9526338bced63 (patch) | |
| tree | 9317e60083f3279397c9f48aabc421ad65660457 /application/modules/user/controllers/GroupController.php | |
| parent | Es werden keine Sessions mehr angelegt wenn ein Admin die Bootmenuentries tes... (diff) | |
| download | pbs2-4ef5ef67e07245296fe73d3948d9526338bced63.tar.gz pbs2-4ef5ef67e07245296fe73d3948d9526338bced63.tar.xz pbs2-4ef5ef67e07245296fe73d3948d9526338bced63.zip | |
Ticket #207 - Graph wird beim verlinken angezeigt
Diffstat (limited to 'application/modules/user/controllers/GroupController.php')
| -rw-r--r-- | application/modules/user/controllers/GroupController.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 4bebc52..39053ae 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -285,17 +285,39 @@ class User_GroupController extends Zend_Controller_Action { if(!Pbs_Acl::checkRight('glk')) $this->_redirect('/user'); + + $linkableGroups = $this->groupList; + $groupGroupsMapper = new Application_Model_GroupGroupsMapper(); + $childs = array(); + $parents = array(); + $childs = $groupGroupsMapper->getChildGroups($this->membership->getGroupID()); + $parents = $groupGroupsMapper->getParentGroups($this->membership->getGroupID()); + #print_a($childs,$parents); + foreach($linkableGroups as $i => $group){ + #print_a($group->getID()); + if(isset($childs[1]) && in_array($group->getID(),$childs[1])){ + unset($linkableGroups[$i]); + } + if(count($parents) > 0){ + foreach($parents as $d){ + if(in_array($group->getID(),$d)){ + unset($linkableGroups[$i]); + } + } + } + } + #print_a($linkableGroups); if (!isset($_POST["link"])){ - $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList)); + $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups)); } else { - $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList),$_POST); + $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups),$_POST); if ($linkForm->isValid($_POST)) { $groupgroups = new Application_Model_GroupGroups(); if($_POST['superordinatedGroupID'] == $_POST['groupID'] || $_POST['groupID'] == 1) { $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/forbidden'); } - $groupgroups->setParentID($_POST['superordinatedGroupID']); + $groupgroups->setParentID($this->membership->getGroupID()); $groupgroups->setGroupID($_POST['groupID']); try { $this->groupGroupsMapper->save($groupgroups); |
