BxBaseMenuAccountNotifications.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  58. {
  59. return array(
  60. 'addon' => $mixedAddon,
  61. 'addonf' => $this->_oTemplate->parseHtmlByName('menu_item_addon.html', array(
  62. 'content' => $mixedAddon
  63. ))
  64. );
  65. }
  66. }
  67. /** @} */