BxBaseMenuAccountNotifications.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 TridentCore Trident Core
  7. * @{
  8. */
  9. /**
  10. * Menu representation.
  11. * @see BxDolMenu
  12. */
  13. class BxBaseMenuAccountNotifications extends BxTemplMenu
  14. {
  15. public function __construct ($aObject, $oTemplate)
  16. {
  17. parent::__construct ($aObject, $oTemplate);
  18. }
  19. /**
  20. * Check if menu items is visible with extended checking for friends notifications
  21. * @param $a menu item array
  22. * @return boolean
  23. */
  24. protected function _isVisible ($a)
  25. {
  26. // default visible settings
  27. if (!BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
  28. return false;
  29. switch ($a['name']) {
  30. case 'cart':
  31. $oPayments = BxDolPayments::getInstance();
  32. if(!$oPayments->isActive())
  33. return false;
  34. break;
  35. case 'orders':
  36. $oPayments = BxDolPayments::getInstance();
  37. if(!$oPayments->isActive())
  38. return false;
  39. break;
  40. // show only friends for currently active profile for friend request notification
  41. case 'notifications-friend-requests':
  42. case 'profile-stats-friend-requests':
  43. $aInfo = BxDolProfile::getInstance()->getInfo();
  44. if($a['module'] != $aInfo['type'])
  45. return false;
  46. break;
  47. }
  48. return true;
  49. }
  50. }
  51. /** @} */