book_admin_orphan

Versions
4.6 – 5
book_admin_orphan()

Menu callback; displays a listing of all orphaned book pages.

Code

modules/book.module, line 737

<?php
function book_admin_orphan() {
  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, n.status, b.parent FROM {node} n INNER JOIN {book} b ON n.nid = b.nid'));

  while ($page = db_fetch_object($result)) {
    $pages[$page->nid] = $page;
  }

  if ($pages) {
    $output .= '<h3>'. t('Orphan pages') .'</h3>';
    $header = array(t('Title'), t('Weight'), array('data' => t('Operations'), 'colspan' => '3'));
    foreach ($pages as $nid => $node) {
      if ($node->parent && empty($pages[$node->parent])) {
        $rows[] = book_admin_view_line($node, $depth);
        $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1));
      }
    }
    $output .= theme('table', $header, $rows);
  }

  print theme('page', $output);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.