1: <?php
2: 3: 4: 5:
6: class Horde_Core_Factory_Notification extends Horde_Core_Factory_Injector
7: {
8: protected $_notify;
9:
10: public function create(Horde_Injector $injector)
11: {
12: if (isset($this->_notify)) {
13: return $this->_notify;
14: }
15:
16: $this->_notify = new Horde_Notification_Handler(
17: new Horde_Core_Notification_Storage_Session()
18: );
19:
20: $this->_notify->addType('default', '*', 'Horde_Core_Notification_Event_Status');
21: $this->_notify->addType('status', 'horde.*', 'Horde_Core_Notification_Event_Status');
22:
23: $this->_notify->addDecorator(new Horde_Notification_Handler_Decorator_Alarm($injector->getInstance('Horde_Core_Factory_Alarm'), $GLOBALS['registry']->getAuth()));
24: $this->_notify->addDecorator(new Horde_Core_Notification_Handler_Decorator_Hordelog());
25:
26: try {
27: foreach ($GLOBALS['registry']->listApps(null, false, Horde_Perms::READ) as $app) {
28: if ($GLOBALS['registry']->isAuthenticated(array('app' => $app, 'notransparent' => true))) {
29: try {
30: $GLOBALS['registry']->callAppMethod($app, 'setupNotification', array('args' => array($this->_notify), 'noperms' => true));
31: } catch (Exception $e) {
32: continue;
33: }
34: }
35: }
36: } catch (Horde_Exception $e) {
37: }
38:
39: return $this->_notify;
40: }
41: }
42: