You are here

function simplenews_get_filter in Simplenews 6.2

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_get_filter()
  2. 6 simplenews.admin.inc \simplenews_get_filter()

Built filter selection box options and filter query where clause

Parameters

$type identification string:

$na TRUE for orphaned newsletters:

Return value

array of filter selection box options and related query where clause

1 call to simplenews_get_filter()
simplenews_admin_news in includes/simplenews.admin.inc
Menu callback: Admin form for sent and draft newsletters.

File

includes/simplenews.admin.inc, line 1181
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_get_filter($type, $na = TRUE) {

  //Default data
  $names['all'] = t('all newsletters');
  $queries['all'] = '';
  if ($na) {
    $names['na'] = t('orphaned newsletters');
    $queries['na'] = 's.tid = 0';
  }

  // Data for each newsletter
  foreach (simplenews_get_newsletters(variable_get('simplenews_vid', ''), TRUE) as $newsletter) {
    $names[$newsletter->tid] = $newsletter->name;
    $queries[$newsletter->tid] = 's.tid = ' . $newsletter->tid;
  }
  return array(
    $names,
    $queries,
  );
}