1
0

BxBaseStudioMenuTop.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioMenuTop extends BxDolStudioMenuTop
  11. {
  12. function __construct()
  13. {
  14. parent::__construct();
  15. }
  16. function getCss()
  17. {
  18. return array('menu_top.css');
  19. }
  20. function getJs()
  21. {
  22. return array('menu_top.js');
  23. }
  24. function getJsObject()
  25. {
  26. return 'oBxDolStudioMenuTop';
  27. }
  28. function getCode()
  29. {
  30. $aTmplVars = array();
  31. foreach($this->aItems as $sPosition => $mixedItems) {
  32. if(!$this->aVisible[$sPosition])
  33. continue;
  34. $sContent = "";
  35. if(is_string($mixedItems) && !empty($mixedItems))
  36. $sContent = $mixedItems;
  37. else if(is_array($mixedItems)) {
  38. $oMenu = new BxTemplStudioMenu($mixedItems);
  39. $oMenu->addMarkers(array(
  40. 'js_object' => $this->getJsObject(),
  41. 'url_root' => BX_DOL_URL_ROOT,
  42. 'url_studio' => BX_DOL_URL_STUDIO
  43. ));
  44. $sContent = $oMenu->getCode();
  45. }
  46. $aTmplVars[] = array(
  47. 'name' => $sPosition,
  48. 'content' => $sContent
  49. );
  50. }
  51. if(empty($aTmplVars))
  52. return '';
  53. $oTemplate = BxDolStudioTemplate::getInstance();
  54. $oTemplate->addJs($this->getJs());
  55. $oTemplate->addCss($this->getCss());
  56. return $oTemplate->parseHtmlByName('menu_top.html', array('bx_repeat:menus' => $aTmplVars));
  57. }
  58. }
  59. /** @} */