You are here

function notifications_admin_status_page in Notifications 6.4

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

Current subscriptions page

1 string reference to 'notifications_admin_status_page'
notifications_menu in ./notifications.module
Implementation of hook_menu().

File

./notifications.admin.inc, line 52

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} GROUP BY type");
  $count = 0;
  $types = notifications_subscription_types();
  $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', $header, $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} 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', $header, $rows);
  $output .= theme('box', t('Subscriptions by send method'), $summary);
  return $output;
}