function _nodehierarchy_get_parent_pulldown_items in Node Hierarchy 5
Same name and namespace in other branches
- 6 nodehierarchy.module \_nodehierarchy_get_parent_pulldown_items()
Get the items for the parent selector pulldown.
1 call to _nodehierarchy_get_parent_pulldown_items()
- _nodehierarchy_get_parent_pulldown in ./
nodehierarchy.module - Get the parent selector pulldown.
File
- ./
nodehierarchy.module, line 1070 - A module to make nodes hierarchical.
Code
function _nodehierarchy_get_parent_pulldown_items($parent_id, $types, $child_node = NULL, $depth = 0) {
$out = array();
$query = "SELECT n.*, h.* FROM {node} n INNER JOIN {nodehierarchy} h ON h.nid = n.nid WHERE h.parent = %d AND n.type IN (" . implode(",", $types) . ") ORDER BY h.order_by ASC";
$result = db_query(db_rewrite_sql($query), $parent_id);
while ($hierarchylist = db_fetch_object($result)) {
if ($hierarchylist->nid != $child_node && node_access('update', $hierarchylist)) {
$out[$hierarchylist->nid] = str_repeat('--', $depth) . ' ' . $hierarchylist->title;
$children = _nodehierarchy_get_parent_pulldown_items($hierarchylist->nid, $types, $child_node, $depth + 1);
$out += $children;
}
}
return $out;
}