You are here

function theme_notify_admin_users in Notify 7

Same name and namespace in other branches
  1. 5.2 notify.module \theme_notify_admin_users()
  2. 5 notify.module \theme_notify_admin_users()
  3. 6 notify.module \theme_notify_admin_users()

Theme function to theme the admin user settings form in a table format.

File

./notify.admin.inc, line 866
Administrative pages callbacks for the Notify module.

Code

function theme_notify_admin_users($variables) {
  $form = $variables['form'];
  $output = drupal_render($form['info']);
  $header = array(
    t('Username'),
    t('E-mail address'),
    t('Content'),
    t('Comment'),
    t('How much'),
    t('Failed attempts'),
  );
  $rows = array();
  foreach (element_children($form['users']) as $uid) {
    $row = array();
    foreach (element_children($form['users'][$uid]) as $entry_key) {
      unset($form['users'][$uid][$entry_key]['#title']);
      $row[] = drupal_render($form['users'][$uid][$entry_key]);
    }
    $rows[] = $row;
  }
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => t('No users have notifications enabled.'),
        'colspan' => 6,
      ),
    );
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}