BxBaseStudioDesign.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 BxBaseStudioDesign extends BxDolStudioDesign
  11. {
  12. protected $aMenuItems = array(
  13. BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS => array('title' => '_adm_lmi_cpt_settings', 'icon' => 'mi-cog.svg', 'icon_bg' => true),
  14. BX_DOL_STUDIO_TEMPL_TYPE_LOGO => array('title' => '_adm_lmi_cpt_logo', 'icon' => 'mi-tpl-logo.svg', 'icon_bg' => true)
  15. );
  16. public function __construct($sModule, $mixedPageName, $sPage = "")
  17. {
  18. parent::__construct($sModule, $mixedPageName, $sPage);
  19. $this->aPageJs = array_merge($this->aPageJs, ['jquery.form.min.js', 'jquery.webForms.js']);
  20. $this->oHelper = BxTemplStudioDesigns::getInstance();
  21. }
  22. protected function getSettings($mixedCategory = '', $sMix = '')
  23. {
  24. $oOptions = new BxTemplStudioOptions($this->sModule, $mixedCategory, $sMix);
  25. $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss());
  26. $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs());
  27. return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
  28. 'content' => $oOptions->getCode(),
  29. 'js_content' => $this->getPageJsCode(),
  30. ));
  31. }
  32. protected function getLogo()
  33. {
  34. $oPage = $this->getObjectDesigner();
  35. $this->aPageCss = array_merge($this->aPageCss, $oPage->getPageCss());
  36. $this->aPageJs = array_merge($this->aPageJs, $oPage->getPageJs());
  37. return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
  38. 'content' => $oPage->getPageCode(BX_DOL_STUDIO_TEMPL_TYPE_LOGO, false),
  39. 'js_content' => $this->getPageJsCode()
  40. ));
  41. }
  42. protected function getStyles($mixedCategory = '', $sMix = '')
  43. {
  44. $oOptions = new BxTemplStudioOptions($this->sModule, $mixedCategory, $sMix);
  45. $oOptions->enableReadOnly(true);
  46. $oOptions->enableMixes(true);
  47. $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss(), [BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css']);
  48. $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs(), ['codemirror/codemirror.min.js']);
  49. return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', [
  50. 'content' => $oOptions->getCode(),
  51. 'js_content' => $this->getPageJsCode([
  52. 'sCodeMirror' => "textarea[name='" . $this->sModule . "_styles_custom']"
  53. ])
  54. ]);
  55. }
  56. }
  57. /** @} */