You are here

function _book_access_get_parents in Book access 5

Returns the array of book nodes and their parents.

1 call to _book_access_get_parents()
_book_access_get_book_nid in ./book_access.module
Returns the very top level (book) nid for a given book page.

File

./book_access.module, line 296
Allows access control for Drupal book nodes.

Code

function _book_access_get_parents() {
  static $parents = array();
  if (empty($parents)) {
    $sql = "SELECT n.nid, b.parent\n      FROM {node} n\n      LEFT JOIN {book} b ON n.vid = b.vid\n      WHERE n.type = 'book'";
    $query = db_query($sql);
    while ($result = db_fetch_object($query)) {
      $parents[$result->nid] = $result->parent;
    }
  }
  return $parents;
}