You are here

function _book_admin_table_tree in Drupal 4

Same name and namespace in other branches
  1. 5 modules/book/book.module \_book_admin_table_tree()
  2. 6 modules/book/book.admin.inc \_book_admin_table_tree()
  3. 7 modules/book/book.admin.inc \_book_admin_table_tree()
1 call to _book_admin_table_tree()
_book_admin_table in modules/book.module

File

modules/book.module, line 842
Allows users to collaboratively author a book.

Code

function _book_admin_table_tree($node, $depth) {
  $form = array();
  $form[] = array(
    'nid' => array(
      '#type' => 'value',
      '#value' => $node->nid,
    ),
    'depth' => array(
      '#type' => 'value',
      '#value' => $depth,
    ),
    'title' => array(
      '#type' => 'textfield',
      '#default_value' => $node->title,
      '#maxlength' => 255,
    ),
    'weight' => array(
      '#type' => 'weight',
      '#default_value' => $node->weight,
      '#delta' => 15,
    ),
  );
  $children = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d ORDER BY b.weight, n.title'), $node->nid);
  while ($child = db_fetch_object($children)) {
    $form = array_merge($form, _book_admin_table_tree(node_load($child->nid), $depth + 1));
  }
  return $form;
}