You are here

function development_environment_supressed_email_report_page in Development Environment 7

Page definition for the suppressed email reports page.

Return value

array A render array representing the page.

1 string reference to 'development_environment_supressed_email_report_page'
development_environment_menu in ./development_environment.module
Implements hook_menu().

File

includes/development_environment.pages.inc, line 14
Holds menu callbacks for pages created by the Development Environment module.

Code

function development_environment_supressed_email_report_page() {
  global $user;
  $query = db_select('development_environment_log', 'log_data')
    ->extend('PagerDefault');
  $query
    ->fields('log_data', array(
    'lid',
    'email_data',
    'timestamp',
    'recipient_email',
    'subject',
  ));
  $log_items = $query
    ->limit(20)
    ->orderBy('lid', 'DESC')
    ->execute();
  $page = array(
    'items' => array(
      '#theme' => 'table',
      '#header' => array(
        '',
        t('Time'),
        t('Recipient'),
        t('Subject'),
      ),
      '#rows' => array(),
      '#empty' => t('No emails have been logged'),
    ),
    'pager' => array(
      '#type' => 'pager',
    ),
  );
  foreach ($log_items as $item) {
    $page['items']['#rows'][] = array(
      l(t('View'), 'admin/reports/email_log/' . $item->lid),
      format_date($item->timestamp, 'short', '', $user->timezone),
      $item->recipient_email,
      $item->subject,
    );
  }
  return $page;
}