You are here

function theme_notifications_manage_subscriptions in Notifications 6.4

Same name and namespace in other branches
  1. 6 notifications.manage.inc \theme_notifications_manage_subscriptions()
  2. 6.2 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 508
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');
  }
  if (!empty($form['send_method'])) {
    $header[] = t('Send method');
  }
  if (!empty($form['send_interval'])) {
    $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 (isset($form['description'])) {
        $row[] = drupal_render($form['description'][$key]);
      }
      if (isset($form['username'])) {
        $row[] = drupal_render($form['username'][$key]);
      }
      if (isset($form['send_method'])) {
        $row[] = drupal_render($form['send_method'][$key]);
      }
      if (isset($form['send_interval'])) {
        $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;
}