PHP Classes
elePHPant
Icontem

D3 PHP Record Audit Trail: Keep track of changes to model object data values

Recommend this page to a friend!

  Author Author  
Name: Uldis Nelsons <contact>
Classes: 7 packages by
Country: Latvia Latvia
Innovation award
Innovation award
Nominee: 4x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz  
This package can be used to keep track of changes to model object data values.

It can add a behavior to model classes that use the YII framework, so it can create a trail of changes done to the values of to objects of those model classes by recording in a separate table the list of changes done on those model objects.

The model classes need to implement a few functions that define which values of the model objects are recorded or not in the audit trail table.


Details

Total Downloads

Display audittrail data

Add migrations paths

    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@vendor/sammaye/yii2-audittrail/migrations',
                '@vendor/d3yii2/d3audittrail/migrations',

            ],
        ],
    ],

Define module in console and web

    'modules' => [

        'd3audittrail' => [
            'class' => 'd3yii2\d3audittrail\Module',
        ],
    ]    

define in parameters table name

    'params' => [
        'audittrail.table' => 'tbl_audit_trail'
    ]    

Add to model behaviors


    public function behaviors(): array
    {
        return ArrayHelper::merge(
            parent::behaviors(),
            [
                'sammaye\audittrail\LoggableBehavior'
            ]
        );
    }

Define model label

class Model extends extends \yii\db\ActiveRecord
    /
    * model label 
    */
    public function tableLabel(): string
    {
        return 'Data Record';
    }

    public static function audittrailHiddedFields()
    {
        return [
            'password'
        ];
    }

    public static function audittrailSqlFields()
    {
        return [
            'client_id' => 'select name from client where id=:id'
        ];
    }

    public static function audittrailRefModels()
    {
        return [
            [
                'model' => TblAuditTrail::class,
                'ref_field' => 'my_id',
                'hidded_fields' => ['a','b'],
                'field_sql' => [
                    'field1' => 'select name from user where id=:id'
                 ]               
            ]           
        ];
    }
}

Add to view button

    $this->addPageButtons(AuditTrailButton::widget([
                'modelName' => coalmar\delivery\models\CmdDelivery::className(),
                'modelId' => $model->id
    ]));

  Classes of Uldis Nelsons  >  D3 PHP Record Audit Trail  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  

 

Name: D3 PHP Record Audit Trail
Base name: d3audittrail
Description: Keep track of changes to model object data values
Version: -
PHP version: 5
License: Freeware
 
  Groups   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Databases Database management, accessing and searching View top rated classes
Group folder image Libraries Frameworks and libraries of cooperating classes View top rated classes
Group folder image Design Patterns Implementations of well known design patterns View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imageactions (1 file)
Files folder imagecontrollers (1 file)
Files folder imagegii (1 file)
Files folder imagemessages (1 directory)
Files folder imagemigrations (1 file)
Files folder imagemodels (1 file, 1 directory)
Files folder imagetraits (1 file)
Files folder imageviews (1 directory)
Files folder imagewidgets (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file Module.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  actions  
File Role Description
  Plain text file AudittrailListAction.php Class Class source

  Files folder image Files  /  controllers  
File Role Description
  Plain text file DataController.php Class Class source

  Files folder image Files  /  gii  
File Role Description
  Accessible without login Plain text file tbl_audit_trailGiiantModel.json Data Auxiliary data

  Files folder image Files  /  messages  
File Role Description
Files folder imagelv (1 file)

  Files folder image Files  /  messages  /  lv  
File Role Description
  Accessible without login Plain text file d3audittrail.php Aux. Auxiliary script

  Files folder image Files  /  migrations  
File Role Description
  Plain text file m171106_184558_utf...r_value_columns.php Class Class source

  Files folder image Files  /  models  
File Role Description
Files folder imagebase (1 file)
  Plain text file TblAuditTrail.php Class Class source

  Files folder image Files  /  models  /  base  
File Role Description
  Plain text file TblAuditTrail.php Class Class source

  Files folder image Files  /  traits  
File Role Description
  Plain text file ActiveRecordDbConnectionTrait.php Class Class source

  Files folder image Files  /  views  
File Role Description
Files folder imagedata (1 file)

  Files folder image Files  /  views  /  data  
File Role Description
  Accessible without login Plain text file list.php Example Example script

  Files folder image Files  /  widgets  
File Role Description
  Plain text file AuditTrailActionButton.php Class Class source
  Plain text file AuditTrailButton.php Class Class source

Download Download all files: d3audittrail.tar.gz d3audittrail.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.