You are here

function theme_simplenews_subscription_list in Simplenews 6

Same name and namespace in other branches
  1. 6.2 includes/simplenews.admin.inc \theme_simplenews_subscription_list()

Theme subscription administration overview.

File

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

Code

function theme_simplenews_subscription_list($form) {

  // Subscription table header
  $header = array(
    theme('table_select_header_cell'),
    array(
      'data' => t('Email'),
      'field' => 'ss.mail',
      'sort' => 'asc',
    ),
    array(
      'data' => t('Username'),
      'field' => 'u.name',
    ),
    array(
      'data' => t('Status'),
      'field' => 'ss.activated',
    ),
    t('Operations'),
  );

  // Subscription table
  $output = drupal_render($form['options']);
  if (isset($form['mail']) && is_array($form['mail'])) {
    foreach (element_children($form['mail']) as $key) {
      $row = array();
      $row[] = drupal_render($form['snids'][$key]);
      $row[] = drupal_render($form['mail'][$key]);
      $row[] = drupal_render($form['name'][$key]);
      $row[] = drupal_render($form['status'][$key]);
      $row[] = drupal_render($form['operations'][$key]);
      $rows[] = $row;
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No subscriptions available.'),
        'colspan' => '5',
      ),
    );
  }

  // Render table header, pager and form
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}