diff options
Diffstat (limited to 'application/models/GroupGroupsMapper.php')
| -rw-r--r-- | application/models/GroupGroupsMapper.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php index a1329fe..535c380 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -113,11 +113,14 @@ class Application_Model_GroupGroupsMapper } return $entries; } + private $crawledNodes; // Gets All groupIDs of the parent groups begins with the public function getParentGroups($groupID, &$data=null, $level=0) { - - $data[$level][] = $groupID; + if($this->crawledNodes['parent'][$groupID] == 1) + return; + $this->crawledNodes['parent'][$groupID] = 1; + $data[$level][] = $groupID; $db = Zend_Db_Table::getDefaultAdapter(); $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"'; $stmt = $db->query($query); @@ -127,10 +130,13 @@ class Application_Model_GroupGroupsMapper $data = $this->getParentGroups($row['parentID'], $data, $level+1); } return $data; - } - + } // Gets all childs-groups from a given group public function getChildGroups($groupID, &$data=null, $level=0) { + if($this->crawledNodes['child'][$groupID] == 1) + return; + $this->crawledNodes['child'][$groupID] = 1; + $data[$level][] = $groupID; $db = Zend_Db_Table::getDefaultAdapter(); $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"'; |
