You are here

function notifications_admin_status_page in Notifications 7

Same name and namespace in other branches
  1. 5 notifications.admin.inc \notifications_admin_status_page()
  2. 6.4 notifications.admin.inc \notifications_admin_status_page()
  3. 6 notifications.admin.inc \notifications_admin_status_page()
  4. 6.2 notifications.admin.inc \notifications_admin_status_page()
  5. 6.3 notifications.admin.inc \notifications_admin_status_page()

Current subscriptions page

File

./notifications.admin.inc, line 28

Code

function notifications_admin_status_page() {
  $output = '';

  // Subscriptions summary by type
  $header = array(
    t('Type'),
    t('Number'),
  );
  $result = db_query("SELECT type, count(*) AS count FROM {notifications_subscription} GROUP BY type");
  $count = 0;
  $types = notifications_subscription_type();
  $rows = array();
  while ($stype = db_fetch_object($result)) {
    $rows[] = array(
      !empty($types[$stype->type]['title']) ? $types[$stype->type]['title'] : '<strong>' . $stype->type . '</strong>',
      $stype->count,
    );
    $count += $stype->count;
  }
  $summary = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $summary .= t('Total: %number', array(
    '%number' => $count,
  ));
  $output .= theme('box', t('Subscriptions by type'), $summary);

  // Summary by sending method
  $header = array(
    t('Method'),
    t('Number'),
  );
  $result = db_query("SELECT send_method, count(*) AS count FROM {notifications_subscription} GROUP BY send_method");
  $rows = array();
  while ($subs = db_fetch_object($result)) {
    $name = messaging_method_info($subs->send_method, 'title');
    $rows[] = array(
      $name ? $name : '<strong>' . $subs->send_method . '</strong>',
      $subs->count,
    );
  }
  $summary = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= theme('box', t('Subscriptions by send method'), $summary);
  return $output;
}