From e242fc0729b326637ebd4d3602aa604341bdbb03 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 8 Apr 2011 14:04:07 +0200 Subject: graph nun auch mit mehreren gleihen kindern --- library/Pbs/Graph.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'library') diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index 1431c70..3b20cea 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -6,6 +6,7 @@ class Pbs_Graph{ private $membership; private $graphstring; private $level; + private $edges; public function graph($groupID) { @@ -46,7 +47,10 @@ class Pbs_Graph{ foreach($result as $row){ // save the current groupID in level-list #$data[$level][] = $row['parentID']; - $this->graphstring .= '"'.$this->getGroupTitle($row['parentID']).'" -> "'.$this->getGroupTitle($groupID).'";'."\n"; + if($this->edges[$row['parentID']][$groupID] != 1){ + $this->graphstring .= '"'.$this->getGroupTitle($row['parentID']).'" -> "'.$this->getGroupTitle($groupID).'";'."\n"; + $this->edges[$row['parentID']][$groupID] = 1; + } // get the function recursive an increase the level $this->getParentGroups($row['parentID'], $level+1); } @@ -61,7 +65,10 @@ class Pbs_Graph{ foreach($result as $row){ // save the current groupID in level-list #$data[$level][] = $row['groupID']; - $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n"; + if($this->edges[$groupID][$row['groupID']] != 1){ + $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n"; + $this->edges[$groupID][$row['groupID']] = 1; + } if($this->level >= $level){ $this->graphstring .= '"'.$this->getGroupTitle($row['groupID']).'"'.' [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'."\n"; } -- cgit v1.2.3-55-g7522