| 5 book.module | book_admin_orphan() |
Menu callback; displays a listing of all orphaned book pages.
1 string reference to 'book_admin_orphan'
File
- modules/
book/ book.module, line 897 - 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['table'] = _book_admin_table($orphans);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save book pages'),
);
}
else {
$form['error'] = array('#value' => '<p>' . t('There are no orphan pages.') . '</p>');
}
$form['#base'] = 'book_admin_edit';
return $form;
}
Login or register to post comments