From b8c98e142e9fc23058a51b603a8536df62f2930f Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 8 Apr 2011 14:28:58 +0200 Subject: Endlosschleifen bei falschen Einträgen gefixt --- application/models/GroupGroupsMapper.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'application/models/GroupGroupsMapper.php') 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.'"'; -- cgit v1.2.3-55-g7522