You are here

function _epub_get_book_tree in Epub 6

Return a structured book hierarchy.

Parameters

$node: A node object.

&$rows: An array in which store the structured book data.

Return value

An array containing the structured data of a book.

1 call to _epub_get_book_tree()
epub_create_file in ./epub.module
Generate an ePub file from a book.

File

./epub.module, line 625
Provide ePub content type and enable the creation of ePub files from book contents.

Code

function _epub_get_book_tree($node, &$rows = array()) {
  $mlid = $node->book['mlid'];
  $rows[$mlid]['book_page'] = $node;
  $result = db_query(db_rewrite_sql("SELECT mlid FROM {menu_links} WHERE plid = %d"), $mlid);
  while ($row = db_fetch_object($result)) {
    $book = db_fetch_object(db_query(db_rewrite_sql("SELECT * FROM {book} WHERE mlid = %d"), $row->mlid));
    _epub_get_book_tree(node_load(array(
      'nid' => $book->nid,
    )), $rows[$mlid]);
  }
  return $rows;
}