BxBaseModNotificationsConfig.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup BaseNotifications Base classes for Notifications like modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolModuleConfig');
  12. class BxBaseModNotificationsConfig extends BxDolModuleConfig
  13. {
  14. protected $_oDb;
  15. protected $_aSystemNames;
  16. protected $_aPrefixes;
  17. protected $_aObjects;
  18. protected $_aHandlerDescriptor;
  19. protected $_sHandlersMethod;
  20. protected $_aHandlers;
  21. protected $_aHandlersHidden;
  22. protected $_aJsClass;
  23. protected $_aJsObjects;
  24. protected $_aPerPage;
  25. protected $_aHtmlIds;
  26. protected $_sAnimationEffect;
  27. protected $_iAnimationSpeed;
  28. protected $_iPrivacyViewDefault;
  29. function __construct($aModule)
  30. {
  31. parent::__construct($aModule);
  32. $this->_aSystemNames = array(
  33. 'alert' => $this->_sName
  34. );
  35. $this->_aPrefixes = array();
  36. $this->_aObjects = array(
  37. 'conn_subscriptions' => 'sys_profiles_subscriptions'
  38. );
  39. $this->_aHandlerDescriptor = array();
  40. $this->_sHandlersMethod = '';
  41. $this->_aHandlersHidden = array();
  42. $this->_aHandlers = array();
  43. $this->_aJsClass = array();
  44. $this->_aJsObjects = array();
  45. $this->_aPerPage = array();
  46. $this->_aHtmlIds = array();
  47. $this->_sAnimationEffect = 'fade';
  48. $this->_iAnimationSpeed = 'slow';
  49. $this->_iPrivacyViewDefault = BX_DOL_PG_ALL;
  50. }
  51. public function init(&$oDb)
  52. {
  53. $this->_oDb = &$oDb;
  54. $sOptionPrefix = $this->getPrefix('option');
  55. $aHandlers = $this->_oDb->getHandlers();
  56. foreach($aHandlers as $aHandler) {
  57. if($aHandler['type'] === BX_BASE_MOD_NTFS_HANDLER_TYPE_INSERT && !empty($aHandler['content'])) {
  58. $aContent = unserialize($aHandler['content']);
  59. if(is_array($aContent) && !empty($aContent))
  60. $aHandler = array_merge($aHandler, $aContent);
  61. }
  62. $this->_aHandlers[$aHandler['alert_unit'] . (!empty($aHandler['alert_action']) ? '_' . $aHandler['alert_action'] :'')] = $aHandler;
  63. }
  64. $sHideTimeline = getParam($sOptionPrefix . 'events_hide');
  65. if(!empty($sHideTimeline))
  66. $this->_aHandlersHidden = explode(',', $sHideTimeline);
  67. }
  68. public function getSystemName($sType = '')
  69. {
  70. if(empty($sType))
  71. return $this->_aSystemNames;
  72. return $this->_aSystemNames[$sType];
  73. }
  74. public function getPrefix($sType = '')
  75. {
  76. if(empty($sType))
  77. return $this->_aPrefixes;
  78. return $this->_aPrefixes[$sType];
  79. }
  80. public function getObject($sType = '')
  81. {
  82. if(empty($sType))
  83. return $this->_aObjects;
  84. return $this->_aObjects[$sType];
  85. }
  86. public function getHandlerDescriptor()
  87. {
  88. return $this->_aHandlerDescriptor;
  89. }
  90. public function getHandlersMethod()
  91. {
  92. return $this->_sHandlersMethod;
  93. }
  94. public function isHandler($sKey = '')
  95. {
  96. return isset($this->_aHandlers[$sKey]);
  97. }
  98. public function getHandlers($sKey = '')
  99. {
  100. if($sKey == '')
  101. return $this->_aHandlers;
  102. return $this->_aHandlers[$sKey];
  103. }
  104. public function getHandlersHidden()
  105. {
  106. return $this->_aHandlersHidden;
  107. }
  108. public function getJsClass($sType)
  109. {
  110. return $this->_aJsClass[$sType];
  111. }
  112. public function getJsObject($sType)
  113. {
  114. return $this->_aJsObjects[$sType];
  115. }
  116. public function getPerPage($sType = 'default')
  117. {
  118. if(empty($sType))
  119. return $this->_aPerPage;
  120. return $this->_aPerPage[$sType];
  121. }
  122. public function getHtmlIds($sType, $sKey = '')
  123. {
  124. if(empty($sKey))
  125. return $this->_aHtmlIds[$sType];
  126. return $this->_aHtmlIds[$sType][$sKey];
  127. }
  128. public function getAnimationEffect()
  129. {
  130. return $this->_sAnimationEffect;
  131. }
  132. public function getAnimationSpeed()
  133. {
  134. return $this->_iAnimationSpeed;
  135. }
  136. public function getPrivacyViewDefault()
  137. {
  138. return $this->_iPrivacyViewDefault;
  139. }
  140. }
  141. /** @} */