1
0

BxBaseMenuFooter.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 DolphinCore Dolphin Core
  7. * @{
  8. */
  9. bx_import('BxTemplMenu');
  10. /**
  11. * Site main menu representation.
  12. */
  13. class BxBaseMenuFooter extends BxTemplMenu
  14. {
  15. public function __construct ($aObject, $oTemplate)
  16. {
  17. parent::__construct ($aObject, $oTemplate);
  18. }
  19. public function getMenuItems ()
  20. {
  21. $aItems = parent::getMenuItems();
  22. foreach($aItems as $iKey => $aItem)
  23. switch($aItem['name']) {
  24. case 'switch_language':
  25. bx_import('BxDolLanguages');
  26. $sLanguage = BxDolLanguages::getInstance()->getCurrentLangName();
  27. $sIcon = $this->_oTemplate->parseHtmlByName('bx_img.html', array(
  28. 'src' => $this->_oTemplate->getIconUrl('sys_fl_' . $sLanguage . '.gif'),
  29. 'bx_repeat:attrs' => array()
  30. ));
  31. $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_language_mask', $aItems[$iKey]['title'], $sIcon);
  32. break;
  33. case 'switch_template':
  34. $aTemplates = get_templates_array(true, true);
  35. $sTemplate = $aTemplates[$this->_oTemplate->getCode()];
  36. $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_template_mask', $aItems[$iKey]['title'], $sTemplate);
  37. break;
  38. }
  39. return $aItems;
  40. }
  41. protected function _isVisible ($a)
  42. {
  43. if(!parent::_isVisible($a))
  44. return false;
  45. $bResult = true;
  46. switch ($a['name']) {
  47. case 'switch_language':
  48. bx_import('BxDolLanguagesQuery');
  49. $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true);
  50. if(count($aLanguages) <= 1)
  51. $bResult = false;
  52. break;
  53. case 'switch_template':
  54. $aTemplates = get_templates_array(true, true);
  55. if(count($aTemplates) <= 1)
  56. $bResult = false;
  57. break;
  58. }
  59. return $bResult;
  60. }
  61. }
  62. /** @} */