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 --- library/Pbs/Graph.php | 7 +++++++ library/Pbs/Pagination.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'library') diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index 3b20cea..521275d 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -7,6 +7,7 @@ class Pbs_Graph{ private $graphstring; private $level; private $edges; + private $crawledNodes; public function graph($groupID) { @@ -40,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); @@ -58,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); diff --git a/library/Pbs/Pagination.php b/library/Pbs/Pagination.php index c31dacf..0be192c 100644 --- a/library/Pbs/Pagination.php +++ b/library/Pbs/Pagination.php @@ -74,7 +74,7 @@ class Pbs_Pagination{ return $this->requestpage * $this->perpage; } public function getElements(){ - return array_slice($this->element,$this->getStartItem(),$this->getPerPage()); + return array_slice($this->element,$this->getStartItem(),$this->getPerPage(),true); } public function setPageUrl($url){ $this->pageUrl = $url; -- cgit v1.2.3-55-g7522