<?php
require_once(__DIR__.'/../includes/sysinit.php');
require(SABLE_WORKING_PATH.'audit/audit_func.php');
//**********************************************************************************
$_SESSION['listParams']['searchVisible'] = 1;
if (isset($_POST))
{
	$_SESSION['listParams']['searchField'][0] = 'audit_id';
	$_SESSION['listParams']['searchField'][1] = 'item_id';
	$_SESSION['listParams']['searchField'][2] = 'audit_desc';
	$_SESSION['listParams']['searchField'][3]['title'] = 'user_full_name';
	$_SESSION['listParams']['searchField'][3][0] = 'user_name';
	$_SESSION['listParams']['searchField'][3][1] = 'user_surname';
	$_SESSION['listParams']['searchField'][4] = 'audit_time';
	$_SESSION['listParams']['searchField'][5] = 'ip_address';
}

$_SESSION['listParams']['listSql'] = "select audit_id, item_id, audit_desc, 
									  concat(user_name, ' ', user_surname) as user_full_name, audit_time, ip_address
									  from audit
									  inner join user on user.user_code = audit.user_code";

$_SESSION['listParams']['module']					= "audit";
$_SESSION['listParams']['page']						= 0;
$_SESSION['listParams']['offset']					= 50; //the number of records to display per page
$_SESSION['listParams']['parentId']					= ""; //
$_SESSION['listParams']['moduleFolder']				= "audit";
$_SESSION['listParams']['moduleFolderDesc']			= "System Audit";
$_SESSION['listParams']['modulePage']				= "index.php";
$_SESSION['listParams']['moduleIdField']			= "audit_id";
$_SESSION['listParams']['moduleDescField']			= "audit_desc";
$_SESSION['listParams']['orderField']				= 4;
$_SESSION['listParams']['orderDirection']			= 1;

$_SESSION['listParams']['listHeadings'][0] = "ID";
$_SESSION['listParams']['listHeadings'][1] = "Code";
$_SESSION['listParams']['listHeadings'][2] = "Description";
$_SESSION['listParams']['listHeadings'][3] = "User";
$_SESSION['listParams']['listHeadings'][4] = "Time";
$_SESSION['listParams']['listHeadings'][5] = "IP";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER){	$_SESSION['listParams']['listHeadings'][6] = "";} //Add

$_SESSION['listParams']['listHeadingWidth'][0] = "5%";
$_SESSION['listParams']['listHeadingWidth'][1] = "5%";
$_SESSION['listParams']['listHeadingWidth'][2] = "25%";
$_SESSION['listParams']['listHeadingWidth'][3] = "8%";
$_SESSION['listParams']['listHeadingWidth'][4] = "12%";
$_SESSION['listParams']['listHeadingWidth'][5] = "7%";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER){$_SESSION['listParams']['listHeadingWidth'][6] = "5%";} //View

$_SESSION['listParams']['listFields'][0]['field']			= "audit_id";
$_SESSION['listParams']['listFields'][1]['field']			= "item_id";
$_SESSION['listParams']['listFields'][2]['field']			= "audit_desc";
$_SESSION['listParams']['listFields'][3]['field']			= "user_full_name";
$_SESSION['listParams']['listFields'][4]['field']			= "audit_time";
$_SESSION['listParams']['listFields'][5]['field']			= "ip_address";
if ($_SESSION['user']['access_level'] >= SABLE_ACCESS_USER) 
{
	$_SESSION['listParams']['listFields'][6]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_VIEW."' title='View --!--'></i>";
	$_SESSION['listParams']['listFields'][6]['onClick'] = " onClick='viewAudit(\"--#--\")' ";
}
SableGeneralFunctions::callDataList();
