BxInvConfig.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 Invites Invites
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. class BxInvConfig extends BxBaseModGeneralConfig
  12. {
  13. protected $_oDb;
  14. protected $_iCountPerUser;
  15. protected $_sKeyCode;
  16. protected $_iKeyLifetime;
  17. protected $_bRequestInvite;
  18. protected $_sRequestsEmail;
  19. protected $_bRegistrationByInvitation;
  20. /**
  21. * Constructor
  22. */
  23. public function __construct($aModule)
  24. {
  25. parent::__construct($aModule);
  26. $this->CNF = array (
  27. 'URL_INVITE' => 'page.php?i=invites-invite',
  28. 'URL_REQUEST' => 'page.php?i=invites-request',
  29. );
  30. $this->_aObjects = array(
  31. 'alert' => $this->_sName,
  32. 'grid_requests' => $this->_sName . '_requests',
  33. 'form_invite' => $this->_sName . '_invite',
  34. 'form_request' => $this->_sName . '_request',
  35. 'form_display_invite_send' => $this->_sName . '_invite_send',
  36. 'form_display_request_send' => $this->_sName . '_request_send',
  37. );
  38. $this->_aPrefixes = array(
  39. 'style' => 'bx-inv',
  40. 'option' => 'bx_invites_',
  41. );
  42. $this->_iCountPerUser = 0;
  43. $this->_sKeyCode = 'icode';
  44. $this->_iKeyLifetime = 86400;
  45. $this->_bRequestInvite = true;
  46. $this->_sRequestsEmail = '';
  47. $this->_bRegistrationByInvitation = true;
  48. }
  49. public function init(&$oDb)
  50. {
  51. $this->_oDb = &$oDb;
  52. $sOptionPrefix = $this->getPrefix('option');
  53. $this->_iCountPerUser = (int)getParam($sOptionPrefix . 'count_per_user');
  54. $this->_iKeyLifetime = 86400 * (int)getParam($sOptionPrefix . 'key_lifetime');
  55. $this->_bRequestInvite = getParam($sOptionPrefix . 'enable_request_invite') == 'on';
  56. $this->_sRequestsEmail = getParam($sOptionPrefix . 'requests_email');
  57. $this->_bRegistrationByInvitation = getParam($sOptionPrefix . 'enable_reg_by_inv') == 'on';
  58. }
  59. public function getCountPerUser()
  60. {
  61. return $this->_iCountPerUser;
  62. }
  63. public function getKeyCode()
  64. {
  65. return $this->_sKeyCode;
  66. }
  67. public function getKeyLifetime()
  68. {
  69. return $this->_iKeyLifetime;
  70. }
  71. public function isRequestInvite()
  72. {
  73. return $this->_bRequestInvite;
  74. }
  75. public function getRequestsEmail()
  76. {
  77. return $this->_sRequestsEmail;
  78. }
  79. public function isRegistrationByInvitation()
  80. {
  81. return $this->_bRegistrationByInvitation;
  82. }
  83. }
  84. /** @} */