You are here

function mailhandler_display in Mailhandler 5

Return a listing of all defined mailboxes.

2 calls to mailhandler_display()
mailhandler_admin in ./mailhandler.module
Menu callback; presents an overview of all URL aliases.
mailhandler_admin_retrieve in ./mailhandler.module
Menu callback; Retrieve and process pending e-mails for a mailbox.

File

./mailhandler.module, line 685

Code

function mailhandler_display() {
  $destination = drupal_get_destination();
  $header = array(
    t('Mailbox'),
    t('Folder'),
    array(
      'data' => t('Operations'),
      'colspan' => 3,
    ),
  );
  $rows = array();
  $result = db_query('SELECT * FROM {mailhandler} ORDER BY mail');
  while ($mailbox = db_fetch_object($result)) {
    $rows[] = array(
      "<a href=\"mailto:{$mailbox->mail}\">{$mailbox->mail}</a>",
      $mailbox->folder ? check_plain($mailbox->folder) : '',
      l(t('Retrieve'), "admin/content/mailhandler/retrieve/{$mailbox->mid}", array(
        'title' => t('Retrieve and process pending e-mails in this mailbox'),
      ), $destination),
      l(t('Edit'), "admin/content/mailhandler/edit/{$mailbox->mid}", array(
        'title' => t('Edit this mailbox configuration'),
      ), $destination),
      l(t('Delete'), "admin/content/mailhandler/delete/{$mailbox->mid}", array(
        'title' => t('Delete this mailbox'),
      ), $destination),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No mailboxes available.'),
        'colspan' => '4',
      ),
    );
  }
  return theme('table', $header, $rows);
}