aboutsummaryrefslogtreecommitdiff
path: root/jquery_drawer.module
diff options
context:
space:
mode:
Diffstat (limited to 'jquery_drawer.module')
-rw-r--r--jquery_drawer.module38
1 files changed, 1 insertions, 37 deletions
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.
*