BxBaseModProfilePrivacy.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 BxBaseModProfilePrivacy extends BxTemplPrivacy
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. protected $_aPrivacyParticallyVisible;
  16. public function __construct($aOptions, $oTemplate = false)
  17. {
  18. parent::__construct($aOptions, $oTemplate);
  19. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  20. $this->_aPrivacyParticallyVisible = array(BX_DOL_PG_FRIENDS);
  21. }
  22. public function isPartiallyVisible ($mixedPrivacy)
  23. {
  24. return in_array($mixedPrivacy, $this->_aPrivacyParticallyVisible);
  25. }
  26. public function getPartiallyVisiblePrivacyGroups ()
  27. {
  28. return $this->_aPrivacyParticallyVisible;
  29. }
  30. protected function getObjectInfo($sAction, $iObjectId)
  31. {
  32. $oProfile = BxDolProfile::getInstanceByContentAndType($iObjectId, $this->MODULE);
  33. if(!$oProfile)
  34. return false;
  35. $a = $this->_oDb->getObjectInfo($sAction, $iObjectId);
  36. $a['owner_id'] = $oProfile->id();
  37. return $a;
  38. }
  39. protected function isSelectGroupCustom($aParams)
  40. {
  41. if($this->_oModule->serviceActAsProfile() && empty($aParams['content_id']))
  42. return _t('_sys_ps_ferr_incorrect_gc_not_allowed');
  43. return true;
  44. }
  45. }
  46. /** @} */