BxBaseMenuToolbar.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. bx_import('BxTemplMenu');
  10. /**
  11. * Menu representation.
  12. * @see BxDolMenu
  13. */
  14. class BxBaseMenuToolbar extends BxTemplMenu
  15. {
  16. public function __construct ($aObject, $oTemplate)
  17. {
  18. parent::__construct ($aObject, $oTemplate);
  19. }
  20. public function getMenuItems ()
  21. {
  22. $a = parent::getMenuItems ();
  23. if (!isLogged())
  24. return $a;
  25. foreach ($a as $k => $r) {
  26. if ('account' != $r['name'])
  27. continue;
  28. bx_import('BxDolProfile');
  29. $oProfile = BxDolProfile::getInstance(bx_get_logged_profile_id ());
  30. $sUrlIcon = $oProfile->getThumb();
  31. if (!$sUrlIcon)
  32. break;
  33. $a[$k]['bx_if:image'] = array (
  34. 'condition' => true,
  35. 'content' => array('icon_url' => $sUrlIcon),
  36. );
  37. $a[$k]['bx_if:icon']['condition'] = false;
  38. }
  39. return $a;
  40. }
  41. protected function _getMenuItem ($a)
  42. {
  43. $a = parent::_getMenuItem ($a);
  44. if ('add-content' == $a['name'] || 'search' == $a['name'])
  45. $a['class_add'] .= ' bx-def-media-phone-hide';
  46. return $a;
  47. }
  48. }
  49. /** @} */