book_admin_save

Versions
4.6
book_admin_save($nid, $edit = array())

▾ 1 function calls book_admin_save()

book_admin in modules/book.module
Menu callback; displays the book administration page.

Code

modules/book.module, line 709

<?php
function book_admin_save($nid, $edit = array()) {
  if ($nid) {
    $book = node_load(array('nid' => $nid));

    foreach ($edit as $nid => $value) {
      // Check to see whether the title needs updating:
      $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
      if ($title != $value['title']) {
        db_query("UPDATE {node} SET title = '%s' WHERE nid = %d", $value['title'], $nid);
      }

      // Check to see whether the weight needs updating:
      $weight = db_result(db_query('SELECT weight FROM {book} WHERE nid = %d', $nid));
      if ($weight != $value['weight']) {
        db_query('UPDATE {book} SET weight = %d WHERE nid = %d', $value['weight'], $nid);
      }
    }

    $message = t('Updated book %title.', array('%title' => theme('placeholder', $book->title)));
    watchdog('content', $message);

    return $message;
  }
}
?>
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.