1
0

BxBaseMenuAccountNotifications.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. bx_import('BxTemplMenu');
  10. /**
  11. * Menu representation.
  12. * @see BxDolMenu
  13. */
  14. class BxBaseMenuAccountNotifications extends BxTemplMenu
  15. {
  16. public function __construct ($aObject, $oTemplate)
  17. {
  18. parent::__construct ($aObject, $oTemplate);
  19. }
  20. /**
  21. * Check if menu items is visible with extended checking for friends notifications
  22. * @param $a menu item array
  23. * @return boolean
  24. */
  25. protected function _isVisible ($a)
  26. {
  27. // default visible settings
  28. bx_import('BxDolAcl');
  29. if (!BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
  30. return false;
  31. // show only friends for currently active profile for friend request notification
  32. if ('notifications-friend-requests' == $a['name'] || 'profile-stats-friend-requests' == $a['name']) {
  33. $oProfile = BxDolProfile::getInstance();
  34. $aInfo = $oProfile->getInfo();
  35. if ($a['module'] != $aInfo['type'])
  36. return false;
  37. }
  38. return true;
  39. }
  40. }
  41. /** @} */