1: <?php
2: /**
3: * Add IMAP alert notifications to the stack.
4: *
5: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Michael Slusarz <slusarz@horde.org>
11: * @category Horde
12: * @license http://www.horde.org/licenses/gpl GPL
13: * @package IMP
14: */
15: class IMP_Notification_Handler_Decorator_ImapAlerts
16: extends Horde_Core_Notification_Handler_Decorator_Base
17: {
18: /**
19: */
20: protected $_app = 'imp';
21:
22: /**
23: * Listeners are handling their messages.
24: *
25: * @param Horde_Notification_Handler $handler The base handler object.
26: * @param Horde_Notification_Listener $listener The Listener object that
27: * is handling its messages.
28: */
29: public function notify(Horde_Notification_Handler $handler,
30: Horde_Notification_Listener $listener)
31: {
32: if (($listener instanceof Horde_Notification_Listener_Status) &&
33: ($ob = $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()) &&
34: $ob->ob) {
35: /* Display IMAP alerts. */
36: foreach ($ob->alerts() as $alert) {
37: $handler->push($alert, 'horde.warning');
38: }
39: }
40: }
41:
42: }
43: