aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2009-10-16 11:02:01 -0300
committerSilvio <silvio@socioambiental.org>2009-10-16 11:02:01 -0300
commit92a55ddd433cf36665444cb130ce300442cf9a7a (patch)
tree970d821fc833715421f5fa4009de6de35432ad40
parent19de80d81bca70f684be426dcfb5e9f363c9223e (diff)
downloadjquery_drawer-92a55ddd433cf36665444cb130ce300442cf9a7a.tar.gz
jquery_drawer-92a55ddd433cf36665444cb130ce300442cf9a7a.tar.bz2
Starting to use taxonomy_node_tree module
-rw-r--r--jquery_drawer.info2
-rw-r--r--jquery_drawer.module38
2 files changed, 2 insertions, 38 deletions
diff --git a/jquery_drawer.info b/jquery_drawer.info
index 9a55330..964b777 100644
--- a/jquery_drawer.info
+++ b/jquery_drawer.info
@@ -3,4 +3,4 @@ name = jQuery Drawer
description = Show menu with jQuery.drawer functionality.
core = 6.x
version = "6.x-0.1"
-dependencies[] = menu
+dependencies[] = menu taxonomy_node_tree
diff --git a/jquery_drawer.module b/jquery_drawer.module
index 276c162..76e0856 100644
--- a/jquery_drawer.module
+++ b/jquery_drawer.module
@@ -164,29 +164,7 @@ function jquery_drawer_page($tid = null) {
AND node.status = "1"';
$result = db_query(db_rewrite_sql($query), implode(',', $filter));
-
- while ($node = db_fetch_object($result)) {
- foreach ($terms as $term) {
- // add nodes into the term
- if ($node->tid == $term->tid) {
- $term->nodes[] = $node;
- }
- // update an index of terms
- $tree[$term->tid] = $term;
- }
- }
-
- // add children relationship just for terms present in the tree
- foreach ($tree as $term) {
- if ($term->parents[0] != 0 && isset($tree[$term->parents[0]])) {
- $tree[$term->parents[0]]->children[] = $term->tid;
- }
- }
-
- // build menu with hierarchy
- foreach ($tree as $term) {
- jquery_drawer_build_tree($tree, $term);
- }
+ $tree = taxonomy_node_tree_build($result, $terms);
// format output
$output .= '<ul id="drw_item" class="hidden">';
@@ -202,20 +180,6 @@ function jquery_drawer_page($tid = null) {
exit();
}
-function jquery_drawer_build_tree(&$tree, $term) {
- if ($term->parents[0] != 0 && isset($tree[$term->parents[0]])) {
- // is child
- if (isset($term->children)) {
- // is also parent, so go down one level
- foreach($term->children as $child) {
- jquery_drawer_build_tree($tree, $tree[$child]);
- }
- }
- $tree[$term->parents[0]]->below[] = drupal_clone($term);
- unset($tree[$term->tid]);
- }
-}
-
/**
* Recursively build the menu.
*