[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Users/ -> AuditTrail.php (source)

   1  <?php
   2  
   3  /*********************************************************************************
   4  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   5   * ("License"); You may not use this file except in compliance with the License
   6   * The Original Code is:  vtiger CRM Open Source
   7   * The Initial Developer of the Original Code is vtiger.
   8   * Portions created by vtiger are Copyright (C) vtiger.
   9   * All Rights Reserved.
  10  * 
  11   ********************************************************************************/
  12  
  13  include_once ('config.php');
  14  require_once ('include/logging.php');
  15  require_once ('include/logging.php');
  16  require_once ('include/ListView/ListView.php');
  17  require_once ('include/database/PearDatabase.php');
  18  
  19  /** This class is used to track all the operations done by the particular User while using vtiger crm. 
  20   *  It is intended to be called when the check for audit trail is enabled.
  21   **/
  22  class AuditTrail{
  23  
  24      var $log;
  25      var $db;
  26  
  27      var $auditid;
  28      var $userid;
  29      var $module;
  30      var $action;
  31      var $recordid;
  32      var $actiondate;
  33  
  34      var $module_name = "Users";
  35      var $table_name = "vtiger_audit_trial";
  36      
  37      var $object_name = "AuditTrail";    
  38      
  39      var $new_schema = true;
  40      
  41  	function AuditTrail() {
  42          $this->log = LoggerManager::getLogger('audit_trial');
  43          $this->db = new PearDatabase();
  44      }
  45      
  46      var $sortby_fields = Array('module', 'action', 'actiondate', 'recordid');     
  47  
  48          // This is the list of vtiger_fields that are in the lists.
  49      var $list_fields = Array(
  50              'Module'=>Array('vtiger_audit_trial'=>'module'), 
  51              'Action'=>Array('vtiger_audit_trial'=>'action'), 
  52              'Record'=>Array('vtiger_audit_trial'=>'recordid'),
  53                  'Action Date'=>Array('vtiger_audit_trial'=>'actiondate'), 
  54          );    
  55      
  56      var $list_fields_name = Array(
  57              'Module'=>'module', 
  58              'Action'=>'action', 
  59              'Record'=>'recordid',
  60                  'Action Date'=>'actiondate',
  61          );    
  62          
  63      var $default_order_by = "actiondate";
  64      var $default_sort_order = 'DESC';
  65  /**
  66   * Function to get the Headers of Audit Trail Information like Module, Action, RecordID, ActionDate.
  67   * Returns Header Values like Module, Action etc in an array format.
  68  **/
  69  
  70  	function getAuditTrailHeader()
  71      {
  72          global $log;
  73          $log->debug("Entering getAuditTrailHeader() method ...");
  74          global $app_strings;
  75          
  76          $header_array = array($app_strings['LBL_MODULE'], $app_strings['LBL_ACTION'], $app_strings['LBL_RECORD_ID'], $app_strings['LBL_ACTION_DATE']);
  77  
  78          $log->debug("Exiting getAuditTrailHeader() method ...");
  79          return $header_array;
  80          
  81      }
  82  
  83  /**
  84    * Function to get the Audit Trail Information values of the actions performed by a particular User.
  85    * @param integer $userid - User's ID
  86    * @param $navigation_array - Array values to navigate through the number of entries.
  87    * @param $sortorder - DESC
  88    * @param $orderby - actiondate
  89    * Returns the audit trail entries in an array format.
  90  **/
  91  	function getAuditTrailEntries($userid, $navigation_array, $sorder='', $orderby='')
  92      {
  93          global $log;
  94          $log->debug("Entering getAuditTrailEntries(".$userid.") method ...");
  95          global $adb, $current_user;
  96          
  97          if($sorder != '' && $order_by != '')
  98              $list_query = "Select * from vtiger_audit_trial where userid =".$userid." order by ".$order_by." ".$sorder; 
  99          else
 100              $list_query = "Select * from vtiger_audit_trial where userid =".$userid." order by ".$this->default_order_by." ".$this->default_sort_order;
 101      
 102          $result = $adb->query($list_query);
 103          $entries_list = array();
 104  
 105      if($navigation_array['end_val'] != 0)
 106      {
 107          for($i = $navigation_array['start']; $i <= $navigation_array['end_val']; $i++)
 108          {
 109              $entries = array();
 110              $userid = $adb->query_result($result, $i-1, 'userid');
 111          
 112              $entries[] = $adb->query_result($result, $i-1, 'module');
 113              $entries[] = $adb->query_result($result, $i-1, 'action');
 114              $entries[] = $adb->query_result($result, $i-1, 'recordid');
 115              $entries[] = $adb->query_result($result, $i-1, 'actiondate');
 116              
 117              $entries_list[] = $entries;
 118          }
 119          $log->debug("Exiting getAuditTrailEntries() method ...");
 120          return $entries_list;    
 121      }
 122      }
 123  }
 124  
 125  
 126  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7