| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_block.module,v 1.20 2009/06/23 17:56:53 thenicespider Exp $ |
// $Id: taxonomy_block.module,v 1.21 2009/06/23 19:16:37 thenicespider Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 77 |
." WHERE vid='%d' AND th.parent=0 ORDER BY name ASC LIMIT %d"; |
." WHERE vid='%d' AND th.parent=0 ORDER BY name ASC LIMIT %d"; |
| 78 |
$term_parents = db_query($sql, $vid, $num_term ); |
$term_parents = db_query($sql, $vid, $num_term ); |
| 79 |
|
|
| 80 |
|
|
| 81 |
$output .= '<ul class="menu">'; |
$output .= '<ul class="menu">'; |
| 82 |
while ($term_parent = db_fetch_object($term_parents)) { |
while ($term_parent = db_fetch_object($term_parents)) { |
| 83 |
$tid_parent = $term_parent->tid; |
$tid_parent = $term_parent->tid; |
| 84 |
$name_parent= $term_parent->name; |
$name_parent= $term_parent->name; |
| 85 |
|
|
| 86 |
$output .= "<li>"; |
$output .= '<li class="dhtml-menu">'; |
| 87 |
$output .= l(tt("taxonomy:term:$tid_parent:name", $name_parent), "taxonomy/term/$tid_parent"); |
$output .= l(tt("taxonomy:term:$tid_parent:name", $name_parent), "taxonomy/term/$tid_parent"); |
| 88 |
if ($node_count) { |
if ($node_count) { |
| 89 |
$total_parent = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_parent)); |
$total_parent = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_parent)); |
| 90 |
$output .= " ($total_parent)"; |
$output .= " ($total_parent)"; |
| 91 |
} |
} |
|
$output .= "</li>"; |
|
| 92 |
|
|
| 93 |
$sql_count_childs = " SELECT count(td.tid) from {term_data} td " |
$sql_count_childs = " SELECT count(td.tid) from {term_data} td " |
| 94 |
." INNER JOIN {term_hierarchy} th ON th.tid=td.tid " |
." INNER JOIN {term_hierarchy} th ON th.tid=td.tid " |
| 101 |
." INNER JOIN {term_hierarchy} th ON th.tid=td.tid " |
." INNER JOIN {term_hierarchy} th ON th.tid=td.tid " |
| 102 |
." WHERE vid='%d' AND th.parent='%d' ORDER BY name ASC LIMIT %d"; |
." WHERE vid='%d' AND th.parent='%d' ORDER BY name ASC LIMIT %d"; |
| 103 |
$term_childs = db_query($sql_term_childs, $vid, $tid_parent, $num_term ); |
$term_childs = db_query($sql_term_childs, $vid, $tid_parent, $num_term ); |
| 104 |
$output .= "<ul>"; |
$output .= '<ul class="menu" style="display: block;">'; |
| 105 |
while ($term_child = db_fetch_object($term_childs)) { |
while ($term_child = db_fetch_object($term_childs)) { |
| 106 |
$tid_child = $term_child->tid; |
$tid_child = $term_child->tid; |
| 107 |
$name_child = $term_child->name; |
$name_child = $term_child->name; |
| 108 |
|
|
| 109 |
$output .= "<li>"; |
$output .= '<li class="leaf dhtml-menu">'; |
| 110 |
$output .= l(tt("taxonomy:term:$tid_child:name", $name_child), "taxonomy/term/$tid_child"); |
$output .= l(tt("taxonomy:term:$tid_child:name", $name_child), "taxonomy/term/$tid_child"); |
| 111 |
if ($node_count) { |
if ($node_count) { |
| 112 |
$total_child = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_child)); |
$total_child = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_child)); |
| 116 |
} |
} |
| 117 |
$output .= "</ul>"; |
$output .= "</ul>"; |
| 118 |
} |
} |
| 119 |
|
$output .= "</li>"; |
| 120 |
|
|
| 121 |
} |
} |
| 122 |
|
|
| 123 |
$output .= "</ul>"; |
$output .= "</ul>"; |
| 124 |
|
|
| 125 |
//if(count($items)) { |
//if(count($items)) { |
| 126 |
// return theme('item_list',$items); |
// return theme('item_list',$items); |
| 127 |
//} |
//} |