steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification Event.php, NONE, 1.1 Listener.php, NONE, 1.1
cvs at intevation.de
cvs at intevation.de
Fri Oct 14 16:33:11 CEST 2005
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification Notification.php, NONE, 1.1 package.xml, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener javascript.php, NONE, 1.1 mobile.php, NONE, 1.1 status.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: steffen
Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Notification/Notification
Added Files:
Event.php Listener.php
Log Message:
Separated Horde Framework from kolab-resource-handlers
--- NEW FILE: Event.php ---
<?php
/**
* The Notification_Event:: class provides a container for passing
* messages to Notification_Listener classes.
*
* $Horde: framework/Notification/Notification/Event.php,v 1.4 2004/01/01 15:16:09 jan Exp $
*
* Copyright 2002-2004 Hans Lellelid <hans at velum.net>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
* @author Hans Lellelid <hans at velum.net>
* @version $Revision: 1.1 $
* @since Horde 3.0
* @package Horde_Notification
*/
class Notification_Event {
/**
* The message being passed.
* @var string $_message
* @access private
*/
var $_message = '';
/**
* If passed, sets the message for this event.
*
* @param string $message (optional) The text message for this event.
* @access public
*/
function Notification_Event($message = null)
{
if (!is_null($message)) {
$this->setMessage($message);
}
}
/**
* Sets the text message for this event.
*
* @param string $message The text message to display.
* @access public
*/
function setMessage($message)
{
$this->_message = $message;
}
/**
* Gets the text message for this event.
*
* @return string The text message to display.
* @access public
*/
function getMessage()
{
return $this->_message;
}
}
--- NEW FILE: Listener.php ---
<?php
/**
* The Notification_Listener:: class provides functionality for displaying
* messages from the message stack as a status line.
*
* $Horde: framework/Notification/Notification/Listener.php,v 1.13 2004/03/22 20:43:59 chuck Exp $
*
* Copyright 2001-2004 Chuck Hagenbuch <chuck at 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.
*
* @author Chuck Hagenbuch <chuck at horde.org>
* @version $Revision: 1.1 $
* @since Horde 2.1
* @package Horde_Notification
*/
class Notification_Listener {
/**
* Array of message types that this listener handles.
*
* @var array $_handles
*/
var $_handles = array();
/**
* Constructor
*
* @access public
*/
function Notification_Listener()
{
}
/**
* Does this listener handle a certain type of message?
*
* @access public
*
* @param string $type The message type in question.
*
* @return boolean Whether this listener handles the type.
*/
function handles($type)
{
return isset($this->_handles[$type]);
}
/**
* Return a unique identifier for this listener.
*
* @access public
*
* @return string Unique id.
*/
function getName()
{
return get_class($this);
}
/**
* Outputs the status line, sends emails, pages, etc., if there
* are any messages on this listener's message stack.
*
* @access public
*
* @param array &$messageStack The stack of messages.
* @param optional array $options An array of options.
* Options: 'nospace'
*/
function notify(&$messageStacks, $options)
{
}
/**
* Processes one message from the message stack.
*
* @access public
*
* @param array $message One message hash from the stack.
*/
function getMessage($message)
{
}
/**
* Unserialize an event from the message stack, checking to see if
* the appropriate class exists and kludging it into a base
* Notification_Event object if not.
*
* @access public
*/
function getEvent($message)
{
$ob = false;
if (class_exists($message['class'])) {
$ob = @unserialize($message['event']);
} else {
require_once dirname(__FILE__) . '/Event.php';
$ob = @unserialize($message['event']);
if (!method_exists($ob, 'getMessage')) {
if (isset($ob->_message)) {
$ob = &new Notification_Event($ob->_message);
}
}
}
/* If we've failed to create a valid Notification_Event object
* (or subclass object) so far, return a PEAR_Error. */
if (!method_exists($ob, 'getMessage')) {
$ob = PEAR::raiseError('Unable to decode message event: ' . $message['event']);
}
return $ob;
}
/**
* Unserialize an array of event flags from the message stack. If
* this event has no flags, or the flags array could not be
* unserialized, an empty array is returned.
*
* @access public
*
* @return array An array of flags.
*/
function getFlags($message)
{
/* If this message doesn't have any flags, return an empty
* array. */
if (empty($message['flags'])) {
return array();
}
/* Unserialize the flags array from the message. */
$flags = @unserialize($message['flags']);
/* If we couldn't unserialize the flags array, return an empty
* array. */
if (!is_array($flags)) {
return array();
}
return $flags;
}
}
- Previous message: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification Notification.php, NONE, 1.1 package.xml, NONE, 1.1
- Next message: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener javascript.php, NONE, 1.1 mobile.php, NONE, 1.1 status.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list