BxBaseMenuFooter.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. * 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. $sTitle = _t('_sys_menu_item_title_switch_language_mask', $aItems[$iKey]['title'], genFlag());
  25. $aItems[$iKey]['title'] = $sTitle;
  26. $aItems[$iKey]['bx_if:title']['condition'] = (bool)$sTitle;
  27. $aItems[$iKey]['bx_if:title']['content']['title'] = $sTitle;
  28. break;
  29. case 'switch_template':
  30. $aTemplates = get_templates_array(true, true);
  31. $sTemplateName = $this->_oTemplate->getCode();
  32. $sTemplateTitle = isset($aTemplates[$sTemplateName]) ? $aTemplates[$sTemplateName] : '';
  33. $sTitle = _t('_sys_menu_item_title_switch_template_mask', $aItems[$iKey]['title'], $sTemplateTitle);
  34. $aItems[$iKey]['title'] = $sTitle;
  35. $aItems[$iKey]['bx_if:title']['condition'] = (bool)$sTitle;
  36. $aItems[$iKey]['bx_if:title']['content']['title'] = $sTitle;
  37. break;
  38. case 'powered_by':
  39. $sTitleAttr = bx_html_attribute(_t('_sys_txt_powered_by'));
  40. $aItems[$iKey]['title_attr'] = $sTitleAttr;
  41. $aItems[$iKey]['bx_if:image']['content']['title_attr'] = $sTitleAttr;
  42. break;
  43. }
  44. if (!isset($aItems[$iKey]['title_attr'])) {
  45. $sTitleAttr = bx_html_attribute(strip_tags($aItems[$iKey]['title']));
  46. $aItems[$iKey]['title_attr'] = $sTitleAttr;
  47. $aItems[$iKey]['bx_if:image']['content']['title_attr'] = $sTitleAttr;
  48. }
  49. }
  50. return $aItems;
  51. }
  52. protected function _isVisible ($a)
  53. {
  54. if(!parent::_isVisible($a))
  55. return false;
  56. $bResult = true;
  57. switch ($a['name']) {
  58. case 'switch_language':
  59. $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true);
  60. if(count($aLanguages) <= 1)
  61. $bResult = false;
  62. break;
  63. case 'switch_template':
  64. $aTemplates = get_templates_array(true, true);
  65. if(count($aTemplates) <= 1)
  66. $bResult = false;
  67. break;
  68. }
  69. return $bResult;
  70. }
  71. }
  72. /** @} */