\TraffStats
Basic traffic stats/charts report implementation
Synopsis
class TraffStats
{
- // constants
- const URL_ME = '?module=traffstats';
- const ROUTE_PROX_IMG = 'loadimg';
- const ROUTE_LOGIN = 'username';
- const ROUTE_AJUSER = 'defferedgraph';
- const ROUTE_AJCAT = 'grcat';
- const KEY_GRAPH = 'DEFFEREDGRAPH';
- const AJ_CONTAINER = 'ajdefferedcontainer';
- // members
- protected array $altCfg = ;
- protected boolean $ishimuraFlag = false;
- protected $ishimuraDb = '';
- protected bool $ophanimFlag = false;
- protected $ophanimFlow = '';
- protected array $userData = ;
- protected array $ishimuraData = ;
- protected string $trafScale = 'float';
- protected $statsDb = '';
- protected array $trafStats = ;
- protected array $dirs = ;
- protected string $login = '';
- protected bool $ondemandFlag = true;
- protected $cache = '';
- protected integer $cachingTimeout = 3600;
- protected $messages = '';
- // methods
- public void __construct()
- protected void setLogin()
- protected void initMessages()
- protected void initCache()
- protected void loadDirs()
- protected void loadConfigs()
- protected void loadUserData()
- protected void initDbLayers()
- protected void loadIshimuraStats()
- protected array getUserDataCounters()
- protected array getUserIshimuraCounters()
- protected string getUserIp()
- protected void loadTraffStats()
- protected array getUserPrevMonthTraff()
- protected string renderCurMonthStats()
- protected string|array getOphCustomDimensions()
- protected array genGraphLinks()
- protected string renderCharts()
- protected string getAjChartLink()
- protected string renderPrevMonthStats()
- public string renderUserTraffStats()
- public void catchImgProxyRequest()
- public void catchDefferedCallback()
- public string renderTrafficReport()
- public string renderTrafficReportNasCharts()
Constants
Name | Value |
---|---|
URL_ME | '?module=traffstats' |
ROUTE_PROX_IMG | 'loadimg' |
ROUTE_LOGIN | 'username' |
ROUTE_AJUSER | 'defferedgraph' |
ROUTE_AJCAT | 'grcat' |
KEY_GRAPH | 'DEFFEREDGRAPH' |
AJ_CONTAINER | 'ajdefferedcontainer' |
Members
protected
- $altCfg
—
array
System alter config as key=>value - $cache
—
System caching object instance - $cachingTimeout
—
int
Default caching timeout - $dirs
—
array
Contains available traffic directions/classes as index=>ruleNum - $ishimuraData
—
array
Contains ishimura user traffic stats - $ishimuraDb
—
Ishimura database abstraction layer - $ishimuraFlag
—
string
Ishimura enabled flag - $login
—
string
Contains current instance login - $messages
—
System messages helper object placeholder - $ondemandFlag
—
bool
On-demand charts loading flag - $ophanimFlag
—
bool
OphanimFlow integration flag - $ophanimFlow
—
OphanimFlow object instance - $statsDb
—
Previous months traffic stats database abstraction layer - $trafScale
—
string
Contains TRAFFSIZE option value - $trafStats
—
array
Contains previous user traffic stats as year=>month=>data - $userData
—
array
Contains all available users data
Methods
protected
- genGraphLinks() — Generates user IP graph images links array
- getAjChartLink() — Returns link body for deffered charts loading
- getOphCustomDimensions() — Returns the custom dimensions for OphanimFlow charts.
- getUserDataCounters() — Returns native stargazer user current month traffic counters
- getUserIp() — Returns fastly user IP from preloaded userdata
- getUserIshimuraCounters() — Returns ishimura user traffic counters for selected year/month
- getUserPrevMonthTraff() — Returns stats record for selected year/month/class
- initCache() — Inits system caching engine
- initDbLayers() — Inits required database abstraction layers and required objects
- initMessages() — Inits message helper instance for further usage
- loadConfigs() — Loads required config and sets some properties
- loadDirs() — Loads traffic directions
- loadIshimuraStats() — Loads ishimura user traffic data as year=>month=>D0/U0
- loadTraffStats() — Loads all previous user traffic stats into protected property
- loadUserData() — Loads all available users data
- renderCharts() — Renders user traffic charts
- renderCurMonthStats() — Render current month traffic report part
- renderPrevMonthStats() — Renders all previous months user traffic stats
- setLogin() — Sets current instance login
public
- __construct() — Creates new traffStats instance
- catchDefferedCallback() — Renders deffered chart request data
- catchImgProxyRequest() — Catches image proxy request and renders some image
- renderTrafficReport() — Renders the global traffic report.
- renderTrafficReportNasCharts() — Renders the traffic report NAS charts.
- renderUserTraffStats() — Generates user`s traffic full statistics report