BxAclConfig.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. );
  36. $this->_aGridObjects = array(
  37. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  38. 'view' => $this->CNF['OBJECT_GRID_VIEW'],
  39. );
  40. $this->_aPrefixes = array(
  41. 'style' => 'bx-acl',
  42. 'option' => 'bx_acl_',
  43. );
  44. $this->_aJsClasses = array(
  45. 'main' => 'BxAclMain',
  46. 'administration' => 'BxAclAdministration',
  47. );
  48. $this->_aJsObjects = array(
  49. 'main' => 'oAclMain',
  50. 'administration' => 'oAclAdministration',
  51. );
  52. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  53. $this->_aHtmlIds = array(
  54. 'popup_price' => $sHtmlPrefix . '-popup-price'
  55. );
  56. $oPayments = BxDolPayments::getInstance();
  57. $this->_iOwner = (int)$oPayments->getOption('site_admin');
  58. $this->_aCurrency = array(
  59. 'code' => $oPayments->getOption('default_currency_code'),
  60. 'sign' => $oPayments->getOption('default_currency_sign')
  61. );
  62. $this->_bExpireNotifyOnce = true;
  63. $this->_iExpireNotificationDays = 1;
  64. $this->_iRemoveExpiredFor = 30;
  65. }
  66. public function init(&$oDb)
  67. {
  68. $this->_oDb = &$oDb;
  69. $sOptionPrefix = $this->getPrefix('option');
  70. $this->_iExpireNotificationDays = (int)getParam($sOptionPrefix . 'expire_notification_days');
  71. $this->_bExpireNotifyOnce = getParam($sOptionPrefix . 'expire_notify_once') == 'on';
  72. $this->_iRemoveExpiredFor = (int)getParam($sOptionPrefix . 'remove_expired_for');
  73. }
  74. public function getExpireNotificationDays()
  75. {
  76. return $this->_iExpireNotificationDays;
  77. }
  78. public function isExpireNotifyOnce()
  79. {
  80. return $this->_bExpireNotifyOnce;
  81. }
  82. public function getRemoveExpiredFor()
  83. {
  84. return $this->_iRemoveExpiredFor;
  85. }
  86. public function getHtmlIds($sKey = '')
  87. {
  88. if(empty($sKey))
  89. return $this->_aHtmlIds;
  90. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  91. }
  92. public function getOwner()
  93. {
  94. return $this->_iOwner;
  95. }
  96. public function getCurrency()
  97. {
  98. return $this->_aCurrency;
  99. }
  100. }
  101. /** @} */