diff options
author | Simon | 2011-04-08 14:28:58 +0200 |
---|---|---|
committer | Simon | 2011-04-08 14:28:58 +0200 |
commit | b8c98e142e9fc23058a51b603a8536df62f2930f (patch) | |
tree | 6fd78a14ae9361ef604c118a847c256efc37a338 | |
parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
download | pbs2-b8c98e142e9fc23058a51b603a8536df62f2930f.tar.gz pbs2-b8c98e142e9fc23058a51b603a8536df62f2930f.tar.xz pbs2-b8c98e142e9fc23058a51b603a8536df62f2930f.zip |
Endlosschleifen bei falschen Einträgen gefixt
-rw-r--r-- | application/models/GroupGroupsMapper.php | 14 | ||||
-rw-r--r-- | application/modules/user/views/scripts/bootiso/index.phtml | 4 | ||||
-rw-r--r-- | library/Pbs/Graph.php | 7 | ||||
-rw-r--r-- | library/Pbs/Pagination.php | 2 |
4 files changed, 20 insertions, 7 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.'"'; diff --git a/application/modules/user/views/scripts/bootiso/index.phtml b/application/modules/user/views/scripts/bootiso/index.phtml index 4af8c0e..1c0c5fe 100644 --- a/application/modules/user/views/scripts/bootiso/index.phtml +++ b/application/modules/user/views/scripts/bootiso/index.phtml @@ -19,9 +19,9 @@ <div class='listelement'> <?php if(count($this->bootisolist)==0) echo "There are no BootISO entries to display." ?> - <?php foreach ($this->bootisolist as $bootiso): ?> + <?php foreach ($this->bootisolist as $k => $bootiso): ?> <div class='element'> - <div class='number'><?php echo $this->escape($bootiso->getID()); ?></div> + <div class='number'><?php echo $k+1; ?></div> <div class='content'> <div class='actions'> <a href="<?php echo $this->url( 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; |