1
0

BxDevTemplate.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 Developer Developer
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxDevTemplate extends BxBaseModGeneralTemplate
  12. {
  13. function __construct(&$oConfig, &$oDb)
  14. {
  15. parent::__construct($oConfig, $oDb);
  16. $this->addStudioCss(['main.css']);
  17. $this->addStudioJs(['main.js']);
  18. }
  19. public function getJsCode($sType, $aParams = [], $mixedWrap = true)
  20. {
  21. if(empty($aParams) || !is_array($aParams))
  22. $aParams = [];
  23. return parent::getJsCode($sType, array_merge($aParams, [
  24. 'sTxtExportType' => bx_js_string(_t('_bx_dev_txt_export_type')),
  25. 'sTxtBasic' => bx_js_string(_t('_bx_dev_btn_basic')),
  26. 'sTxtFull' => bx_js_string(_t('_bx_dev_btn_full'))
  27. ]), $mixedWrap);
  28. }
  29. function displayPageSettings($sPage, $oContent, $sGetPageCodeMethod = 'getPageCode')
  30. {
  31. $this->addStudioCss($oContent->getCss(), false, false);
  32. $this->addStudioJs($oContent->getJs(), false, false);
  33. $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-single');
  34. return $oContent->getCode();
  35. }
  36. function displayPageContent($sPage, $oContent, $sGetPageCodeMethod = 'getPageCode')
  37. {
  38. $this->addStudioCss($oContent->getPageCss(), false, false);
  39. $this->addStudioJs($oContent->getPageJs(), false, false);
  40. $sMenu = $oContent->getPageMenu();
  41. $sContent = $oContent->getPageJsCode() . $oContent->$sGetPageCodeMethod();
  42. if(empty($sMenu)) {
  43. $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-single');
  44. return $sContent;
  45. }
  46. $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-columns');
  47. return $this->parseHtmlByName('page_content.html', [
  48. 'page_menu_code' => $sMenu,
  49. 'page_main_code' => $sContent
  50. ]);
  51. }
  52. }
  53. /** @} */