aboutsummaryrefslogtreecommitdiff
path: root/taxonomy_node_tree.module
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-10-16 11:30:09 -0300
committerSilvio <s1lv10@uol.com.br>2009-10-16 11:30:09 -0300
commit06db5918e5dc93aa772996ea9a1f30819d45012b (patch)
tree718afb8ce712e5f2d61f739e2f626a716fd96512 /taxonomy_node_tree.module
parent438004a5a9ed57f8149f3c471b08e25706684ee6 (diff)
downloadtaxonomy_node_tree-06db5918e5dc93aa772996ea9a1f30819d45012b.tar.gz
taxonomy_node_tree-06db5918e5dc93aa772996ea9a1f30819d45012b.tar.bz2
Cleanup: removing theme functions
Diffstat (limited to 'taxonomy_node_tree.module')
-rw-r--r--taxonomy_node_tree.module166
1 files changed, 0 insertions, 166 deletions
diff --git a/taxonomy_node_tree.module b/taxonomy_node_tree.module
index 8244b00..fcdeecb 100644
--- a/taxonomy_node_tree.module
+++ b/taxonomy_node_tree.module
@@ -133,169 +133,3 @@ function taxonomy_node_tree_taxonomy_get_tree($vid, $parent = 0, $depth = -1, $m
return $tree;
}
-
-// TODO: cleanup from here
-
-/**
- * Menu callback.
- *
- * @TODO: revamp
- */
-function taxonomy_node_tree($tid = 0, $vid = 1, $type = NULL) {
- if ($type) {
- // TODO: validate $type before sql query
- $type = ' AND node.type = "'. $type .'"';
- }
-
- // Select nodes and terms
- if ($tid != 0) {
-
- // First render all nodes whose parent is $term
- $output = '';
- $nodes = taxonomy_select_nodes(array($tid));
-
- while ($node = db_fetch_object($nodes)) {
- $link['title'] = $node->title;
- $link['href'] = 'node/' . $node->nid;
- $output .= theme('taxonomy_node_tree_link', $link);
- }
-
- // Render other child nodes
-
- $terms = taxonomy_node_tree_taxonomy_get_tree($vid, $tid);
- foreach ($terms as $term) {
- $filter[] = $term->tid;
- }
-
- $query = 'SELECT node.nid, node.title, term_node.tid FROM {node} LEFT JOIN
- {term_node} ON term_node.nid = node.nid WHERE term_node.tid IN (%s)
- AND node.status = "1"';
- $query .= $type;
- $result = db_query(db_rewrite_sql($query), implode(',', $filter));
- }
- else {
- $query = 'SELECT node.nid, node.title, term_node.tid FROM {node} LEFT JOIN
- {term_node} ON term_node.nid = node.nid WHERE term_node.tid IN
- (SELECT tid FROM {term_data} WHERE vid = "%d" AND node.status = "1")';
- $query .= $type;
- $result = db_query(db_rewrite_sql($query));
- }
-
-
- $tree = taxonomy_node_tree_build($result, $terms);
-
- // format output
- $output .= '<ul id="drw_item" class="hidden">';
- foreach ($tree as $term) {
- $output .= taxonomy_node_tree_menu_build($term);
- }
- $output .= '</ul></li>';
-
- // Display output
- echo($output);
-
- // We need to exit here to avoid themeable output
- exit();
-}
-
-/**
- * Recursively build the menu.
- *
- * @ingroup themeable
- */
-function taxonomy_node_tree_menu_build($term) {
-
- global $taxonomy_node_tree_id;
-
- if ($taxonomy_node_tree_id == null) {
- $taxonomy_node_tree_id = 0;
- }
-
- $taxonomy_node_tree_id++;
-
- if (isset($term->tid)) {
- $output .= '<li>';
- $output .= $term->name;
- if (isset($term->below)) {
- $output .= '<ul id="taxonomy_node_tree[ul][' . $taxonomy_node_tree_id . ']" class="hidden">';
- foreach($term->below as $child) {
- $output .= taxonomy_node_tree_menu_build($child);
- }
- $output .= '</ul>';
- } else if (isset($term->nodes)) {
- $output .= '<ul id="taxonomy_node_tree[ul][' . $taxonomy_node_tree_id . ']" class="hidden">';
- foreach ($term->nodes as $node) {
- $output .= '<li>';
- $output .= '<a href="' . $GLOBALS['base_url'] . '/sitio/' . $node->nid . '">' . $node->title . '</a>';
- }
- $output .= '</ul>';
- $output .= '</li>';
- }
- $output .= '</li>';
- }
-
- return $output;
-
-}
-/**
- * Implementation of hook_theme();
- *
- * @TODO: update
- */
-function taxonomy_node_tree_theme() {
- return array(
- 'taxonomy_node_tree_menu_parents' => array(
- 'arguments' => array(
- 'menu' => NULL,
- 'parent' => NULL,
- ),
- ),
- 'taxonomy_node_tree_link' => array(
- 'arguments' => array(),
- ),
- );
-}
-
-/**
- * Render the parent items of a menu.
- *
- * @ingroup themeable
- */
-function theme_taxonomy_node_tree_menu_parents($menu, $class = 'menu', $id = NULL, $base = NULL) {
-
- if ($id != NULL) {
- $id = ' id="'. $id .'"';
- }
-
- $output = '<ul class="'. $class .'"'. $id .'>';
- $output .= implode((array) module_invoke_all('taxonomy_node_tree_menu_parents'));
-
- foreach ($menu as $item) {
- $link['title'] = $item->name;
- $link['href'] = $base . $item->tid;
- $output .= theme('taxonomy_node_tree_link', $link);
- }
-
- $output .= '</ul>';
- return $output;
-
-}
-
-/**
- * Link theme function.
- *
- * @ingroup themeable
- */
-function theme_taxonomy_node_tree_link($link, $class = 'tree') {
- if (empty($link['localized_options'])) {
- $link['localized_options'] = array();
- }
-
- $link['attributes']['rel'] = 'drw';
-
- $output = '<li class="drw_li">';
- $output .= l($link['title'], $link['href'], array('attributes' => array('rel' => 'drw')));
- $output .= '</li>';
-
- return $output;
-}