You are here

function theme_simplenews_subscription_list_form in Simplenews 5

Theme subscription administration overview.

File

./simplenews.module, line 2013

Code

function theme_simplenews_subscription_list_form($form) {

  // Subscription table header
  $header = array(
    theme('table_select_header_cell'),
    array(
      'data' => t('E-mail'),
      'field' => 'ss.mail',
      'sort' => 'asc',
    ),
    array(
      'data' => t('Username'),
      'field' => 'u.name',
    ),
    array(
      'data' => t('Status'),
      'field' => 'ss.a_status',
    ),
    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' => '4',
      ),
    );
  }

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