You are here

function _votingapi_views_values in Voting API 6

Same name and namespace in other branches
  1. 5 votingapi_views.inc \_votingapi_views_values()
1 call to _votingapi_views_values()
votingapi_views_tables in ./votingapi_views.inc

File

./votingapi_views.inc, line 299

Code

function _votingapi_views_values($field = 'tag', $table = 'vote') {
  static $cached;
  if (!isset($cached[$table][$field])) {
    $results = db_query("SELECT DISTINCT %s FROM {votingapi_%s} WHERE content_type = 'node'", $field, $table);
    while ($result = db_fetch_object($results)) {
      $cached[$table][$field][$result->{$field}] = $result->{$field};
    }
  }
  return empty($cached[$table][$field]) ? array() : $cached[$table][$field];
}