1
0

BxBaseMenuAccountNotifications.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. $this->addMarkers(array(
  19. 'studio_url' => BX_DOL_URL_STUDIO
  20. ));
  21. }
  22. /**
  23. * Check if menu items is visible with extended checking for friends notifications
  24. * @param $a menu item array
  25. * @return boolean
  26. */
  27. protected function _isVisible ($a)
  28. {
  29. // default visible settings
  30. if (!BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
  31. return false;
  32. switch ($a['name']) {
  33. case 'studio':
  34. if (!isAdmin())
  35. return false;
  36. break;
  37. case 'cart':
  38. $oPayments = BxDolPayments::getInstance();
  39. if(!$oPayments->isActive())
  40. return false;
  41. break;
  42. case 'orders':
  43. $oPayments = BxDolPayments::getInstance();
  44. if(!$oPayments->isActive())
  45. return false;
  46. break;
  47. // show only friends for currently active profile for friend request notification
  48. case 'notifications-friend-requests':
  49. case 'profile-stats-friend-requests':
  50. case 'profile-stats-subscriptions':
  51. case 'profile-stats-subscribed-me':
  52. $aInfo = BxDolProfile::getInstance()->getInfo();
  53. if($a['module'] != $aInfo['type'])
  54. return false;
  55. break;
  56. }
  57. return true;
  58. }
  59. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  60. {
  61. return array(
  62. 'addon' => $mixedAddon,
  63. 'addonf' => $this->_oTemplate->parseHtmlByTemplateName('menu_item_addon', array(
  64. 'content' => $mixedAddon
  65. ))
  66. );
  67. }
  68. }
  69. /** @} */