book_next

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/book/book.module, строка 392

Версии
5
book_next($node)
6
book_next($book_link)

Fetches the node object of the next page of the book.

▾ 1 функция вызывает book_next()

theme_book_navigation in modules/book/book.module
Prepares the links to children (TOC) and forward/backward navigation for a node presented as a book page.

Код

<?php
function book_next($node) {
  // get first direct child
  $child = db_fetch_object(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 AND n.status = 1 ORDER BY b.weight ASC, n.title ASC'), $node->nid));
  if ($child) {
    return $child;
  }

  // No direct child: get next for this level or any parent in this book.
  $path = book_location($node); // Path to top-level node including this one.
  $path[] = $node;

  while (($leaf = array_pop($path)) && count($path)) {
    $next = db_fetch_object(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 AND n.status = 1 AND (b.weight > %d OR (b.weight = %d AND n.title > '%s')) ORDER BY b.weight ASC, n.title ASC"), $leaf->parent, $leaf->weight, $leaf->weight, $leaf->title));
    if ($next) {
      return $next;
    }
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему