diff options
author | Simon | 2011-03-29 15:57:16 +0200 |
---|---|---|
committer | Simon | 2011-03-29 15:57:16 +0200 |
commit | 866f03cc988d023f847cc2732e3f08d93f287a81 (patch) | |
tree | 1fa60743065a2c770f15418f0d9447fa2986bb28 /application/models | |
parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
download | pbs2-866f03cc988d023f847cc2732e3f08d93f287a81.tar.gz pbs2-866f03cc988d023f847cc2732e3f08d93f287a81.tar.xz pbs2-866f03cc988d023f847cc2732e3f08d93f287a81.zip |
In den Rückgabewert der ParentGroups-Funktion die eigene Gruppe hinzugefügt
Diffstat (limited to 'application/models')
-rw-r--r-- | application/models/GroupGroupsMapper.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php index e0d3bec..f19ff02 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -88,15 +88,15 @@ class Application_Model_GroupGroupsMapper return $entries; } // Gets All groupIDs of the parent groups begins with the - public function getParentGroups($groupID, &$data=null, $level=1) { + public function getParentGroups($groupID, &$data=null, $level=0) { + + $data[$level][] = $groupID; + $db = Zend_Db_Table::getDefaultAdapter(); $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"'; $stmt = $db->query($query); $result = $stmt->fetchAll(); foreach($result as $row){ - // save the current groupID in level-list - $data[$level][] = $row['parentID']; - // get the function recursive an increase the level $data = $this->getParentGroups($row['parentID'], $data, $level+1); } @@ -104,15 +104,13 @@ class Application_Model_GroupGroupsMapper } // Gets all childs-groups from a given group - public function getChildGroups($groupID, &$data=null, $level=1) { + public function getChildGroups($groupID, &$data=null, $level=0) { + $data[$level][] = $groupID; $db = Zend_Db_Table::getDefaultAdapter(); $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"'; $stmt = $db->query($query); $result = $stmt->fetchAll(); foreach($result as $row){ - // save the current groupID in level-list - $data[$level][] = $row['groupID']; - // get the function recursive an increase the level $data = $this->getChildGroups($row['groupID'], $data, $level+1); } |