1
0

BxBaseMenuFooter.php 2.1 KB

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