BxDolInstallView.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaInstall UNA Install
  7. * @{
  8. */
  9. class BxDolInstallView
  10. {
  11. protected $_sDirPlugins = BX_INSTALL_DIR_PLUGINS;
  12. protected $_sDirTemplates = BX_INSTALL_DIR_TEMPLATES;
  13. protected $_sUrlCss = '../template/css/';
  14. protected $_sPathCss = '../template/css/';
  15. protected $_sUrlJs = '../';
  16. protected $_aToolbarItem = array();
  17. protected $_aFilesCss = array (
  18. '../../plugins_public/tailwind/css/tailwind.min.css',
  19. 'common.css',
  20. 'default.less',
  21. 'general.css',
  22. 'icons.css',
  23. 'colors.css',
  24. 'forms.css',
  25. 'menu.css',
  26. 'media-desktop.css',
  27. 'media-tablet.css',
  28. 'media-phone.css',
  29. 'media-print.css',
  30. );
  31. protected $_aFilesJs = array (
  32. 'plugins_public/jquery/jquery.min.js',
  33. 'plugins_public/jquery-ui/jquery.ui.position.min.js',
  34. 'inc/js/jquery.dolPopup.js',
  35. 'inc/js/jquery.webForms.js',
  36. );
  37. function __construct()
  38. {
  39. }
  40. function out ($sTemplate, $aVars = array())
  41. {
  42. extract($aVars);
  43. include($this->_sDirTemplates . $sTemplate);
  44. }
  45. function pageStart ()
  46. {
  47. ob_start();
  48. }
  49. function pageEnd ($sTitle)
  50. {
  51. $aToolbarItem = $this->_aToolbarItem;
  52. $sInlineCSS = $this->_getInlineCSS();
  53. $sFilesCSS = $this->_getFilesCSS();
  54. $sFilesJS = $this->_getFilesJS();
  55. $sCode = ob_get_clean();
  56. include($this->_sDirTemplates . '_page.php');
  57. }
  58. function setToolbarItem($sIcon, $sLink, $sTitle = '', $sTarget = '')
  59. {
  60. $this->_aToolbarItem = array(
  61. 'icon' => $sIcon,
  62. 'link' => $sLink,
  63. 'title' => $sTitle,
  64. 'target' => $sTarget,
  65. );
  66. }
  67. protected function _getFilesCSS()
  68. {
  69. $s = '';
  70. foreach ($this->_aFilesCss as $sFile)
  71. if (substr($sFile, -4) === '.css')
  72. $s .= '<link rel="stylesheet" href="' . $this->_sUrlCss . $sFile . '" />' . "\n";
  73. return $s;
  74. }
  75. protected function _getFilesJS()
  76. {
  77. $s = '';
  78. foreach ($this->_aFilesJs as $sFile)
  79. $s .= '<script src="' . $this->_sUrlJs . $sFile . '"></script>';
  80. return $s;
  81. }
  82. protected function _getInlineCSS()
  83. {
  84. $oLessParser = new Less_Parser();
  85. $oConfigBase = new BxBaseConfig();
  86. $oLessParser->ModifyVars($oConfigBase->aLessConfig);
  87. foreach ($this->_aFilesCss as $sFile) {
  88. if (substr($sFile, -5) !== '.less')
  89. continue;
  90. $oLessParser->parseFile($this->_sPathCss . $sFile, $this->_sUrlCss);
  91. }
  92. return $oLessParser->getCss();
  93. }
  94. }
  95. /** @} */