BxBaseModNotificationsResponse.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 BaseNotifications Base classes for Notifications like modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModNotificationsResponse extends BxDolAlertsResponse
  12. {
  13. protected $_oModule;
  14. function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. protected function _getObjectOwnerId($aExtras)
  19. {
  20. return is_array($aExtras) && isset($aExtras['object_author_id']) ? (int)$aExtras['object_author_id'] : 0;
  21. }
  22. protected function _getObjectPrivacyView($aExtras)
  23. {
  24. return is_array($aExtras) && isset($aExtras['privacy_view']) ? (int)$aExtras['privacy_view'] : $this->_oModule->_oConfig->getPrivacyViewDefault('object');
  25. }
  26. protected function _getSubObjectId($aExtras)
  27. {
  28. if(is_array($aExtras) && isset($aExtras['comment_id']))
  29. return (int)$aExtras['comment_id'];
  30. if(is_array($aExtras) && isset($aExtras['vote_id']))
  31. return (int)$aExtras['vote_id'];
  32. if(is_array($aExtras) && isset($aExtras['notification_subobject_id']))
  33. return (int)$aExtras['notification_subobject_id'];
  34. return 0;
  35. }
  36. }
  37. /** @} */