Added a function to dashboard groups checkboxes. Ticket#2598
This commit is contained in:
parent
9bce86d1ac
commit
a4da4bbc8d
pandora_console/include
|
@ -230,6 +230,36 @@ function groups_check_used($idGroup) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a array of id_group of childrens (to branches down)
|
||||||
|
*
|
||||||
|
* @param integer $parent The id_group parent to search the childrens.
|
||||||
|
* @param array $groups The groups, its for optimize the querys to DB.
|
||||||
|
*/
|
||||||
|
function groups_get_childrens_ids($parent, $groups = null) {
|
||||||
|
if (empty($groups)) {
|
||||||
|
$groups = db_get_all_rows_in_table('tgrupo');
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = '';
|
||||||
|
|
||||||
|
foreach ($groups as $key => $group) {
|
||||||
|
if ($group['id_grupo'] == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($group['parent'] == $parent) {
|
||||||
|
$return .= $group['id_grupo'] . ",";
|
||||||
|
$propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $group['id_grupo']);
|
||||||
|
if ($propagate) {
|
||||||
|
$return .= groups_get_childrens_ids($group['id_grupo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a array of id_group of childrens (to branches down)
|
* Return a array of id_group of childrens (to branches down)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue