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 | |
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')
-rw-r--r-- | application/modules/user/controllers/GroupController.php | 28 | ||||
-rw-r--r-- | application/modules/user/forms/GroupLink.php | 25 | ||||
-rw-r--r-- | application/modules/user/views/scripts/group/link.phtml | 13 |
3 files changed, 51 insertions, 15 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); diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php index 9bddb19..9aba5a4 100644 --- a/application/modules/user/forms/GroupLink.php +++ b/application/modules/user/forms/GroupLink.php @@ -13,28 +13,31 @@ class user_Form_GroupLink extends Zend_Form { $this->setName("GroupLink"); $this->setMethod('post'); - - $groupfield = $this->createElement('select','groupID'); - $groupfield ->setLabel('Group:'); + +/* + $groupfield1 = $this->createElement('select','superordinatedGroupID'); + $groupfield1 ->setLabel('Parent Group:'); if(count($this->grouplist)>0){ foreach($this->grouplist as $group => $g){ - $groupfield->addMultiOption($g->getID(), $g->getTitle()); + $groupfield1->addMultiOption($g->getID(), $g->getTitle()); } } - $groupfield->setRegisterInArrayValidator(false); - $this->addElement($groupfield); + $groupfield1->setRegisterInArrayValidator(false); + $this->addElement($groupfield1); + */ - $groupfield1 = $this->createElement('select','superordinatedGroupID'); - $groupfield1 ->setLabel('superordinated Group:'); + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + $groupfield->setAttrib('onchange', "reloadGraph();"); if(count($this->grouplist)>0){ foreach($this->grouplist as $group => $g){ - $groupfield1->addMultiOption($g->getID(), $g->getTitle()); + $groupfield->addMultiOption($g->getID(), $g->getTitle()); } } - $groupfield1->setRegisterInArrayValidator(false); - $this->addElement($groupfield1); + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); $this->addElement('submit', 'link', array( 'required' => false, diff --git a/application/modules/user/views/scripts/group/link.phtml b/application/modules/user/views/scripts/group/link.phtml index 5bb2a9d..1f3fbfa 100644 --- a/application/modules/user/views/scripts/group/link.phtml +++ b/application/modules/user/views/scripts/group/link.phtml @@ -2,4 +2,15 @@ <?php $this->linkForm->setAction($this->url()); echo $this->linkForm; -?>
\ No newline at end of file +?> +<div class='bottomimg'><img id='depthimg' /></div> + +<script type="text/javascript"> + $(document).ready(function(){ + reloadGraph(); + }); + function reloadGraph(){ + i = $("#groupID option:selected").val(); + $('#depthimg').attr('src','/stats/graphgroup/child/' + i); + } +</script> |