BxAclConfig.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 PaidLevels Paid Levels
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAclConfig extends BxBaseModGeneralConfig
  12. {
  13. protected $_oDb;
  14. protected $_aHtmlIds;
  15. protected $_aCurrency;
  16. protected $_iOwner;
  17. protected $_iExpireNotificationDays;
  18. protected $_bExpireNotifyOnce;
  19. protected $_iRemoveExpiredFor;
  20. /**
  21. * Constructor
  22. */
  23. public function __construct($aModule)
  24. {
  25. parent::__construct($aModule);
  26. $this->CNF = array (
  27. 'TABLE_PRICES' => $aModule['db_prefix'] . 'level_prices',
  28. 'URL_ADMINISTRATION' => 'page.php?i=acl-administration',
  29. 'URL_VIEW' => 'page.php?i=acl-view',
  30. 'OBJECT_GRID_ADMINISTRATION' => 'bx_acl_administration',
  31. 'OBJECT_GRID_VIEW' => 'bx_acl_view',
  32. 'OBJECT_FORM_PRICE' => 'bx_acl_price',
  33. 'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_acl_price_add',
  34. 'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_acl_price_edit',
  35. 'OBJECT_FORM_PRELISTS_PERIOD_UNITS' => 'bx_acl_period_units',
  36. );
  37. $this->_aGridObjects = array(
  38. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  39. 'view' => $this->CNF['OBJECT_GRID_VIEW'],
  40. );
  41. $this->_aPrefixes = array(
  42. 'style' => 'bx-acl',
  43. 'option' => 'bx_acl_',
  44. );
  45. $this->_aJsClasses = array(
  46. 'main' => 'BxAclMain',
  47. 'administration' => 'BxAclAdministration',
  48. );
  49. $this->_aJsObjects = array(
  50. 'main' => 'oAclMain',
  51. 'administration' => 'oAclAdministration',
  52. );
  53. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  54. $this->_aHtmlIds = array(
  55. 'popup_price' => $sHtmlPrefix . '-popup-price'
  56. );
  57. $oPayments = BxDolPayments::getInstance();
  58. $this->_iOwner = (int)$oPayments->getOption('site_admin');
  59. $this->_aCurrency = array(
  60. 'code' => $oPayments->getOption('default_currency_code'),
  61. 'sign' => $oPayments->getOption('default_currency_sign')
  62. );
  63. $this->_bExpireNotifyOnce = true;
  64. $this->_iExpireNotificationDays = 1;
  65. $this->_iRemoveExpiredFor = 30;
  66. }
  67. public function init(&$oDb)
  68. {
  69. $this->_oDb = &$oDb;
  70. $sOptionPrefix = $this->getPrefix('option');
  71. $this->_iExpireNotificationDays = (int)getParam($sOptionPrefix . 'expire_notification_days');
  72. $this->_bExpireNotifyOnce = getParam($sOptionPrefix . 'expire_notify_once') == 'on';
  73. $this->_iRemoveExpiredFor = (int)getParam($sOptionPrefix . 'remove_expired_for');
  74. }
  75. public function getExpireNotificationDays()
  76. {
  77. return $this->_iExpireNotificationDays;
  78. }
  79. public function isExpireNotifyOnce()
  80. {
  81. return $this->_bExpireNotifyOnce;
  82. }
  83. public function getRemoveExpiredFor()
  84. {
  85. return $this->_iRemoveExpiredFor;
  86. }
  87. public function getHtmlIds($sKey = '')
  88. {
  89. if(empty($sKey))
  90. return $this->_aHtmlIds;
  91. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  92. }
  93. public function getOwner()
  94. {
  95. return $this->_iOwner;
  96. }
  97. public function getCurrency()
  98. {
  99. return $this->_aCurrency;
  100. }
  101. }
  102. /** @} */