CWIS Developer Documentation
Public Member Functions | List of all members
EventLog Class Reference

Class for storing and retrieving event information from database. More...

Inheritance diagram for EventLog:
Inheritance graph
[legend]

Public Member Functions

 __construct ($DB, $UserId=-1, $LoggingEnabled=TRUE)
 Object constructor. More...
 
 Log ($Type, $DataOne="", $DataTwo="")
 Add event to log. More...
 
 FindEvents ($StartDate=NULL, $EndDate=NULL, $EventCount=999999999)
 Retrieve specified range of events. More...
 
 ExcludeUsersWithPrivilegesForFind ($Operator, $Value)
 Add privilege to exclude from FindEvents() results. More...
 
 AddSqlConditionForFind ($Conditions)
 Add SQL condition to apply to FindEvents(). More...
 
 LimitFindToUser ($UserId=NULL)
 Limit FindEvents() results to user with specified ID. More...
 
 ModifyEvents ($EventType, $EventDate, $UserId, $DataOne=NULL, $DataTwo=NULL, $Condition=NULL)
 Modify existing events. More...
 

Detailed Description

Class for storing and retrieving event information from database.

Definition at line 22 of file EventLog.php.

Constructor & Destructor Documentation

EventLog::__construct (   $DB,
  $UserId = -1,
  $LoggingEnabled = TRUE 
)

Object constructor.

Parameters
Database$DBDatabase object.
int$UserIdID of current user. (OPTIONAL)
bool$LoggingEnabledWhether event logging is currently enabled. (OPTIONAL, defaults to TRUE)

Definition at line 34 of file EventLog.php.

Member Function Documentation

EventLog::AddSqlConditionForFind (   $Conditions)

Add SQL condition to apply to FindEvents().

Multiple conditions are ANDed. Pass in NULL to clear all current conditions.

Parameters
string$ConditionsString with single condition or array with multiple conditions.

Definition at line 194 of file EventLog.php.

Referenced by LimitFindToUser().

Here is the caller graph for this function:

EventLog::ExcludeUsersWithPrivilegesForFind (   $Operator,
  $Value 
)

Add privilege to exclude from FindEvents() results.

Operators should be SQL-compatible (i.e. "=" for equals, not "=="). Multiple operator/value conditions are ORed together. Pass in NULL for Operator and NULL for Value to clear all current exclusions.

Parameters
string$OperatorNumerical comparison operator to use with privilege (for example: "=", ">", "<=", "!=" etc)..
int$ValuePrivilege value to compare.

Definition at line 170 of file EventLog.php.

EventLog::FindEvents (   $StartDate = NULL,
  $EndDate = NULL,
  $EventCount = 999999999 
)

Retrieve specified range of events.

Takes a variable number of arguments, with as many event type parameters added on to the end as desired. Dates are inclusive.

Parameters
string$StartDateStart date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
string$EndDateEnd date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
int$EventCountMaximum number of events to retrieve. (OPTIONAL)
Returns
Array of event records, with each record having the indexes "EventType", "EventDate", "UserId", "DataOne", and "DataTwo".

Definition at line 73 of file EventLog.php.

EventLog::LimitFindToUser (   $UserId = NULL)

Limit FindEvents() results to user with specified ID.

Parameters
int$UserIdUser ID to return results for. (OPTIONAL, defaults to NULL which uses user ID passed in to EventLog())

Definition at line 219 of file EventLog.php.

References AddSqlConditionForFind().

EventLog::Log (   $Type,
  $DataOne = "",
  $DataTwo = "" 
)

Add event to log.

Parameters
int$TypeType of event.
mixed$DataOneFirst data value for event. (OPTIONAL)
mixed$DataTwoSecond data value for event. (OPTIONAL)

Definition at line 47 of file EventLog.php.

EventLog::ModifyEvents (   $EventType,
  $EventDate,
  $UserId,
  $DataOne = NULL,
  $DataTwo = NULL,
  $Condition = NULL 
)

Modify existing events.

All parameters are ANDed to select which events are modified.

Parameters
int$EventTypeCode for type of events to modify.
string$EventDateSQL-compatible date for events to modify.
int$UserIdID for user for events to modify.
mixed$DataOneNew value for DataOne field. (OPTIONAL, pass in NULL to not modify field)
mixed$DataTwoNew value for DataTwo field. (OPTIONAL, pass in NULL to not modify field)
string$ConditionSQL condition to apply to select events to modify.

Definition at line 240 of file EventLog.php.


The documentation for this class was generated from the following file: