You are here

function simplenews_types_overview in Simplenews 6

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_types_overview()
  2. 6.2 includes/simplenews.admin.inc \simplenews_types_overview()

Menu callback: newsletter admin form with list of available newsletter series.

1 string reference to 'simplenews_types_overview'
simplenews_menu in ./simplenews.module
Implementation of hook_menu().

File

./simplenews.admin.inc, line 98
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_types_overview() {
  $rows = array();
  $header = array(
    t('Newsletter name'),
    t('Subscribers'),
    t('Operations'),
  );
  foreach (taxonomy_get_tree(variable_get('simplenews_vid', '')) as $term) {
    $count_result = db_query('SELECT COUNT(s.snid) AS s_count FROM {simplenews_subscriptions} s INNER JOIN {simplenews_snid_tid} t ON s.snid = t.snid WHERE s.activated = %d AND t.tid = %d', 1, $term->tid);
    $count = (int) db_result($count_result);
    $rows[] = array(
      check_plain($term->name),
      $count,
      l(t('edit newsletter'), 'admin/content/simplenews/types/edit/' . $term->tid),
    );
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('There are currently no newsletter series.'),
        'colspan' => count($header),
      ),
    );
  }
  return theme('table', $header, $rows);
}