--- /dev/null
+<?php
+/**
+ * A Horde_Injector:: based Horde_Alarm:: factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * A Horde_Injector:: based Horde_Core_Ajax_Application:: factory.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Core
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_Alarm
+{
+ /**
+ * Return a Horde_Alarm instance
+ *
+ */
+ public function create(Horde_Injector $injector)
+ {
+ $driver = empty($GLOBALS['conf']['alarms']['driver'])
+ ? 'Null'
+ : $GLOBALS['conf']['alarms']['driver'];
+
+ $params = Horde::getDriverConfig('alarms', $driver);
+
+ if (strcasecmp($driver, 'Sql') === 0) {
+ $params['db'] = $injector->getInstance('Horde_Db')->getDb('horde', 'alarm');
+ $config = $injector->getInstance('Horde_Db')->getConfig('alarm');
+ $params['charset'] = $config['charset'];
+ }
+
+ $params['logger'] = $injector->getInstance('Horde_Log_Logger');
+
+ $class = 'Horde_Alarm_' . $driver;
+ $alarm = new $class($params);
+ $alarm->initialize();
+ $alarm->gc();
+
+ /* Add those handlers that need configuration and can't be auto-loaded
+ * through Horde_Alarms::handlers(). */
+ /*
+ $handler_params = array(
+ 'notification' => $injector->getInstance('Horde_Notification')
+ );
+ $alarm->addHandler('notify', new Horde_Alarm_Handler_Notification($handler_params)
+ );
+
+ $handler_params = array(
+ 'js_notify' => array('Horde', 'addInlineScript'),
+ 'icon' => (string)Horde_Themes::img('alerts/alarm.png')
+ );
+ $alarm->addHandler('desktop', new Horde_Alarm_Handler_Desktop($handler_params));
+ */
+
+ $handler_params = array(
+ 'identity' => $injector->getInstance('Horde_Prefs_Identity'),
+ 'mail' => $injector->getInstance('Horde_Mail'),
+ 'charset' => $GLOBALS['registry']->getCharset()
+ );
+ $alarm->addHandler('mail', new Horde_Alarm_Handler_Mail($handler_params));
+
+ return $alarm;
+ }
+
+}
/* Define binders. */
$binders = array(
- 'Horde_Alarm' => 'Horde_Core_Binder_Alarm',
'Horde_Auth_Factory' => 'Horde_Core_Binder_AuthFactory',
// 'Horde_Browser' - initialized below
'Horde_Core_Auth_Signup' => 'Horde_Core_Binder_AuthSignup',
/* Define factories. */
$factories = array(
+ 'Horde_Alarm' => array(
+ 'Horde_Core_Factory_Alarm',
+ 'create'
+ ),
'Horde_Cache' => array(
'Horde_Core_Factory_Cache',
'create',
</dir> <!-- /lib/Horde/Core/Autoloader/Callback -->
</dir> <!-- /lib/Horde/Core/Autoloader -->
<dir name="Binder">
- <file name="Alarm.php" role="php" />
<file name="Auth.php" role="php" />
<file name="AuthFactory.php" role="php" />
<file name="AuthSignup.php" role="php" />
</dir> <!-- /lib/Horde/Core/Controller -->
<dir name="Factory">
<file name="Ajax.php" role="php" />
+ <file name="Alarm.php" role="php" />
<file name="Auth.php" role="php" />
<file name="Cache.php" role="php" />
<file name="Crypt.php" role="php" />
<install as="Horde/Core/Auth/Signup/SqlObject.php" name="lib/Horde/Core/Auth/Signup/SqlObject.php" />
<install as="Horde/Core/Autoloader/Callback/Mime.php" name="lib/Horde/Core/Autoloader/Callback/Mime.php" />
<install as="Horde/Core/Autoloader/Callback/Nls.php" name="lib/Horde/Core/Autoloader/Callback/Nls.php" />
- <install as="Horde/Core/Binder/Alarm.php" name="lib/Horde/Core/Binder/Alarm.php" />
<install as="Horde/Core/Binder/Auth.php" name="lib/Horde/Core/Binder/Auth.php" />
<install as="Horde/Core/Binder/AuthFactory.php" name="lib/Horde/Core/Binder/AuthFactory.php" />
<install as="Horde/Core/Binder/AuthSignup.php" name="lib/Horde/Core/Binder/AuthSignup.php" />
<install as="Horde/Core/Controller/RequestMapper.php" name="lib/Horde/Core/Controller/RequestMapper.php" />
<install as="Horde/Core/Controller/SettingsFinder.php" name="lib/Horde/Core/Controller/SettingsFinder.php" />
<install as="Horde/Core/Factory/Ajax.php" name="lib/Horde/Core/Factory/Ajax.php" />
+ <install as="Horde/Core/Factory/Alarm.php" name="lib/Horde/Core/Factory/Alarm.php" />
<install as="Horde/Core/Factory/Auth.php" name="lib/Horde/Core/Factory/Auth.php" />
<install as="Horde/Core/Factory/Cache.php" name="lib/Horde/Core/Factory/Cache.php" />
<install as="Horde/Core/Factory/Crypt.php" name="lib/Horde/Core/Factory/Crypt.php" />