| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup BaseNotifications Base classes for Notifications like modules
- * @ingroup UnaModules
- *
- * @{
- */
- class BxBaseModNotificationsConfig extends BxBaseModGeneralConfig
- {
- protected $_oDb;
- protected $_aObjects;
- protected $_aHandlerDescriptor;
- protected $_sHandlersMethod;
- protected $_aHandlers;
- protected $_aHandlersHidden;
- protected $_aPerPage;
- protected $_aHtmlIds;
-
- protected $_sAnimationEffect;
- protected $_iAnimationSpeed;
- protected $_aPrivacyViewDefault;
- function __construct($aModule)
- {
- parent::__construct($aModule);
- $this->_aPrefixes = array();
- $this->_aObjects = array(
- 'alert' => $this->_sName,
- 'privacy_view' => $this->_sName . '_privacy_view',
- 'conn_subscriptions' => 'sys_profiles_subscriptions'
- );
- $this->_aHandlerDescriptor = array();
- $this->_sHandlersMethod = '';
- $this->_aHandlersHidden = array();
- $this->_aHandlers = array();
- $this->_aJsClasses = array();
- $this->_aJsObjects = array();
- $this->_aPerPage = array();
- $this->_aHtmlIds = array();
- $this->_sAnimationEffect = 'fade';
- $this->_iAnimationSpeed = 'slow';
- $this->_aPrivacyViewDefault = array(
- 'object' => BX_DOL_PG_ALL,
- 'event' => BX_DOL_PG_ALL
- );
- }
- public function init(&$oDb)
- {
- $this->_oDb = &$oDb;
- $sOptionPrefix = $this->getPrefix('option');
- $aHandlers = $this->_oDb->getHandlers();
- foreach($aHandlers as $aHandler) {
- if($aHandler['type'] === BX_BASE_MOD_NTFS_HANDLER_TYPE_INSERT && !empty($aHandler['content'])) {
- $aContent = unserialize($aHandler['content']);
- if(is_array($aContent) && !empty($aContent))
- $aHandler = array_merge($aHandler, $aContent);
- }
- $this->_aHandlers[$aHandler['alert_unit'] . (!empty($aHandler['alert_action']) ? '_' . $aHandler['alert_action'] :'')] = $aHandler;
- }
- $sHideTimeline = getParam($sOptionPrefix . 'events_hide');
- if(!empty($sHideTimeline))
- $this->_aHandlersHidden = explode(',', $sHideTimeline);
- }
- public function getHandlerDescriptor()
- {
- return $this->_aHandlerDescriptor;
- }
- public function getHandlersMethod()
- {
- return $this->_sHandlersMethod;
- }
- public function isHandler($sKey = '')
- {
- return isset($this->_aHandlers[$sKey]);
- }
- public function getHandlers($sKey = '')
- {
- if($sKey == '')
- return $this->_aHandlers;
- return isset($this->_aHandlers[$sKey]) ? $this->_aHandlers[$sKey] : '';
- }
- public function getHandlersHidden()
- {
- return $this->_aHandlersHidden;
- }
- public function getPrivacyObject($sKey = '')
- {
- if(!$this->isHandler($sKey))
- return false;
- $aHandler = $this->getHandlers($sKey);
- if(empty($aHandler) || !is_array($aHandler) || empty($aHandler['privacy']))
- return false;
- return BxDolPrivacy::getObjectInstance($aHandler['privacy']);
- }
- public function getPerPage($sType = 'default')
- {
- if(empty($sType))
- return $this->_aPerPage;
- return isset($this->_aPerPage[$sType]) ? $this->_aPerPage[$sType] : '';
- }
- public function getHtmlIds($sType, $sKey = '')
- {
- if(empty($sKey))
- return isset($this->_aHtmlIds[$sType]) ? $this->_aHtmlIds[$sType] : array();
- return isset($this->_aHtmlIds[$sType][$sKey]) ? $this->_aHtmlIds[$sType][$sKey] : '';
- }
- public function getAnimationEffect()
- {
- return $this->_sAnimationEffect;
- }
- public function getAnimationSpeed()
- {
- return $this->_iAnimationSpeed;
- }
- public function getPrivacyViewDefault($sType)
- {
- return isset($this->_aPrivacyViewDefault[$sType]) ? $this->_aPrivacyViewDefault[$sType] : BX_DOL_PG_ALL;
- }
- }
- /** @} */
|