function _nodehierarchy_views_get_descendant_parents in Node Hierarchy 5
Same name and namespace in other branches
- 6 includes/views/views_handler_argument_nodehierarchy_ancestor.inc \_nodehierarchy_views_get_descendant_parents()
Returnt the list of descendants of the given node which can also themselves be parents.
1 call to _nodehierarchy_views_get_descendant_parents()
- views_handler_arg_nodehierarchy_antecedent in nodehierarchy_views/
nodehierarchy_views.module - Handle the antecedent argument.
File
- nodehierarchy_views/
nodehierarchy_views.module, line 329 - Views.module integration for nodehierarchy.module.
Code
function _nodehierarchy_views_get_descendant_parents($nid) {
static $parent_types = NULL;
if (!$parent_types) {
$types = _nodehierarchy_get_parent_types("", TRUE);
$parent_types = implode(",", $types);
}
$out = array(
$nid,
);
$result = db_query("SELECT n.nid FROM {node} n LEFT JOIN {nodehierarchy} h ON h.nid = n.nid WHERE h.parent = %d and n.type IN (" . $parent_types . ")", $nid);
while ($child = db_fetch_object($result)) {
$out = array_merge($out, _nodehierarchy_views_get_descendant_parents($child->nid));
}
return $out;
}