comparison modules/book/book.module @ 7:fff6d4c8c043 6.3

Drupal 6.3
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:28 +0100
parents 2427550111ae
children
comparison
equal deleted inserted replaced
6:2cfdc3c92142 7:fff6d4c8c043
1 <?php 1 <?php
2 // $Id: book.module,v 1.454.2.3 2008/03/25 14:03:02 goba Exp $ 2 // $Id: book.module,v 1.454.2.5 2008/07/03 06:38:46 dries Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Allows users to structure the pages of a site in a hierarchy or outline. 6 * Allows users to structure the pages of a site in a hierarchy or outline.
7 */ 7 */
513 */ 513 */
514 function book_get_flat_menu($book_link) { 514 function book_get_flat_menu($book_link) {
515 static $flat = array(); 515 static $flat = array();
516 516
517 if (!isset($flat[$book_link['mlid']])) { 517 if (!isset($flat[$book_link['mlid']])) {
518 // Call menu_tree_full_data() to take advantage of the menu system's caching. 518 // Call menu_tree_all_data() to take advantage of the menu system's caching.
519 $tree = menu_tree_all_data($book_link['menu_name'], $book_link); 519 $tree = menu_tree_all_data($book_link['menu_name'], $book_link);
520 $flat[$book_link['mlid']] = array(); 520 $flat[$book_link['mlid']] = array();
521 _book_flatten_menu($tree, $flat[$book_link['mlid']]); 521 _book_flatten_menu($tree, $flat[$book_link['mlid']]);
522 } 522 }
523 return $flat[$book_link['mlid']]; 523 return $flat[$book_link['mlid']];
1076 1076
1077 $data['tree'] = menu_tree_data(db_query($sql, $args), array(), $item['depth']); 1077 $data['tree'] = menu_tree_data(db_query($sql, $args), array(), $item['depth']);
1078 $data['node_links'] = array(); 1078 $data['node_links'] = array();
1079 menu_tree_collect_node_links($data['tree'], $data['node_links']); 1079 menu_tree_collect_node_links($data['tree'], $data['node_links']);
1080 // Compute the real cid for book subtree data. 1080 // Compute the real cid for book subtree data.
1081 $tree_cid = 'links:'. $menu_name .':subtree-data:'. md5(serialize($data)); 1081 $tree_cid = 'links:'. $item['menu_name'] .':subtree-data:'. md5(serialize($data));
1082 // Cache the data, if it is not already in the cache. 1082 // Cache the data, if it is not already in the cache.
1083 if (!cache_get($tree_cid, 'cache_menu')) { 1083 if (!cache_get($tree_cid, 'cache_menu')) {
1084 cache_set($tree_cid, $data, 'cache_menu'); 1084 cache_set($tree_cid, $data, 'cache_menu');
1085 } 1085 }
1086 // Cache the cid of the (shared) data using the menu and item-specific cid. 1086 // Cache the cid of the (shared) data using the menu and item-specific cid.