| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: taxonomy_menu.database.inc,v 1.1.2.15 2009/10/31 18:39:33 indytechcook Exp $ |
// $Id: taxonomy_menu.database.inc,v 1.1.2.16 2009/10/31 20:15:22 indytechcook Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* @file |
* @file |
| 7 |
* Database functions |
* Database functions |
| 8 |
* |
* |
| 9 |
* @author Neil Hastings <http://drupal.org/user/245817> |
* @author Neil Hastings <http://drupal.org/user/245817> |
| 10 |
* @author Mark Theunissen <http://drupal.org/user/108606> |
* @author Mark Theunissen <http://drupal.org/user/108606> |
| 11 |
* @author Afief Halumi <http://drupal.org/user/237472> |
* @author Afief Halumi <http://drupal.org/user/237472> |
| 69 |
|
|
| 70 |
/** |
/** |
| 71 |
* Get an array of the tid's related to the node |
* Get an array of the tid's related to the node |
| 72 |
* |
* |
| 73 |
* @param $nid |
* @param $nid |
| 74 |
* @return array of tids |
* @return array of tids |
| 75 |
*/ |
*/ |
| 84 |
|
|
| 85 |
/** |
/** |
| 86 |
* Get an array of the tid's from the parent |
* Get an array of the tid's from the parent |
| 87 |
* |
* |
| 88 |
* @param $tid |
* @param $tid |
| 89 |
* @return array of tid |
* @return array of tid |
| 90 |
*/ |
*/ |
| 94 |
foreach ($result as $key => $item) { |
foreach ($result as $key => $item) { |
| 95 |
$output[] = $key; |
$output[] = $key; |
| 96 |
} |
} |
| 97 |
return $output; |
return $output; |
| 98 |
} |
} |
| 99 |
|
|
| 100 |
/** |
/** |
| 124 |
|
|
| 125 |
/** |
/** |
| 126 |
* used to get the count without children |
* used to get the count without children |
| 127 |
* |
* |
| 128 |
* @param $tid |
* @param $tid |
| 129 |
*/ |
*/ |
| 130 |
function _taxonomy_menu_term_count($tid) { |
function _taxonomy_menu_term_count($tid) { |
| 150 |
function _taxonomy_menu_get_item($mlid) { |
function _taxonomy_menu_get_item($mlid) { |
| 151 |
return db_fetch_array(db_query('SELECT tid, vid FROM {taxonomy_menu} WHERE mlid = %d', $mlid)); |
return db_fetch_array(db_query('SELECT tid, vid FROM {taxonomy_menu} WHERE mlid = %d', $mlid)); |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
|
/** |
| 155 |
|
* Get the vocabulary for a tid |
| 156 |
|
* @param $tid array of tids |
| 157 |
|
* @return $vid |
| 158 |
|
*/ |
| 159 |
|
function _taxonomy_menu_get_vid_by_tid($tid) { |
| 160 |
|
$tids = implode(',', $tid); |
| 161 |
|
$result = db_query("SELECT vid FROM {term_data} WHERE tid in (%s)", $tids); |
| 162 |
|
$vids = array(); |
| 163 |
|
while ($data = db_fetch_object($result)) { |
| 164 |
|
$vids[$data->vid] = $data->vid; |
| 165 |
|
} |
| 166 |
|
return $vids; |
| 167 |
|
} |