You are here

function _nodehierarchy_get_children_count in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 nodehierarchy.module \_nodehierarchy_get_children_count()
  2. 6 nodehierarchy.module \_nodehierarchy_get_children_count()
  3. 6.2 nodehierarchy.module \_nodehierarchy_get_children_count()
  4. 7.2 nodehierarchy.module \_nodehierarchy_get_children_count()

Count the children of the given node.

2 calls to _nodehierarchy_get_children_count()
nodehierarchy_callback_ajax in ./nodehierarchy.module
Ajax callback.
nodehierarchy_form_alter in ./nodehierarchy.module
Implementation of hooks_form_alter().

File

./nodehierarchy.module, line 764
A module to make nodes hierarchical.

Code

function _nodehierarchy_get_children_count($nid) {
  $query = "SELECT count(nid) as children_count FROM {nodehierarchy} h WHERE h.parent = %d";
  $result = db_query($query, $nid);
  if ($out = db_fetch_object($result)) {
    return $out->children_count;
  }
  return 0;
}