You are here

function mailhandler_list_mailboxes in Mailhandler 7

Same name and namespace in other branches
  1. 6 mailhandler.admin.inc \mailhandler_list_mailboxes()
1 string reference to 'mailhandler_list_mailboxes'
mailhandler_menu in ./mailhandler.module
Implementation of hook_menu().

File

./mailhandler.admin.inc, line 324

Code

function mailhandler_list_mailboxes() {
  $header = array(
    t('Mailbox'),
    t('Folder'),
    array(
      'data' => t('Operations'),
      'colspan' => 4,
    ),
  );
  $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'),
      )),
      l(t('Edit'), 'admin/content/mailhandler/edit/' . $mailbox->mid, array(
        'title' => t('Edit this mailbox configuration'),
      )),
      l(t('Clone'), 'admin/content/mailhandler/clone/' . $mailbox->mid, array(
        'title' => t('Add a new mailbox, using this mailbox configuration as a template'),
      )),
      l(t('Delete'), 'admin/content/mailhandler/delete/' . $mailbox->mid, array(
        'title' => t('Delete this mailbox'),
      )),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => '<em>' . t('No mailboxes have been defined.') . '</em>',
        'colspan' => 4,
      ),
    );
  }
  return theme('table', $header, $rows);
}