From e242fc0729b326637ebd4d3602aa604341bdbb03 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 8 Apr 2011 14:04:07 +0200 Subject: graph nun auch mit mehreren gleihen kindern --- library/Pbs/Graph.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'library/Pbs/Graph.php') diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index 1431c70..3b20cea 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -6,6 +6,7 @@ class Pbs_Graph{ private $membership; private $graphstring; private $level; + private $edges; public function graph($groupID) { @@ -46,7 +47,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); } @@ -61,7 +65,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"; } -- cgit v1.2.3-55-g7522 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 ++++++++++---- application/modules/user/views/scripts/bootiso/index.phtml | 4 ++-- library/Pbs/Graph.php | 7 +++++++ library/Pbs/Pagination.php | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'library/Pbs/Graph.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.'"'; 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 @@
bootisolist)==0) echo "There are no BootISO entries to display." ?> - bootisolist as $bootiso): ?> + bootisolist as $k => $bootiso): ?>
-
escape($bootiso->getID()); ?>
+
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 From 4a8cb9a0fedbd61c087b2ffc6e480693997746f8 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 8 Apr 2011 15:09:04 +0200 Subject: Notifies im Log verbessert --- application/modules/user/controllers/BootmenuController.php | 3 +-- library/Pbs/Graph.php | 4 ++-- library/Pbs/Search.php | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'library/Pbs/Graph.php') diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index a79a770..adcf08f 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -106,9 +106,8 @@ class user_BootmenuController extends Zend_Controller_Action $pagination->setElement($bootmenu); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/bootmenu/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); - $bootmenu = $pagination->getElements(); + $bootmenu = $pagination->getElements(); - $this->view->pagination = $pagination->pagination($pageurl); $this->view->page = $pagination->getRequestPage(); $this->view->bootmenulist = $bootmenu; diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index 521275d..c924b59 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -62,7 +62,7 @@ class Pbs_Graph{ // Gets all childs-groups from a given group private function getChildGroups($groupID, $level=1) { - if($this->crawledNodes['child'][$groupID] == 1) + if(@$this->crawledNodes['child'][$groupID] == 1) return; $this->crawledNodes['child'][$groupID] = 1; $db = Zend_Db_Table::getDefaultAdapter(); @@ -72,7 +72,7 @@ class Pbs_Graph{ foreach($result as $row){ // save the current groupID in level-list #$data[$level][] = $row['groupID']; - if($this->edges[$groupID][$row['groupID']] != 1){ + if(@$this->edges[$groupID][$row['groupID']] != 1){ $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n"; $this->edges[$groupID][$row['groupID']] = 1; } diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 127c4d3..9f25d03 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -74,8 +74,8 @@ class Pbs_Search{ preg_match_all("!\"(.*?)\"!is",$this->searchTerm,$matches); $tmpsearch = $this->searchTerm; for($i=0;$i<=count($matches[0]);$i++){ - $replace = str_replace(" ","<|>",$matches[0][$i]); - $tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch); + @$replace = str_replace(" ","<|>",$matches[0][$i]); + @$tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch); } $parts = explode(" ",$tmpsearch); foreach($parts as $search){ @@ -94,8 +94,8 @@ class Pbs_Search{ $searchb[] = $search; } } - $this->searcha = $searcha; - $this->searchb = $searchb; + $this->searcha = @$searcha; + $this->searchb = @$searchb; #print_a($searcha, $searchb); } public function getSearchTerm(){ -- cgit v1.2.3-55-g7522