BxBaseMenuAccountNotifications.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 'notifications-cart':
  31. $oPayments = BxDolPayments::getInstance();
  32. if(!$oPayments->isActive())
  33. return false;
  34. break;
  35. case 'notifications-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. case 'profile-stats-subscriptions':
  44. case 'profile-stats-subscribed-me':
  45. $aInfo = BxDolProfile::getInstance()->getInfo();
  46. if($a['module'] != $aInfo['type'])
  47. return false;
  48. break;
  49. }
  50. return true;
  51. }
  52. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  53. {
  54. return array(
  55. 'addon' => $mixedAddon,
  56. 'addonf' => $this->_oTemplate->parseHtmlByName('menu_item_addon.html', array(
  57. 'content' => $mixedAddon
  58. ))
  59. );
  60. }
  61. }
  62. /** @} */