BxReviewsMenuViewActions.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 Reviews Reviews
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * View entry social actions menu
  13. */
  14. class BxReviewsMenuViewActions extends BxBaseModTextMenuViewActions
  15. {
  16. public function __construct($aObject, $oTemplate = false)
  17. {
  18. $this->_sModule = 'bx_reviews';
  19. parent::__construct($aObject, $oTemplate);
  20. }
  21. protected function _getMenuItemEditReview($aItem)
  22. {
  23. return $this->_getMenuItemByNameActions($aItem);
  24. }
  25. protected function _getMenuItemDeleteReview($aItem)
  26. {
  27. return $this->_getMenuItemByNameActions($aItem);
  28. }
  29. protected function _isContentPublic($iContentId, $aPublicGroups = []) {
  30. $CNF = &$this->_oModule->_oConfig->CNF;
  31. if(empty($CNF['FIELD_ALLOW_VIEW_TO']))
  32. return true;
  33. $aContentInfo = $iContentId == $this->_iContentId ? $this->_aContentInfo : $this->_oModule->_oDb->getContentInfoById($iContentId);
  34. if(!isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
  35. return true;
  36. if(empty($aPublicGroups))
  37. $aPublicGroups = [BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS];
  38. return $aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] < 0 || in_array($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']], $aPublicGroups);
  39. }
  40. }
  41. /** @} */