Class XOAD_Events_Storage

Description

XOAD Events Storage Class.

This class is used as base class for all XOAD Events storage providers.

The class also defines the getStorage method which is used to retrieve an instane to the configurated storage.

Example XOAD Events provider: XOAD_Events_Storage_MySQL.

Example:

  1. <?php
  2.  
  3. define('XOAD_EVENTS_STORAGE_DSN', 'MySQL://server=?;user=?;password=?;database=?');
  4.  
  5. require_once('xoad.php');
  6.  
  7. // The line below will return a XOAD_Events_Storage_MySQL
  8. // class instance.
  9. $storage =& XOAD_Events_Storage::getStorage();
  10.  
  11. $storage->postEvent('event', 'class');
  12.  
  13. ?>

  • version: 0.6.0.0
  • author: Stanimir Angeloff

Located in /classes/events/Storage.class.php (line 62)


	
			
Direct descendents
Class Description
 class XOAD_Events_Storage_File XOAD Events Storage File Class.
 class XOAD_Events_Storage_MySQL XOAD Events Storage MySQL Class.
 class XOAD_Events_Storage_PearDB XOAD Events Storage PearDB Class.
Method Summary
 XOAD_Events_Storage XOAD_Events_Storage ([string $dsn = null])
 int cleanEvents ()
 array filterEvents (string $event, string $class, [string $filter = null], [int $time = null])
 bool filterMultipleEvents (mixed &$event)
 object Singleton &getStorage ()
 bool postEvent (string $event, string $class, [object $sender = null], [mixed $data = null], [string $filter = null], [int $time = null], [int $lifetime = null])
 bool postMultipleEvents (mixed &$event)
Methods
Constructor XOAD_Events_Storage (line 73)

Creates a new instance of the XOAD_Events_Storage class.

  • access: public
XOAD_Events_Storage XOAD_Events_Storage ([string $dsn = null])
  • string $dsn: The data source name and parameters to use when creating the instance.
cleanEvents (line 263)

This method should be called from each successor to retrieve the start time of the old events in the storage.

  • return: The start time of the old events.
  • access: public
int cleanEvents ()

Redefined in descendants as:
filterEvents (line 294)

Filters the events in the storage using a single criteria.

The $event and $class arguments are required for each event. The $filter and $time arguments are optional.

This method calls filterMultipleEvents with the appropriate arguments.

  • return: Sequental array that contains all events that match the supplied criterias, ordered by time (ascending).
  • access: public
array filterEvents (string $event, string $class, [string $filter = null], [int $time = null])
  • string $event: The event name (case-sensitive).
  • string $class: The class that is the source of the event.
  • string $filter: The event filter data (case-insensitive). Using this argument you can filter events with the same name but with different filter data.
  • int $time: The event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
filterMultipleEvents (line 318)

This method should be called from each successor to add common data to the event.

When you call this method you should pass an associative array that contains the event data. This method will populate it with the missing information and will check the validity of the presented.

  • return: true on success, false otherwise
  • access: public
bool filterMultipleEvents (mixed &$event)

Redefined in descendants as:
getStorage (line 115)

Retrieves an instanse to the configurated XOAD Events storage provider.

Example:

  1. <?php
  2.  
  3. require_once('xoad.php');
  4.  
  5. $storage =& XOAD_Events_Storage::getStorage();
  6.  
  7. $storage->postEvent('event', 'class');
  8.  
  9. ?>

object Singleton &getStorage ()

Redefined in descendants as:
postEvent (line 199)

Posts a single event to the storage.

The $event and $class arguments are required for each event. The $sender, $data, $filter, $time and $lifetime arguments are optional.

In case you have supplied both $class and $sender, then the $sender's class must match the one you've supplied.

This method calls postMultipleEvents with the appropriate arguments.

  • return: true on success, false otherwise.
  • access: public
bool postEvent (string $event, string $class, [object $sender = null], [mixed $data = null], [string $filter = null], [int $time = null], [int $lifetime = null])
  • string $event: The event name (case-sensitive).
  • string $class: The class that is the source of the event.
  • object $sender: The sender object of the event.
  • mixed $data: The data associated with the event.
  • string $filter: The event filter data (case-insensitive). Using this argument you can post events with the same name but with different filter data. The client will respond to them individually.
  • int $time: The event start time (seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
  • int $lifetime: The event lifetime (in seconds).
postMultipleEvents (line 226)

This method should be called from each successor to add common data to the event.

When you call this method you should pass an associative array that contains the event data. This method will populate it with the missing information and will check the validity of the presented.

  • return: true on success, false otherwise
  • access: public
bool postMultipleEvents (mixed &$event)

Redefined in descendants as:

Documentation generated on Sat, 12 Nov 2005 20:24:47 +0200 by phpDocumentor 1.3.0RC3