\PowerTariffs
Alternative tariffication model
Synopsis
class PowerTariffs
{
- // constants
- const URL_ME = '?module=pt';
- const TABLE_TARIFFS = 'pt_tariffs';
- const TABLE_USERS = 'pt_users';
- const TABLE_PAYLOG = 'paymentscorr';
- const TABLE_LOG = 'pt_log';
- const ROUTE_DELETE = 'deletept';
- const ROUTE_EDIT = 'editpt';
- const OPTION_MAXDAY = 'PT_MAXDAY';
- const OPTION_CHARGEON = 'PT_CHARGEONREG';
- const PROUTE_EDITOFFSET = 'newptdayoffset';
- const PROUTE_AGREE = 'newptdayoffsetagree';
- const ROUTE_BACK = '?module=pl_pt';
- // members
- protected array $altCfg = ;
- protected integer $currentDay = 0;
- protected integer $maxDay = 26;
- protected bool $chargeOnRegister = true;
- protected array $systemTariffs = ;
- protected array $allTariffs = ;
- protected array $allUsers = ;
- protected array $systemUsers = ;
- protected $tariffsDb = '';
- protected $usersDb = '';
- protected $stgDb = '';
- protected $journalDb = '';
- protected $feeDb = '';
- protected $messages = '';
- protected string $currentAdministrator = '';
- // methods
- public void __construct()
- protected void setCurrentDate()
- protected void setCurrentAdmin()
- protected void initMessages()
- protected void loadAlter()
- protected void setOptions()
- protected void loadSystemTariffs()
- protected void initPowerBase()
- protected void loadPowerUsers()
- protected void loadSystemUsers()
- protected void loadPowerTariffs()
- public string renderTariffsList()
- public string renderTariffCreateForm()
- public string renderTariffEditForm()
- public void/string createTariff()
- public void/string saveTariff()
- public void/string deleteTariff()
- public bool isPowerTariff()
- public float getPowerTariffPrice()
- public int getUserOffsetDay()
- public int getMaxDay()
- protected bool userHavePowerTariff()
- protected bool isUserActive()
- protected void logUser()
- public registerNewUsers()
- protected void chargeFee()
- protected void userBurial()
- protected void userResurrect()
- public string renderUserOffsetEditForm()
- public void saveUserOffsetDay()
- public string renderPowerUserLog()
- public void processingFee()
Constants
Name | Value |
---|---|
URL_ME | '?module=pt' |
TABLE_TARIFFS | 'pt_tariffs' |
TABLE_USERS | 'pt_users' |
TABLE_PAYLOG | 'paymentscorr' |
TABLE_LOG | 'pt_log' |
ROUTE_DELETE | 'deletept' |
ROUTE_EDIT | 'editpt' |
OPTION_MAXDAY | 'PT_MAXDAY' |
OPTION_CHARGEON | 'PT_CHARGEONREG' |
PROUTE_EDITOFFSET | 'newptdayoffset' |
PROUTE_AGREE | 'newptdayoffsetagree' |
ROUTE_BACK | '?module=pl_pt' |
Members
protected
- $allTariffs
—
array
Contains available power tariffs as tariffname=>recordData - $allUsers
—
array
Contains all existing power users as login=>day - $altCfg
—
array
System alter config as key=>value - $chargeOnRegister — bool
- $currentAdministrator
—
string
Contains current administrator login - $currentDay
—
int
Most essential property for this Porno Tariffs mechanics - $feeDb
—
Users fee charge database abstraction placeholder - $journalDb
—
Users day offset switching log database abstraction placeholder - $maxDay
—
int
Default maximum day of month which will be rounded to 1st. - $messages
—
System message helper object placeholder - $stgDb
—
All stargazer users abstraction layer placeholder - $systemTariffs
—
array
Contains names and prices of system tariffs as name=>fee - $systemUsers
—
array
Contains system users data as login=>userdata - $tariffsDb
—
Power tariffs database abstraction placeholder - $usersDb
—
Users affected by power tariffs database abstraction placeholder
Methods
protected
- chargeFee() — Charges fee from user account. Using this instead zb_CashAdd for avoid unnecessary logging.
- initMessages() — Inits system message helper
- initPowerBase() — Inits all required database abstraction layers into internal props
- isUserActive() — Checks is user active now?
- loadAlter() — Preloads system alter config into protected property for further usage
- loadPowerTariffs() — Loads available power tariffs from database into protected prop
- loadPowerUsers() — Loads all existing power users to protected property
- loadSystemTariffs() — Loads available system tariffs from database
- loadSystemUsers() — Loads all existing system users data to protected property
- logUser() — Logs user day offset switching into
- setCurrentAdmin() — Sets administrator login for current PT instance once
- setCurrentDate() — Sets current day into protected prop
- setOptions() — Sets some custom PowerTariffs options
- userBurial() — Performs user burial on cash exceed
- userHavePowerTariff() — Check is user using one of power tariffs?
- userResurrect() — Performs user resurrection on restoring cash
public
- __construct() — Creates new PT instance
- createTariff() — Creates new power tariff in database
- deleteTariff() — Deletes some existing power tariff from database
- getMaxDay() — Returns object maxDay value set by configuration
- getPowerTariffPrice() — Returns existing power tariff price
- getUserOffsetDay() — Returns user personal day offset
- isPowerTariff() — Checks is some tariff really have the power?
- processingFee() — Performs fee processing for users affected by power tariffs
- registerNewUsers() — Runs for detecting of newly registered users or users which need to be power-users
- renderPowerUserLog() — Renders powertariffs internal log data for some user
- renderTariffCreateForm() — Returns new power tariff creation form
- renderTariffEditForm() — Returns existing power tariff editing form
- renderTariffsList() — Renders available power tariffs list with some controls
- renderUserOffsetEditForm() — Renders user day offset modification form
- saveTariff() — Saves existing power tariff in database
- saveUserOffsetDay() — Saves new user offset day in database