<?php
require('access_func.php');
 
//**********************************************************************************
$_SESSION['module']['addlink'] = SableSystem::getCallPageLink('/access/add.php');
$_SESSION['listParams']['searchVisible'] = 1;
if (isset($_POST))
{
$_SESSION['listParams']['searchField'][0] = 'access_name';
$_SESSION['listParams']['searchField'][1] = 'access_level';
}
 
$_SESSION['listParams']['listSql'] = "select access_id, access_name, access_level from access";
$_SESSION['listParams']['module']	= "Access";
 
$_SESSION['listParams']['page']				    = 0;
$_SESSION['listParams']['offset']			    = 30; //the number of records to display per page
$_SESSION['listParams']['parentId']			  = ""; //
$_SESSION['listParams']['moduleFolder']		= "access";
$_SESSION['listParams']['modulePage']      = "index.php";
$_SESSION['listParams']['moduleIdField']   = "access_id";
$_SESSION['listParams']['moduleDescField']	= "access_name";
$_SESSION['listParams']['orderField']		  = 1;
$_SESSION['listParams']['orderDirection']	= 0;
 
$_SESSION['listParams']['listHeadings'][0] = "Access Name";
$_SESSION['listParams']['listHeadings'][1] = "Access Level";
if ($_SESSION['user']['access_level'] >= 3) 
{
  $_SESSION['listParams']['listHeadings'][2] = ""; //view
}
if ($_SESSION['user']['access_level'] >= 6) 
{
  $_SESSION['listParams']['listHeadings'][3] = ""; //edit
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listHeadings'][4] = ""; //copy
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listHeadings'][5] = ""; //delete
}
$_SESSION['listParams']['listHeadingWidth'][0] = "17%";
$_SESSION['listParams']['listHeadingWidth'][1] = "17%";
if ($_SESSION['user']['access_level'] >= 3) 
{
  $_SESSION['listParams']['listHeadingWidth'][2] = "5%"; //view
}
if ($_SESSION['user']['access_level'] >= 6) 
{
  $_SESSION['listParams']['listHeadingWidth'][3] = "5%"; //edit
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listHeadingWidth'][4] = "5%"; //copy
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listHeadingWidth'][5] = "5%"; //delete
}
$_SESSION['listParams']['listFields'][0]['field'] = "access_name";
$_SESSION['listParams']['listFields'][1]['field'] = "access_level";
if ($_SESSION['user']['access_level'] >= 3) 
{
  $_SESSION['listParams']['listFields'][2]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_VIEW."' title='View --!--'></i>";
  $_SESSION['listParams']['listFields'][2]['onClick'] = " onClick='viewAccess(\"--#--\")' ";
}
if ($_SESSION['user']['access_level'] >= 6) 
{
  $_SESSION['listParams']['listFields'][3]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_EDIT."' title='Modify --!--'></i>";
  $_SESSION['listParams']['listFields'][3]['onClick'] = " onClick='editAccess(\"--#--\")' ";
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listFields'][4]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_COPY."' title='Copy --!--'></i>";
  $_SESSION['listParams']['listFields'][4]['onClick'] = " onClick='copyAccess(\"--#--\",\"--!--\")' ";
}
if ($_SESSION['user']['access_level'] >= 9) 
{
  $_SESSION['listParams']['listFields'][5]['field'] = "<i class='fa fa-2x ".SABLE_DATALIST_DELETE."' title='Delete --!--'></i>";
  $_SESSION['listParams']['listFields'][5]['onClick'] = " onClick='deleteAccess(\"--#--\",\"--!--\")' ";
}
SableGeneralFunctions::callDataList();
?>
