* @category Horde * @copyright 2005-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package IMP */ class IMP_Block_Summary extends Horde_Core_Block { /** */ public $updateable = true; /** */ public function __construct($app, $params = array()) { parent::__construct($app, $params); $this->_name = _("Mailbox Summary"); } /** */ protected function _title() { return Horde::link(IMP::getInitialPage()->url) . $GLOBALS['registry']->get('name') . ''; } /** */ protected function _params() { return array( 'show_unread' => array( 'type' => 'boolean', 'name' => _("Only display mailboxes with unread messages in them?"), 'default' => 0 ) ); } /** */ protected function _content() { global $injector; /* Filter on INBOX display. INBOX is always polled. */ IMP_Mailbox::get('INBOX')->filterOnDisplay(); /* Get list of mailboxes to poll. */ $poll = $injector->getInstance('IMP_Ftree')->poll->getPollList(true); $status = $injector->getInstance('IMP_Factory_Imap')->create()->status($poll, Horde_Imap_Client::STATUS_UNSEEN | Horde_Imap_Client::STATUS_MESSAGES | Horde_Imap_Client::STATUS_RECENT_TOTAL); $anyUnseen = false; $out = ''; foreach ($poll as $mbox) { $mbox_str = strval($mbox); if (isset($status[$mbox_str]) && (empty($this->_params['show_unread']) || !empty($status[$mbox_str]['unseen']))) { $mbox_status = $status[$mbox_str]; $label = $mbox->url('mailbox')->link() . $mbox->display_html . ''; if (!empty($mbox_status['unseen'])) { $label = '' . $label . ''; $anyUnseen = true; } $out .= '
| ' . _("Mailbox") . ' | ' . _("Unseen") . ' | ' . _("Total") . ' |
|---|