You are here

function amazon_ses_admin_stats in Amazon SES 6

Page callback -- admin/reports/amazon_ses

1 string reference to 'amazon_ses_admin_stats'
amazon_ses_menu in ./amazon_ses.module
Implementation of hook_menu().

File

./amazon_ses.admin.inc, line 191
Administrative forms for Amazon SES module.

Code

function amazon_ses_admin_stats() {
  if ($quota = amazon_ses_quota()) {
    $rows = array();
    foreach (array(
      'SentLast24Hours' => t('Emails sent in the past 24 hours:'),
      'Max24HourSend' => t('Maximum number of emails you can send per 24 hours:'),
      'MaxSendRate' => t('Maximum number of emails you can send per second:'),
    ) as $k => $v) {
      $rows[] = array(
        $v,
        str_replace('.0', '', (string) $quota->{$k}),
      );
    }
    $output = theme('table', array(
      array(
        'data' => 'Quota',
        'colspan' => 2,
      ),
    ), $rows);
  }

  /*
   if ($stats = amazon_ses_send_statistics()) {
     $rows = array();
     // Doesn't work; can't access individual records here
     foreach ($stats->SendDataPoints->member AS $k => $stat) {
       $form['stats'][$k] = array(
         '#type' => 'fieldset',
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
         '#title' => $stat->Timestamp,
       );
       $items = array();
       foreach (array('DeliveryAttempts' => t('Delivery Attempts'), 'Rejects' => t('Rejects'), 'Bounces' => t('Bounces'), 'Complaints' => t('Complaints')) AS $k => $v) {
         $items[] = $v .': '. (string) $stat->$k;
       }
       $form['stats'][$k]['data'] = array(
         '#value' => theme('item_list', $items),
       );
     }
   }
   $output .= drupal_render_form('amazon_ses_stats', $form);
  */
  $output .= l(t('Configure Amazon SES'), 'admin/settings/amazon_ses');
  return $output;
}