summaryrefslogtreecommitdiffstats
path: root/library/Pbs/Graph.php
diff options
context:
space:
mode:
authormichael pereira2011-04-08 15:20:55 +0200
committermichael pereira2011-04-08 15:20:55 +0200
commit7067b772abaf370fb9b73c33e4b92d4dfbc5b2cf (patch)
tree6d901d595c04b9b5156b6803bfb2fbcb2785273c /library/Pbs/Graph.php
parentkcl gefixt (diff)
parentFooter ist wieder an der Box (diff)
downloadpbs2-7067b772abaf370fb9b73c33e4b92d4dfbc5b2cf.tar.gz
pbs2-7067b772abaf370fb9b73c33e4b92d4dfbc5b2cf.tar.xz
pbs2-7067b772abaf370fb9b73c33e4b92d4dfbc5b2cf.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'library/Pbs/Graph.php')
-rw-r--r--library/Pbs/Graph.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php
index 1431c70..c924b59 100644
--- a/library/Pbs/Graph.php
+++ b/library/Pbs/Graph.php
@@ -6,6 +6,8 @@ class Pbs_Graph{
private $membership;
private $graphstring;
private $level;
+ private $edges;
+ private $crawledNodes;
public function graph($groupID)
{
@@ -39,6 +41,9 @@ class Pbs_Graph{
}
private function getParentGroups($groupID, $level=1) {
+ if($this->crawledNodes['parent'][$groupID] == 1)
+ return;
+ $this->crawledNodes['parent'][$groupID] = 1;
$db = Zend_Db_Table::getDefaultAdapter();
$query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
$stmt = $db->query($query);
@@ -46,7 +51,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);
}
@@ -54,6 +62,9 @@ class Pbs_Graph{
// Gets all childs-groups from a given group
private function getChildGroups($groupID, $level=1) {
+ if(@$this->crawledNodes['child'][$groupID] == 1)
+ return;
+ $this->crawledNodes['child'][$groupID] = 1;
$db = Zend_Db_Table::getDefaultAdapter();
$query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
$stmt = $db->query($query);
@@ -61,7 +72,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";
}