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
| __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, $EventType)
| 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 | $DB | Database object.
  int | $UserId | ID of current user. (OPTIONAL)
  bool | $LoggingEnabled | Whether event logging is currently enabled. (OPTIONAL, defaults to TRUE)

Definition at line 33 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 | $Conditions | String with single condition or array with multiple conditions.

Definition at line 193 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 | $Operator | Numerical comparison operator to use with privilege (for example: "=", ">", "<=", "!=" etc)..
  int | $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

  string | $StartDate | Start date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
  string | $EndDate | End date of range to search in SQL-compatible format. (OPTIONAL, pass NULL to omit)
  int | $EventCount | Maximum number of events to retrieve. (OPTIONAL)
  int | $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

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

Definition at line 218 of file EventLog.php.

References AddSqlConditionForFind().

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

Add event to log.

Parameters

  int | $Type | Type of event.
  mixed | $DataOne | First data value for event. (OPTIONAL)
  mixed | $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

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

Definition at line 239 of file EventLog.php.

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

- lib/ScoutLib/EventLog.php