function _oa_core_get_all_children in Open Atrium Core 7.2
Helper function to return children of a list of parents.
Parameters
$all_parents array of sub-space nids keyed by space id for all spaces:
$nids array an array of parents we want children for:
1 call to _oa_core_get_all_children()
- oa_core_get_groups_by_parent in includes/
oa_core.util.inc - Get child Spaces or Groups.
File
- includes/
oa_core.util.inc, line 531 - Code for Utility functions for OpenAtrium spaces
Code
function _oa_core_get_all_children($all_parents, $nids, &$processed = array()) {
$processed = array_merge($nids, $processed);
$result = array();
$children = array();
foreach (array_intersect_key($all_parents, array_flip($nids)) as $parent_children) {
$children = array_merge($children, $parent_children);
}
if ($new_children = array_diff($children, $processed)) {
$result = _oa_core_get_all_children($all_parents, $new_children, $processed);
}
$result = array_unique(array_merge($nids, $result), SORT_NUMERIC);
return $result;
}