BxBaseModProfileConfig.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 BaseProfile Base classes for profile modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModProfileConfig extends BxBaseModGeneralConfig
  12. {
  13. protected $_aMenuItems2MethodsActions = array();
  14. protected $_aMenuItems2MethodsSubmenu = array();
  15. protected $_bRoles;
  16. protected $_aRoles;
  17. function __construct($aModule)
  18. {
  19. parent::__construct($aModule);
  20. $this->CNF = array(
  21. 'PARAM_MULTICAT_ENABLED' => false,
  22. );
  23. $this->_aMenuItems2MethodsActions = array (
  24. 'profile-friend-add' => 'checkAllowedFriendAdd',
  25. 'profile-friend-remove' => 'checkAllowedFriendRemove',
  26. 'profile-relation-add' => 'checkAllowedRelationAdd',
  27. 'profile-relation-remove' => 'checkAllowedRelationRemove',
  28. 'profile-subscribe-add' => 'checkAllowedSubscribeAdd',
  29. 'profile-subscribe-remove' => 'checkAllowedSubscribeRemove',
  30. 'profile-actions-more' => 'checkAllowedViewMoreMenu',
  31. 'profile-set-acl-level' => 'checkAllowedSetMembership',
  32. 'convos-compose' => 'checkAllowedCompose',
  33. 'messenger' => 'checkAllowedCompose',
  34. );
  35. $this->_bRoles = false;
  36. $this->_aRoles = false;
  37. }
  38. public function isRoles()
  39. {
  40. if($this->_aRoles === false)
  41. $this->_initRoles();
  42. return $this->_bRoles;
  43. }
  44. public function getRoles()
  45. {
  46. if($this->_aRoles === false)
  47. $this->_initRoles();
  48. return $this->_aRoles;
  49. }
  50. protected function _initRoles()
  51. {
  52. if(empty($this->CNF['OBJECT_PRE_LIST_ROLES']))
  53. return;
  54. $this->_aRoles = BxDolFormQuery::getDataItems($this->CNF['OBJECT_PRE_LIST_ROLES']);
  55. $this->_bRoles = !empty($this->_aRoles) && is_array($this->_aRoles);
  56. }
  57. }
  58. /** @} */