\UbillingVisor
Surveillance accounting and management implementation
Synopsis
class UbillingVisor
{
- // constants
- const URL_ME = '?module=visor';
- const URL_USERS = '&users=true';
- const URL_CAMS = '&cams=true';
- const URL_USERCAMS = '&ajaxusercams=';
- const URL_ALLCAMS = '&ajaxallcams=true';
- const URL_DVRS = '&dvrs=true';
- const URL_CHANS = '&channels=true';
- const URL_HEALTH = '&health=true';
- const URL_CHANEDIT = '&editchannel=';
- const URL_AJUSERS = '&ajaxusers=true';
- const URL_DELUSER = '&deleteuserid=';
- const URL_DELDVR = '&deletedvrid=';
- const URL_USERVIEW = '&showuser=';
- const URL_CAMPROFILE = '?module=userprofile&username=';
- const URL_CAMVIEW = '&showcamera=';
- const URL_TARCHANGE = '&tariffchanges=true';
- const TABLE_USERS = 'visor_users';
- const TABLE_CAMS = 'visor_cams';
- const TABLE_DVRS = 'visor_dvrs';
- const TABLE_CHANS = 'visor_chans';
- const TABLE_SECRETS = 'visor_secrets';
- const PATH_MODELS = 'content/documents/visormodels/';
- // members
- protected array $altCfg = ;
- protected array $allUserData = ;
- protected array $allTariffPrices = ;
- protected array $allUsers = ;
- protected array $allCams = ;
- protected array $allDvrs = ;
- protected array $allPaymentIDs = ;
- protected array $dvrTypes = ;
- protected integer $chargeMode = 1;
- protected bool $trassirEnabled = false;
- protected bool $wolfRecorderEnabled = false;
- protected $messages = '';
- protected array $allChannels = ;
- protected array $channelUsers = ;
- protected array $allSecrets = ;
- protected $chans = '';
- protected $secrets = '';
- protected array $recordModes = ;
- protected string $chanPreviewSize = '30%';
- protected integer $chanPreviewQuality = 1;
- protected integer $chanPreviewFramerate = 1000;
- protected integer $chanBigPreviewQuality = 95;
- protected integer $chanBigPreviewFramerate = 1000;
- protected string $chanPreviewContainer = 'mjpeg';
- protected bool $trassirDebug = false;
- protected array $protectedUserIds = ;
- protected $usersDb = '';
- protected $camsDb = '';
- protected $dvrsDb = '';
- protected $chansDb = '';
- protected $secretsDb = '';
- protected bool $cachedUsersFlag = false;
- // methods
- public void __construct()
- protected void initDbLayers()
- protected void loadConfigs()
- protected void loadDvrTypes()
- protected void loadRecordModes()
- protected void initMessages()
- protected void loadUserData()
- protected void loadTariffPricing()
- protected void loadChans()
- protected void loadSecrets()
- protected void loadPaymentIds()
- protected void loadUsers()
- protected void loadCams()
- protected void loadDvrs()
- public string panel()
- public string renderUsers()
- public void ajaxUsersList()
- public string renderUserCreateForm()
- public int createUser()
- protected array getUserCameras()
- protected int/void getCameraIdByLogin()
- protected bool isPrimaryAccountFree()
- public int/void getCameraUser()
- public int/void getPrimaryAccountUserId()
- protected int getUserCamerasCount()
- public void/string deleteUser()
- protected string renderUserPrimaryAccount()
- protected array createUserSecret()
- protected string renderUserSecrets()
- public string renderUserProfile()
- protected string renderUnassignedChannels()
- protected bool isChansProtected()
- protected string renderUserAssignedChannels()
- protected float getUserCamerasPricing()
- protected string renderUserControls()
- protected string renderUserPrimaryEditForm()
- protected void setPrimaryAccount()
- public void savePrimary()
- protected string renderUserDeletionForm()
- public string renderCamerasContainer()
- public void ajaxUserCams()
- public string iconVisorUser()
- public void ajaxAllCams()
- public string renderCameraCreateInterface()
- public void createCamera()
- public void assignChannel()
- public void unassignChannel()
- protected string renderUserEditInterface()
- public void saveUser()
- protected string renderCameraDeletionForm()
- public void/string deleteCamera()
- public string renderCameraForm()
- protected array getPopularCameraModels()
- protected string renderTrassirCameraMismatchForm()
- protected string renderTrassirCameraCreateForm()
- protected string renderWolfRecorderCameraCreateForm()
- protected string renderTrassirCameraControls()
- protected string renderWolfRecorderCameraControls()
- public void saveCamera()
- protected string renderDVRsCreateForm()
- public void createDVR()
- protected string renderDVREditForm()
- public void saveDVR()
- protected int getDvrCameraCount()
- public string renderTariffChangesReport()
- protected string getWolfRecorderApiUrl()
- public string renderDVRsHealth()
- public string renderDVRsList()
- protected bool isDVRProtected()
- public void/string deleteDVR()
- public string renderChannelsPreview()
- protected string renderChannelRecordForm()
- public void saveChannelRecordMode()
- protected string renderChannelPlayer()
- public string renderChannelEditForm()
- public void saveChannelAssign()
- public string regenerateDvrChannelAcl()
- public string getUserChannelsPreviewJson()
- public string getUserDvrAuthData()
- public string getDvrLabel()
- public string getDvrName()
- public void chargeProcessing()
Constants
Name | Value |
---|---|
URL_ME | '?module=visor' |
URL_USERS | '&users=true' |
URL_CAMS | '&cams=true' |
URL_USERCAMS | '&ajaxusercams=' |
URL_ALLCAMS | '&ajaxallcams=true' |
URL_DVRS | '&dvrs=true' |
URL_CHANS | '&channels=true' |
URL_HEALTH | '&health=true' |
URL_CHANEDIT | '&editchannel=' |
URL_AJUSERS | '&ajaxusers=true' |
URL_DELUSER | '&deleteuserid=' |
URL_DELDVR | '&deletedvrid=' |
URL_USERVIEW | '&showuser=' |
URL_CAMPROFILE | '?module=userprofile&username=' |
URL_CAMVIEW | '&showcamera=' |
URL_TARCHANGE | '&tariffchanges=true' |
TABLE_USERS | 'visor_users' |
TABLE_CAMS | 'visor_cams' |
TABLE_DVRS | 'visor_dvrs' |
TABLE_CHANS | 'visor_chans' |
TABLE_SECRETS | 'visor_secrets' |
PATH_MODELS | 'content/documents/visormodels/' |
Members
protected
- $allCams
—
array
Contains all visor cameras data as id=>data - $allChannels
—
array
Contains preloaded channels to visor user bindings as visorId=>data - $allDvrs
—
array
Contains all visor dvrs data as id=>data - $allPaymentIDs
—
array
Contains all available users payment IDs - $allSecrets
—
array
Contains available secrets bindings with auth data as visorId=>secretsData - $allTariffPrices
—
array
Contains all available tariffs fees as tariff=>fee - $allUserData
—
array
Contains all stargazer user data as login=>data - $allUsers
—
array
Contains all visor users data as id=>data - $altCfg
—
array
Contains system alter.ini config as key=>value - $cachedUsersFlag
—
bool
Use or not cached users data? - $camsDb
—
Cameras database abstraction layer - $chanBigPreviewFramerate
—
int
Large preview framerate - $chanBigPreviewQuality
—
int
Quality percent of large channel preview - $chanPreviewContainer
—
string
Global Trassir NVR stream preview container type. Now supported: mjpeg or hls. - $chanPreviewFramerate
—
int
Channels preview - $chanPreviewQuality
—
int
Quality percent for channels small preview - $chanPreviewSize
—
string
Default channel preview size - $channelUsers
—
array
Contains channel to users bindings as channelGuid=>visorId - $chans
—
Channels binginds database model - $chansDb
—
Channels database abstraction layer - $chargeMode
—
int
Visor charge mode from VISOR_CHARGE_MODE config option. - $dvrTypes
—
array
Contains available DVR handler types - $dvrsDb
—
DVRs database abstraction layer - $messages
—
System messages helper object placeholder - $protectedUserIds
—
array
Contains array of users with protected from unprivileged staff - $recordModes
—
array
Available channel record modes - $secrets
—
NVR secrets data model placeholder - $secretsDb
—
Secrets database abstraction layer - $trassirDebug
—
bool
TrassirServer debug flag - $trassirEnabled
—
bool
Trassir Server integration flag - $usersDb
—
Users database abstraction layer - $wolfRecorderEnabled
—
bool
WolfRecorder integration flag
Methods
protected
- createUserSecret()
- getCameraIdByLogin() — Returns camera ID if login have camera associated
- getDvrCameraCount() — Returns count of cameras (channels) registered on some existing DVR
- getPopularCameraModels() — Returns popular and most frequently used camera models for some protocol/vendor
- getUserCameras() — Returns array of cameras associated to some user
- getUserCamerasCount() — Returns count of associated user cameras
- getUserCamerasPricing() — Returns user assigned cameras fee
- getWolfRecorderApiUrl() — Returns usable WolfRecorder API URL depends on existing DVR settings
- initDbLayers() — Inits all required database abstraction layers
- initMessages() — Inits system message helper for further usage
- isChansProtected() — Checks is channel operations protected for unpriviliged users?
- isDVRProtected() — Checks is DVR used by some existing cameras
- isPrimaryAccountFree() — Checks is some account already someones primary or not
- loadCams() — Loads all visor cameras data into protected property
- loadChans() — Loads available channels bindings from database
- loadConfigs() — Loads reqired configs
- loadDvrTypes() — Sets available DVR types
- loadDvrs() — Loads all visor DVR data into protected property
- loadPaymentIds() — Loads available payment IDs from database
- loadRecordModes() — Sets default available channel record modes
- loadSecrets() — Loads available secrets bindings from database
- loadTariffPricing() — Loads tariffs pricing data from database into protected prop
- loadUserData() — Loads all existing users data from database
- loadUsers() — Loads all visor users data into protected property
- renderCameraDeletionForm() — Returns existing camera deletion form
- renderChannelPlayer() — Returns channel preview container/player based on stream type
- renderChannelRecordForm() — Renders channel record mode editing form
- renderDVREditForm() — Renders DVR editing form
- renderDVRsCreateForm() — Renders DVR creation form
- renderTrassirCameraControls() — Renders IP device controls if camera is served by trassir based DVR
- renderTrassirCameraCreateForm() — Rders camera DVR registering form if its not registered yet
- renderTrassirCameraMismatchForm() — Returns camera "model mismatch" warning editing form. Also catches change requests.
- renderUnassignedChannels() — Renders channels available on all of DVRs that can be assigned to this user
- renderUserAssignedChannels() — Renders list of user assigned channels with their preview and optional assign form
- renderUserControls() — Renders Visor user defaults controls set
- renderUserDeletionForm() — user deletion form
- renderUserEditInterface() — Renders users editing interface
- renderUserPrimaryAccount() — Returns user primary camera controls if primary available
- renderUserPrimaryEditForm() — Renders user primary account editing interface
- renderUserSecrets() — Renders visor user global NVR secrets data
- renderWolfRecorderCameraControls() — Renders IP device controls if camera is served by WolfRecorder NVR
- renderWolfRecorderCameraCreateForm() — Renders camera DVR registering form if its not registered yet
- setPrimaryAccount() — Sets some account as primary for some user
public
- __construct()
- ajaxAllCams() — Renders ajax json backend for all available cameras
- ajaxUserCams() — Renders ajax json backend for some user assigned cameras
- ajaxUsersList() — Renders users datatables data
- assignChannel() — Creates channel to user binding in database
- chargeProcessing() — Performs default fee charge processing to prevent cameras offline
- createCamera() — Creates new camera account and assigns it to existing user
- createDVR() — Catches new DVR creation request/performs new DVR registering
- createUser() — Creates new user in database
- deleteCamera() — Deletes existing camera from database
- deleteDVR() — Deletes existing DVR from database
- deleteUser() — Deletes user from database
- getCameraUser() — Returns camera user assigned visor user ID if exists
- getDvrLabel() — Returns existing DVR name and IP
- getDvrName() — Returns existing DVR name
- getPrimaryAccountUserId() — Returns userId by its associated primary account
- getUserChannelsPreviewJson() — Returns JSON list of channel preview URLs of channels assigned for user
- getUserDvrAuthData() — Returns some DVRs authorization data if user have some channels assigned on managable DVRs
- iconVisorUser() — Returns default user icon coode
- panel() — Renders default controls panel
- regenerateDvrChannelAcl() — Regenerates all ACL for some visor user on Some DVR
- renderCameraCreateInterface() — Renders initial camera creation interface
- renderCameraForm() — Renders camera profile with editing forms
- renderCamerasContainer() — Renders default cameras view container
- renderChannelEditForm() — Renders channel editing form
- renderChannelsPreview() — Renders preview of channels from all Trassir based DVRs
- renderDVRsHealth() — Renders available DVRs health report
- renderDVRsList() — Renders existing DVRs list wit some controls
- renderTariffChangesReport() — Renders tariffs changes report based on DDT log
- renderUserCreateForm() — Renders visor user creation form
- renderUserProfile() — Renders visor users profile with associated cameras and some controls
- renderUsers() — Renders available users list container
- saveCamera() — Catches camera editing request and saves data if required
- saveChannelAssign() — Catches channel to user assign request and do required actions (update/delete)
- saveChannelRecordMode() — Changes some channel record mode
- saveDVR() — Catches DVR modification request and saves new data to database if it was changed
- savePrimary() — Catches primary editing request and saves changes if required
- saveUser() — Catches and saves user editing request if required
- unassignChannel() — Deletes channel to user binding in database