BxNtfsConfig.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Notifications Notifications
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolPrivacy');
  12. class BxNtfsConfig extends BxBaseModNotificationsConfig
  13. {
  14. protected $_iPushMaxLen;
  15. protected $_aHandlersHiddenEmail;
  16. protected $_aHandlersHiddenPush;
  17. /**
  18. * Constructor
  19. */
  20. public function __construct($aModule)
  21. {
  22. parent::__construct($aModule);
  23. $this->CNF = array (
  24. 'URL_HOME' => 'page.php?i=notifications-view',
  25. 'OBJECT_MENU_SUBMENU' => 'bx_notifications_submenu', // main module submenu
  26. );
  27. $this->_aPrefixes = array(
  28. 'style' => 'bx-ntfs',
  29. 'language' => '_bx_ntfs',
  30. 'option' => 'bx_notifications_'
  31. );
  32. $this->_iPushMaxLen = 190;
  33. $this->_aHandlerDescriptor = array('module_name' => '', 'module_method' => '', 'module_class' => '');
  34. $this->_sHandlersMethod = 'get_notifications_data';
  35. $this->_aHandlersHiddenEmail = array();
  36. $this->_aHandlersHiddenPush = array();
  37. $this->_aJsClasses = array(
  38. 'main' => 'BxNtfsMain',
  39. 'view' => 'BxNtfsView',
  40. );
  41. $this->_aJsObjects = array(
  42. 'main' => 'oBxNtfsMain',
  43. 'view' => 'oBxNtfsView',
  44. );
  45. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  46. $this->_aHtmlIds = array(
  47. 'view' => array(
  48. 'block' => $sHtmlPrefix,
  49. 'events' => $sHtmlPrefix . '-events',
  50. 'event' => $sHtmlPrefix . '-event-'
  51. )
  52. );
  53. }
  54. public function init(&$oDb)
  55. {
  56. parent::init($oDb);
  57. $sOptionPrefix = $this->getPrefix('option');
  58. $this->_aPerPage = array(
  59. 'default' => (int)getParam($sOptionPrefix . 'events_per_page')
  60. );
  61. $aSettings = array(
  62. 'site' => '',
  63. 'email' => 'Email',
  64. 'push' => 'Push'
  65. );
  66. foreach($aSettings as $sSetting => $sVariable) {
  67. $sHideTimeline = getParam($sOptionPrefix . 'events_hide_' . $sSetting);
  68. if(!empty($sHideTimeline))
  69. $this->{'_aHandlersHidden' . $sVariable} = explode(',', $sHideTimeline);
  70. }
  71. }
  72. public function getPushMaxLen()
  73. {
  74. return $this->_iPushMaxLen;
  75. }
  76. public function getHandlersHidden($sType = '')
  77. {
  78. if(!in_array($sType, array('', 'email', 'push')))
  79. return array();
  80. return $this->{'_aHandlersHidden' . ucfirst($sType)};
  81. }
  82. /**
  83. * Ancillary functions
  84. */
  85. public function getViewUrl()
  86. {
  87. return BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=notifications-view');
  88. }
  89. }
  90. /** @} */