book['bid']) ? 0 : $node->book['bid']; } $ontop = TRUE; if ($node->book['plid'] > 0) { $ontop = FALSE; } if ($delta == 0 ) { $books = book_get_books(); $query= " select * from {content_type_book} order by field_intro_weight_value "; $result = db_query($query); while ($order = db_fetch_array($result)) { $book2[] = $books[$order['nid']]; } $books = $book2; reset($books); $cur_bid = current($books); if ( $cur_bid['bid'] !== $current_bid ) { while ($cur_bid['bid'] !== $current_bid && $cur_bid['bid']) { next($books); $cur_bid = current($books); } $prev = prev($books); if (is_array($prev)) next($books); $next = next($books); # on prend la premiere page du book pas l intro $bid = db_result(db_query('select bid from {book} where nid=%d',$prev['nid'])); $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1','book-toc-'.$bid)); $link=drupal_get_path_alias($link); if (is_array($prev)) $link_prev = l('', $link, array("html"=> TRUE)); # if (is_array($prev)) $link_next = l('', 'node/'.$prev['nid'], array("html"=> TRUE)); $bid = db_result(db_query('select bid from {book} where nid=%d',$next['nid'])); $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1','book-toc-'.$bid)); $link=drupal_get_path_alias($link); if (is_array($next)) $link_next = l('', $link, array("html"=> TRUE)); # if (is_array($next)) $link_next = l('', 'node/'.$next['nid'], array("html"=> TRUE)); $block['content'] = $link_prev.' projekt '.$link_next; } else { $next = next($books); $bid = db_result(db_query('select bid from {book} where nid=%d',$next['nid'])); $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1','book-toc-'.$bid)); $link=drupal_get_path_alias($link); if (is_array($next)) $link_next = l('', $link, array("html"=> TRUE)); # if (is_array($next)) $link_next = l('', 'node/'.$next['nid'], array("html"=> TRUE)); $block['content'] = $link_prev.' projekt '.$link_next; } } elseif ($delta == 1 ) { $nodebook = node_load($node->book['bid']); $flat = (book_get_flat_menu($nodebook->book)); reset($flat); $cur_link = current($flat); if ( $cur_link['link_path'] !== 'node/'.$node->nid ) { while ($cur_link['link_path'] !== 'node/'.$node->nid && $cur_link['link_path']) { next($flat); $cur_link = current($flat); } $prev = prev($flat); if (is_array($prev)) next($flat); $next = next($flat); #var_dump($prev); # $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1',$prev["menu_name"])); # $link=drupal_get_path_alias($link); if (is_array($prev)) $link_prev = l('', $prev['link_path'], array("html"=> TRUE)); #if (is_array($prev)) $link_prev = l('', $link, array("html"=> TRUE)); # $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1',$next["menu_name"])); # $link=drupal_get_path_alias($link); # if (is_array($next)) $link_next = l('', $link, array("html"=> TRUE)); if (is_array($next)) $link_next = l('', $next['link_path'], array("html"=> TRUE)); } else { $next = next($flat); $link = db_result(db_query('select link_path from {menu_links} where depth=2 and menu_name=\'%s\' order by weight ASC LIMIT 1',$next["menu_name"])); $link=drupal_get_path_alias($link); if (is_array($next)) $link_next = l('', $link, array("html"=> TRUE)); #if (is_array($next)) $link_next = l('', $next['link_path'], array("html"=> TRUE)); } // next($flat); // dsm($flat); // dsm($node); $block['content'] = book_children($nodebook->book). ''; } return $block; case 'configure': $options = array( 'all pages' => t('Show block on all pages'), 'book pages' => t('Show block only on book pages'), ); $form['book_block_mode'] = array( '#type' => 'radios', '#title' => t('Book navigation block display'), '#options' => $options, '#default_value' => variable_get('book_block_mode', 'all pages'), '#description' => t("If Show block on all pages is selected, the block will contain the automatically generated menus for all of the site's books. If Show block only on book pages is selected, the block will contain only the one menu corresponding to the current page's book. In this case, if the current page is not in a book, no block will be displayed. The Page specific visibility settings or other visibility settings can be used in addition to selectively display this block."), ); return $form; case 'save': variable_set('book_block_mode', $edit['book_block_mode']); break; } } ?> hiša mj dolenjska | Kombinat