1
0

BxBaseModProfileConfig.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 isMultiRoles()
  45. {
  46. return !empty($this->CNF['PARAM_MMODE']) && getParam($this->CNF['PARAM_MMODE']) == BX_BASE_MOD_GROUPS_MMODE_MULTI_ROLES;
  47. }
  48. public function getRoles()
  49. {
  50. if($this->_aRoles === false)
  51. $this->_initRoles();
  52. return $this->_aRoles;
  53. }
  54. protected function _initRoles()
  55. {
  56. if(empty($this->CNF['OBJECT_PRE_LIST_ROLES']))
  57. return;
  58. $this->_aRoles = BxDolFormQuery::getDataItems($this->CNF['OBJECT_PRE_LIST_ROLES']);
  59. $this->_bRoles = !empty($this->_aRoles) && is_array($this->_aRoles);
  60. }
  61. }
  62. /** @} */