Fixed the duplicated function.

This commit is contained in:
mdtrooper 2014-12-04 14:45:29 +01:00
parent cc2cba8dc5
commit 70616b04cb
1 changed files with 6 additions and 31 deletions

View File

@ -1627,44 +1627,19 @@ function groups_get_tree(&$groups, $parent = false) {
return $return;
}
function groups_get_all_hierarchy_group ($id_group, $hierarchy = array(), $debug = false) {
global $config;
$hierarchy[] = $id_group;
$parent = db_get_value('parent','tgrupo','id_grupo',$id_group);
if ($parent !== 0) {
$propagate = db_get_value('propagate','tgrupo','id_grupo',$parent);
if ($propagate == 1) {
//$childrens_ids_parent = array($parent);
$hierarchy[] = $parent;
$childrens = groups_get_childrens($parent);
if (!empty($childrens)) {
foreach ($childrens as $child) {
//$childrens_ids_parent[] = (int)$child['id_grupo'];
$hierarchy[] = (int)$child['id_grupo'];
}
}
$hierarchy = groups_get_all_hierarchy_group ($parent, $hierarchy);
}
}
return $hierarchy;
}
function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
global $config;
if ($id_group == 0) {
$hierarchy = groups_get_childrens($id_group);
} else {
}
else {
$hierarchy[] = $id_group;
$parent = db_get_value('parent','tgrupo','id_grupo',$id_group);
if ($parent !== 0) {
$propagate = db_get_value('propagate','tgrupo','id_grupo',$parent);
if ($propagate == 1) {
//$childrens_ids_parent = array($parent);
$hierarchy[] = $parent;
@ -1675,7 +1650,7 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
$hierarchy[] = (int)$child['id_grupo'];
}
}
$hierarchy = groups_get_all_hierarchy_group ($parent, $hierarchy);
}
}