audittrail AuditTrail module includes behaviors, controllers, and widgets to make things easy to use!

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

Update 1.2.0 This module now uses migrations for database management and does not require user ids or table ids to be numeric. Many typos fixed. Widget can now be configured for display like ZDataGrid Requires Yii 1.6 or higher

Update 1.1.1 Widget now works with blog demo, is more resource efficient. Only requires Yii 1.1

Update 1.1.0 No Longer Requires xportlet, it uses zii CPortlet instead. Only requires Yii 1.1

This is the audit trail module. My goal is to get you from scratch to a usable audit trail in less than five minutes.

This module provides basic access to any changes performed via active record through any class that has the LoggableBehavior assigned. It is based off of this cookbook article:

http://www.yiiframework.com/wiki/9/how-to-log-changes-of-activerecords

I've extended the functionality a little bit and made it easy to include audit trail records anywhere one your site, and manage the audit trail from a central location.

I also included a "Getting started" page with the module, including step by step setup instructions (although there aren't too many steps!) and bundled an installer script and detailed documentation for it's usage.

Any recommendations would be greatly appreciated!

Requirements

  • Yii 1.6 or above
  • Your tables must have a field called id that is the primary key (so audit trail can effectively log table changes)

Installation

  1. Unzip auditTrail.zip and move the auditTrail folder to your /protected/modules folder
  2. Add the following code to your /protected/config/main.php
...
	'import'=>array(
		...
		'application.modules.auditTrail.models.AuditTrail',
		...
	),
	...
	'modules'=>array(
		...
		'auditTrail'=>array(),
		...
	),
	...
  1. Visit http://yourapp/index?r=auditTrail
  2. From there, read up for more instructions and configuration options

Usage

Put this code in any Active Record Model

public function behaviors()
{
	return array(
		'LoggableBehavior'=>
			'application.modules.auditTrail.behaviors.LoggableBehavior',
	);
}

Then put this widget on any view or update page to see changes to the object

$this->widget(
	'application.modules.auditTrail.widgets.portlets.ShowAuditTrail',
	array(
		'model' => $model,
	)
);

Also there are a few more features. Download and try it to see what all it can do!

Resources

29 1
49 followers
4 021 downloads
Yii Version: 1.1
License: MIT
Category: Logging
Developed by: MadSkillsTisdale
Created on: Nov 29, 2010
Last updated: 13 years ago

Downloads

show all

Related Extensions