* @copyright 2005 by http://wombat.exit0.net * @package wombatSite * @subpackage event */ /** * event * * * @version 1.0.0 * @package wombatSite * @subpackage event */ class wbEvent { /** * event id * @public array $_id */ public $_id; /** * event message * @public string $_msg */ public $_msg; /** * event data * @public string $_data */ public $_data; /** * event timestamp * @public string $_timestamp */ public $_timestamp; /** * link data * @public string $_link */ public $_link; /** * constructor * * @access public */ public function __construct( $id, $msg, $data = array(), $link = array() ) { $this->_id = $id; $this->_msg = $msg; $this->_data = $data; $this->_link = $link; $this->_timestamp = date( 'Y-m-d H:i:s' ); } /** * constructor wrapper for PHP4 * * @access public * @see __construct() */ public function wbEvent( $id, $msg, $data = array(), $link = array() ) { $this->__construct( $id, $msg, $data, $link ); } /** * recieve event id * * @access public * @return array $id */ public function getId() { return $this->_id; } /** * recieve event timestamp * * @access public * @return array $id */ public function getTimestamp() { return $this->_id; } /** * recieve event message * * @access public * @return string $msg */ public function getMsg() { $msg = $this->_msg; foreach( $this->_data as $key => $value ) { $msg = str_replace( '{' . strtoupper( $key ) . '}', $value, $msg ); } return $msg; } /** * recieve event data * * @access public * @return string $msg */ public function getData() { return $this->_data; } /** * recieve event link information * * @access public * @return string $msg */ public function getLink() { return $this->_link; } /** * trigger event * * @static * @param string $id event id - use namespaces * @param string $msg event message * @param array $data additional information * @param array $data additional information * @return boolean $result of error controller trigger * @see */ public function trigger( $id, $msg, $data = array(), $link = array() ) { $e = new wbEvent( $id, $msg, $data, $link ); $ctl = wbFactory::singleton( 'wbEventController' ); return $ctl->trigger( $e ); } }