You are here

function ad_filters in Advertisement 5.2

Same name and namespace in other branches
  1. 5 ad.module \ad_filters()
  2. 6.3 ad.admin.inc \ad_filters()
  3. 6 ad.admin.inc \ad_filters()
  4. 6.2 ad.admin.inc \ad_filters()
  5. 7 ad.admin.inc \ad_filters()

List ad administration filters that can be applied.

3 calls to ad_filters()
ad_build_filter_query in ./ad.module
Build query for ad administration filters based on session.
ad_filter_form in ./ad.module
Return form for advertisement administration filters.
ad_filter_form_submit in ./ad.module
Process result from ad administration filter form.

File

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

Code

function ad_filters() {
  $session =& $_SESSION['ad_overview_filter'];
  $session = is_array($session) ? $session : array();

  // Regular filters
  $options = array();
  $options = array(
    'pending-1' => t('pending'),
    'approved-1' => t('approved'),
    'active-1' => t('active'),
    'offline-1' => t('offline'),
    'expired-1' => t('expired'),
    'denied-1' => t('denied'),
    'pending-0' => t('not pending'),
    'approved-0' => t('not approved'),
    'active-0' => t('not active'),
    'offline-0' => t('not offline'),
    'expired-0' => t('not expired'),
    'denied-0' => t('not denied'),
  );
  $filters['status'] = array(
    'title' => t('status'),
    'options' => $options,
  );
  $filters['type'] = array(
    'title' => t('type'),
    'options' => module_invoke_all('adapi', 'type', array()),
  );

  // The taxonomy filter
  if ($taxonomy = module_invoke('taxonomy', 'get_tree', _ad_get_vid())) {
    $options = array();

    // TODO: Add support for the default group.

    //$options[0] = t('default');
    foreach ($taxonomy as $term) {
      $options[$term->tid] = $term->name;
    }
    $filters['group'] = array(
      'title' => t('group'),
      'options' => $options,
    );
  }
  return $filters;
}