You are here

function theme_simplenews_subscription_list in Simplenews 6.2

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

Theme subscription administration overview.

File

includes/simplenews.admin.inc, line 1353
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',
    ),
  );
  if (variable_get('language_count', 1) > 1) {
    $header[] = array(
      'data' => t('Language'),
      'field' => 'ss.language',
    );
  }
  $header[] = t('Operations');
  $colcount = count($header);

  // 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]);
      if (variable_get('language_count', 1) > 1) {
        $row[] = drupal_render($form['language'][$key]);
      }
      $row[] = drupal_render($form['operations'][$key]);
      $rows[] = $row;
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No subscriptions available.'),
        'colspan' => $colcount,
      ),
    );
  }

  // 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;
}