You are here

function _ad_get_group in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 ad.module \_ad_get_group()
  2. 5 ad.module \_ad_get_group()
  3. 6 ad.module \_ad_get_group()
  4. 6.2 ad.module \_ad_get_group()
  5. 7 ad.module \_ad_get_group()

Retrieve the group name from the nid.

1 call to _ad_get_group()
ad_admin_ads in ./ad.admin.inc
Provide a filterable list of advertisements.

File

./ad.module, line 1468

Code

function _ad_get_group($nid) {
  static $groups = array();
  if (!isset($groups[$nid])) {
    $result = db_query('SELECT td.name FROM {term_data} td INNER JOIN {term_node} tn ON td.tid = tn.tid INNER JOIN {node} n ON tn.vid = n.vid WHERE tn.nid = %d AND td.vid = %d', $nid, _ad_get_vid());
    while ($term = db_fetch_object($result)) {
      $terms[] = $term->name;
    }
    if (!empty($terms)) {
      $groups[$nid] = implode(', ', $terms);
    }
    else {
      $groups[$nid] = t('default');
    }
  }
  return $groups[$nid];
}