\TrinityTv
TrinityTV OTT service implementation
Synopsis
class TrinityTv
{
- // constants
- const URL_TARIFFS = 'tariffs=true';
- const URL_ME = '?module=trinitytv';
- const URL_PROFILE = '?module=userprofile&username=';
- const URL_SUBSCRIBER = '?module=trinitytv&subscriberid=';
- const URL_SUBS = 'subscriptions=true';
- const URL_AJSUBS = 'ajsubs=true';
- const URL_AJDEVS = 'ajdevices=true';
- const URL_SUBVIEW = 'subview=true';
- const URL_REPORTS = 'reports=true';
- const URL_DEVICES = 'devices=true';
- const TABLE_SUBS = 'trinitytv_subscribers';
- const TABLE_TARIFFS = 'trinitytv_tariffs';
- const TABLE_DEVICES = 'trinitytv_devices';
- const TABLE_SUSPENDS = 'trinitytv_suspend';
- // members
- protected string $api = '';
- protected array $allTariffs = ;
- protected array $allSubscribers = ;
- protected array $allUsers = ;
- protected $messages = '';
- protected integer $chanIconSize = 32;
- protected array $suspended = ;
- protected integer $renderDevices = 0;
- protected array $altCfg = ;
- // methods
- public void __construct()
- protected void loadConfigs()
- protected string getTariffName()
- private array getDevices()
- private array getSubscriberDevices()
- private bool getDeviceId()
- public int getSubscriberId()
- public string getSubscriberLogin()
- protected array getTariffData()
- protected string renderVendorLookup()
- public string renderDevices()
- public string renderTariffs()
- public string renderTariffCreateForm()
- protected string tariffEditForm()
- public void/string updateTariff()
- public void/string createTariff()
- protected bool tariffProtected()
- public void/string deleteTariff()
- protected void initApi()
- protected void initMessages()
- protected void loadTariffs()
- protected void loadSuspended()
- protected void loadSubscribers()
- protected void loadUsers()
- protected string renderManualTariffForm()
- public void changeTariffs()
- protected string renderDeviceAddForm()
- protected string renderDeviceByCodeAddForm()
- public bool existsDevice()
- public string addDeviceByCode()
- public string addDevice()
- protected string renderProfileControls()
- public void setSubscriberActive()
- protected void suspendUser()
- public string renderUserInfo()
- public string renderPanel()
- protected string renderUserRegisterForm()
- protected string renderTariffEditForm()
- public string renderTariffsList()
- public void deleteDevice()
- public void deleteDeviceById()
- public void/string deleteDeviceByIdProtected()
- public string deleteSubscribtion()
- public string createSubscribtion()
- protected float getDaylyFee()
- protected void chargeFee()
- public string renderSubscribtionsReportMonthly()
- public string renderSubscribtions()
- protected array getUserDevicesCount()
- public void subscribtionsListAjax()
- public string renderDevicesList()
- public void devicesListAjax()
- public void subscriptionFeeProcessing()
- public void resurrectAllSubscribers()
Constants
Name | Value |
---|---|
URL_TARIFFS | 'tariffs=true' |
URL_ME | '?module=trinitytv' |
URL_PROFILE | '?module=userprofile&username=' |
URL_SUBSCRIBER | '?module=trinitytv&subscriberid=' |
URL_SUBS | 'subscriptions=true' |
URL_AJSUBS | 'ajsubs=true' |
URL_AJDEVS | 'ajdevices=true' |
URL_SUBVIEW | 'subview=true' |
URL_REPORTS | 'reports=true' |
URL_DEVICES | 'devices=true' |
TABLE_SUBS | 'trinitytv_subscribers' |
TABLE_TARIFFS | 'trinitytv_tariffs' |
TABLE_DEVICES | 'trinitytv_devices' |
TABLE_SUSPENDS | 'trinitytv_suspend' |
Members
protected
- $allSubscribers
—
array
Contains available and active trinity service subscriptions as id=>data - $allTariffs
—
array
Contains all of available trinity tariffs as id=>data - $allUsers
—
array
Contains all of internet users data as login=>data - $altCfg
—
array
Contains system alter config as key=>value - $api
—
string
TrinityTV API object - $chanIconSize
—
int
Contains default channel icon size - $messages
—
System message helper object placeholder - $renderDevices
—
int
Devices count rendering flag in subscribers list. - $suspended
—
array
Contains array of currently suspended users without base tariff
Methods
private
- getDeviceId() — Get device id
- getDevices() — Get all devices
- getSubscriberDevices() — Get subscriber devices
protected
- chargeFee() — Charges fee for some tariff
- getDaylyFee() — Returns valid dayly fee for some tariff/month
- getTariffData() — Returns tariff local data
- getTariffName() — Trys to render human-readable tariff name
- getUserDevicesCount() — Returns array of devices assigned for subscribers as subscriberId=>devcount
- initApi() — Inits API object for further usage
- initMessages() — Inits system message helper
- loadConfigs() — Loads required configs into protected props
- loadSubscribers() — Loads existing subscribers data
- loadSuspended() — Loads existing suspended users
- loadTariffs() — Loads existing tariffs from database
- loadUsers() — Loads internet users data into protected property for further usage
- renderDeviceAddForm() — Renders manual device assign form
- renderDeviceByCodeAddForm() — Renders manual device assign form
- renderManualTariffForm() — Renders form to manual tariff changing
- renderProfileControls() — Renders profile controls
- renderTariffEditForm() — Renders tariff editing form
- renderUserRegisterForm() — Renders new subscriber registration form
- renderVendorLookup() — Returns device vendor lookup concrols + ajax container. wf_AjaxLoader required.
- suspendUser() — Sets user as suspended or not to preventing his automatic ressurection
- tariffEditForm() — Returns tariff editing form
- tariffProtected() — Checks is tariff used by some users
public
- __construct() — Creates new TriityTV instance
- addDevice() — Assigns some device uniq to some subscriber
- addDeviceByCode() — Assigns some device by code to some subscriber
- changeTariffs() — Performs editing of user tariffs
- createSubscribtion() — Creates new user profile
- createTariff() — Creates new tariff in database
- deleteDevice() — Deletes device assigned to some subscriberid
- deleteDeviceById() — Deletes device assigned to some subscriberid
- deleteDeviceByIdProtected() — Deletes some device by its ID if it assigned to specified login (for remoteapi callback)
- deleteSubscribtion() — Deletes subscription
- deleteTariff() — Deletes existing tariff from database
- devicesListAjax() — Returns JSON data with available devices info
- existsDevice() — Check exists device by MAC
- getSubscriberId() — Returns local subscriber ID from database
- getSubscriberLogin() — Returns local subscriber login by ID from database
- renderDevices() — Renders available tariffs list
- renderDevicesList() — Renders devices report container
- renderPanel() — Renders default module controls
- renderSubscribtions() — Returns data container for active subscriptions
- renderSubscribtionsReportMonthly() — Renders default subscriptions report
- renderTariffCreateForm() — Renders tariff creation form
- renderTariffs() — Renders available tariffs list
- renderTariffsList() — Renders list of available tariffs
- renderUserInfo() — Renders some user profile info
- resurrectAllSubscribers() — Resurrects some users if their was disabled by inactivity
- setSubscriberActive() — Sets user local and remote profile as active or not
- subscribtionsListAjax() — Renders ajax data subscriptions
- subscriptionFeeProcessing() — Charges all users tariffs fee, disables it when users go down
- updateTariff() — Catches tariff editing form data