BxBaseMenuAccountNotifications.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 UnaBaseView UNA Base Representation Classes
  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 'subscriptions':
  36. $oPayments = BxDolPayments::getInstance();
  37. if(!$oPayments->isActive())
  38. return false;
  39. break;
  40. case 'orders':
  41. $oPayments = BxDolPayments::getInstance();
  42. if(!$oPayments->isActive())
  43. return false;
  44. break;
  45. // show only friends for currently active profile for friend request notification
  46. case 'notifications-friend-requests':
  47. case 'profile-stats-friend-requests':
  48. case 'profile-stats-subscriptions':
  49. case 'profile-stats-subscribed-me':
  50. $aInfo = BxDolProfile::getInstance()->getInfo();
  51. if($a['module'] != $aInfo['type'])
  52. return false;
  53. break;
  54. }
  55. return true;
  56. }
  57. }
  58. /** @} */