BxBaseMenuFooter.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_language_mask', $aItems[$iKey]['title'], genFlag());
  25. break;
  26. case 'switch_template':
  27. $aTemplates = get_templates_array(true, true);
  28. $sTemplate = $aTemplates[$this->_oTemplate->getCode()];
  29. $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_template_mask', $aItems[$iKey]['title'], $sTemplate);
  30. break;
  31. }
  32. return $aItems;
  33. }
  34. protected function _isVisible ($a)
  35. {
  36. if(!parent::_isVisible($a))
  37. return false;
  38. $bResult = true;
  39. switch ($a['name']) {
  40. case 'switch_language':
  41. $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true);
  42. if(count($aLanguages) <= 1)
  43. $bResult = false;
  44. break;
  45. case 'switch_template':
  46. $aTemplates = get_templates_array(true, true);
  47. if(count($aTemplates) <= 1)
  48. $bResult = false;
  49. break;
  50. }
  51. return $bResult;
  52. }
  53. }
  54. /** @} */