CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
EventLog Class Reference

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

Inheritance diagram for EventLog:
[legend]

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

## Detailed Description

Class for storing and retrieving event information from database.

Definition at line 22 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

  Conditions | String with single condition or array with multiple conditions.

Definition at line 192 of file EventLog.php.

Referenced by LimitFindToUser().

Here is the caller graph for this function:

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

Object constructor.

Parameters

  DB | Database object.
  UserId | ID of current user. (OPTIONAL)
  LoggingEnabled | Whether event logging is currently enabled. (OPTIONAL, defaults to TRUE)

Definition at line 33 of file EventLog.php.

Referenced by SPTEventLog\SPTEventLog().

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

  Operator | Numerical comparison operator to use with privilege (for example: "=", ">", "<=", "!=" etc)..
  Value | Privilege value to compare.

Definition at line 169 of file EventLog.php.

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

Retrieve specified range of events.

Takes a variable number of arguments, with as many EventType parameters as desired. Dates are inclusive.

Parameters

  StartDate | Start date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
  EndDate | End date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
  EventCount | Maximum number of events to retrieve. (OPTIONAL)
  EventType | Type of event to find. (OPTIONAL)

Returns
  Array of event records, with each record having the indexes "EventType", "EventDate", "UserId", "DataOne", and "DataTwo".

Definition at line 72 of file EventLog.php.

EventLog::LimitFindToUser | ( |  | $UserId = `NULL` | ) |

Limit FindEvents() results to user with specified ID.

Parameters

  UserId | User ID to return results for. (OPTIONAL, defaults to NULL which uses user ID passed in to EventLog())

Definition at line 217 of file EventLog.php.

References AddSqlConditionForFind().

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

Add event to log.

Parameters

  Type | Type of event.
  DataOne | First data value for event. (OPTIONAL)
  DataTwo | Second data value for event. (OPTIONAL)

Definition at line 46 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

  EventType | Code for type of events to modify.
  EventDate | SQL-compatible date for events to modify.
  UserId | ID for user for events to modify.
  DataOne | New value for DataOne field. (OPTIONAL, pass in NULL to not modify field)
  DataTwo | New value for DataTwo field. (OPTIONAL, pass in NULL to not modify field)
  Condition | SQL condition to apply to select events to modify.

Definition at line 236 of file EventLog.php.

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

- lib/ScoutLib/EventLog.php