You are here

function theme_notifications_manage_subscriptions in Notifications 6.2

Same name and namespace in other branches
  1. 6.4 notifications.manage.inc \theme_notifications_manage_subscriptions()
  2. 6 notifications.manage.inc \theme_notifications_manage_subscriptions()
  3. 6.3 notifications.manage.inc \theme_notifications_manage_subscriptions()

Theme subscriptions management form

File

./notifications.manage.inc, line 467
Common functions for bulk management of subscriptions

Code

function theme_notifications_manage_subscriptions($form) {

  // If there are rows in this form, then $form['title'] contains a list of
  // the title form elements.
  $has_posts = isset($form['type']) && is_array($form['type']);
  $select_header = $has_posts ? theme('table_select_header_cell') : '';
  $header = array(
    $select_header,
  );
  $header[] = t('Type');
  if (!empty($form['description'])) {
    $header[] = t('Description');
  }
  if (!empty($form['username'])) {
    $header[] = t('User');
  }
  $header[] = t('Send method');
  $header[] = t('Send interval');
  $header[] = t('Status');
  $header[] = t('Operations');
  $output = '';
  $output .= drupal_render($form['options']);
  if ($has_posts) {
    foreach (element_children($form['type']) as $key) {
      $row = array();
      $row[] = drupal_render($form['subscriptions'][$key]);
      $row[] = drupal_render($form['type'][$key]);
      if (!empty($form['description'])) {
        $row[] = drupal_render($form['description'][$key]);
      }
      if (!empty($form['username'])) {
        $row[] = drupal_render($form['username'][$key]);
      }
      $row[] = drupal_render($form['send_method'][$key]);
      $row[] = drupal_render($form['send_interval'][$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' => '6',
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}