You are here

function _ad_get_group in Advertisement 5

Same name and namespace in other branches
  1. 5.2 ad.module \_ad_get_group()
  2. 6.3 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.module
Provide a filterable list of advertisements.

File

./ad.module, line 2859
An advertising system for Drupal powered websites.

Code

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