function book_admin_orphan in Drupal 4
Same name and namespace in other branches
- 5 modules/book/book.module \book_admin_orphan()
Menu callback; displays a listing of all orphaned book pages.
1 string reference to 'book_admin_orphan'
- book_menu in modules/
book.module - Implementation of hook_menu().
File
- modules/
book.module, line 916 - Allows users to collaboratively author a book.
Code
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.vid = b.vid'));
$pages = array();
while ($page = db_fetch_object($result)) {
$pages[$page->nid] = $page;
}
$orphans = array();
if (count($pages)) {
foreach ($pages as $page) {
if ($page->parent && empty($pages[$page->parent])) {
$orphans[] = node_load($page->nid);
}
}
}
if (count($orphans)) {
$form = array();
$form['table'] = _book_admin_table($orphans);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save book pages'),
);
return drupal_get_form('book_admin_edit', $form);
}
else {
return '<p>' . t('There are no orphan pages.') . '</p>';
}
}