BxBaseModGroupsConfig.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 Groups Groups
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolInformer');
  12. class BxBaseModGroupsConfig extends BxBaseModProfileConfig
  13. {
  14. protected $_aHtmlIds;
  15. protected $_bUseCoverAsThumb;
  16. protected $_aCurrency;
  17. function __construct($aModule)
  18. {
  19. parent::__construct($aModule);
  20. $this->_aMenuItems2MethodsActions = array (
  21. 'join-group-profile' => 'checkAllowedFanAdd',
  22. 'profile-fan-add' => 'checkAllowedFanAdd',
  23. 'profile-fan-remove' => 'checkAllowedFanRemove',
  24. 'profile-subscribe-add' => 'checkAllowedSubscribeAdd',
  25. 'profile-subscribe-remove' => 'checkAllowedSubscribeRemove',
  26. 'profile-actions-more' => 'checkAllowedViewMoreMenu',
  27. 'convos-compose' => 'checkAllowedCompose',
  28. );
  29. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  30. $this->_aHtmlIds = array(
  31. 'popup_price' => $sHtmlPrefix . '-popup-price'
  32. );
  33. $this->_bUseCoverAsThumb = $this->_initUseCoverAsThumb();
  34. $oPayments = BxDolPayments::getInstance();
  35. $this->_aCurrency = array(
  36. 'code' => $oPayments->getOption('default_currency_code'),
  37. 'sign' => $oPayments->getOption('default_currency_sign')
  38. );
  39. }
  40. public function getHtmlIds($sKey = '')
  41. {
  42. if(empty($sKey))
  43. return $this->_aHtmlIds;
  44. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  45. }
  46. public function getCurrency()
  47. {
  48. return $this->_aCurrency;
  49. }
  50. public function isFans()
  51. {
  52. return true;
  53. }
  54. public function isAdmins()
  55. {
  56. return $this->isFans() && !empty($this->CNF['TABLE_ADMINS']);
  57. }
  58. public function isPaidJoin()
  59. {
  60. return isset($this->CNF['PARAM_PAID_JOIN_ENABLED']) && $this->CNF['PARAM_PAID_JOIN_ENABLED'] === true;
  61. }
  62. public function isInternalNotifications()
  63. {
  64. return !isset($this->CNF['PARAM_USE_IN']) || getParam($this->CNF['PARAM_USE_IN']) == 'on';
  65. }
  66. public function isUseCoverAsThumb()
  67. {
  68. return $this->_bUseCoverAsThumb;
  69. }
  70. public function getPriceName($sName)
  71. {
  72. return uriGenerate($sName, $this->CNF['TABLE_PRICES'], $this->CNF['FIELD_PRICE_NAME'], ['lowercase' => false]);
  73. }
  74. protected function _initUseCoverAsThumb()
  75. {
  76. if(($sKey = 'PARAM_USE_COVER_AS_THUMB') && !empty($this->CNF[$sKey]))
  77. return getParam($this->CNF[$sKey]) == 'on';
  78. if(($sParam = $this->_sName . '_use_cover_as_thumb') && ($mixedValue = getParam($sParam)) !== false)
  79. return $mixedValue == 'on';
  80. return true;
  81. }
  82. }
  83. /** @} */