function nodeorder_get_term_min_max in Node Order 6
Same name and namespace in other branches
- 7 nodeorder.module \nodeorder_get_term_min_max()
3 calls to nodeorder_get_term_min_max()
- nodeorder_add_link in ./
nodeorder.module - nodeorder_move_in_category in ./
nodeorder.module - Move a node up or down in its category...
- nodeorder_nodeapi in ./
nodeorder.module - Implementation of hook_nodeapi().
File
- ./
nodeorder.module, line 184 - Nodeorder module.
Code
function nodeorder_get_term_min_max($tid, $reset) {
static $min_weights = array();
static $max_weights = array();
if ($reset) {
unset($min_weights[$tid]);
unset($max_weights[$tid]);
}
if (!$min_weights[$tid] || !$max_weights[$tid]) {
$result = db_query("SELECT tid, max(weight_in_tid) as max_weight, min(weight_in_tid) as min_weight FROM {term_node} WHERE tid = %d GROUP BY tid", $tid);
while ($row = db_fetch_object($result)) {
$min_weights[$row->tid] = $row->min_weight;
$max_weights[$row->tid] = $row->max_weight;
}
}
$weights["min"] = $min_weights[$tid];
$weights["max"] = $max_weights[$tid];
return $weights;
}