Overview

Packages

  • Auth
  • Core
  • Horde
    • Imsp
  • None
  • Notification

Classes

  • Horde_Core_Notification_Handler_Decorator_Base
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Define the functions needed for a Decorator instance.
 4:  *
 5:  * Copyright 2001-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (LGPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 9:  *
10:  * @author   Michael Slusarz <slusarz@horde.org>
11:  * @category Horde
12:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
13:  * @package  Notification
14:  */
15: class Horde_Core_Notification_Handler_Decorator_Base extends Horde_Notification_Handler_Decorator_Base
16: {
17:     /**
18:      * The application name of this Decorator.
19:      *
20:      * @var string
21:      */
22:     protected $_app = 'horde';
23: 
24:     /**
25:      * Event is being added to the Horde message stack.
26:      *
27:      * @param Horde_Notification_Event $event  Event object.
28:      * @param array $options                   Additional options (see
29:      *                                         Horde_Notification_Handler for
30:      *                                         details).
31:      */
32:     public function push(Horde_Notification_Event $event, $options)
33:     {
34:         $pushed = $GLOBALS['registry']->pushApp($this->_app, array(
35:             'check_perms' => true,
36:             'logintasks' => false
37:         ));
38: 
39:         parent::push($event, $options);
40: 
41:         if ($pushed) {
42:             $GLOBALS['registry']->popApp();
43:         }
44:     }
45: 
46:     /**
47:      * Listeners are handling their messages.
48:      *
49:      * @param Horde_Notification_Handler $handler    The base handler object.
50:      * @param Horde_Notification_Listener $listener  The Listener object that
51:      *                                               is handling its messages.
52:      *
53:      * @throws Horde_Notification_Exception
54:      */
55:     public function notify(Horde_Notification_Handler $handler,
56:                            Horde_Notification_Listener $listener)
57:     {
58:         $error = null;
59: 
60:         $pushed = $GLOBALS['registry']->pushApp($this->_app, array(
61:             'check_perms' => true,
62:             'logintasks' => false
63:         ));
64: 
65:         try {
66:             parent::notify($handler, $listener);
67:         } catch (Exception $e) {
68:             $error = $e;
69:         }
70: 
71:         if ($pushed) {
72:             $GLOBALS['registry']->popApp();
73:         }
74: 
75:         if ($error) {
76:             throw $error;
77:         }
78:     }
79: 
80: }
81: 
API documentation generated by ApiGen