BxDolInstallView.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php defined('BX_DOL_INSTALL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup TridentInstall Trident 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. 'common.css',
  19. 'default.less',
  20. 'general.css',
  21. 'icons.css',
  22. 'colors.css',
  23. 'forms.css',
  24. 'menu.css',
  25. 'media-desktop.css',
  26. 'media-tablet.css',
  27. 'media-phone.css',
  28. 'media-print.css',
  29. );
  30. protected $_aFilesJs = array (
  31. 'plugins_public/jquery/jquery.min.js',
  32. 'plugins_public/jquery-ui/jquery.ui.position.min.js',
  33. 'inc/js/jquery.dolPopup.js',
  34. 'inc/js/jquery.webForms.js',
  35. );
  36. function __construct()
  37. {
  38. }
  39. function out ($sTemplate, $aVars = array())
  40. {
  41. extract($aVars);
  42. include($this->_sDirTemplates . $sTemplate);
  43. }
  44. function pageStart ()
  45. {
  46. ob_start();
  47. }
  48. function pageEnd ($sTitle)
  49. {
  50. $aToolbarItem = $this->_aToolbarItem;
  51. $sInlineCSS = $this->_getInlineCSS();
  52. $sFilesCSS = $this->_getFilesCSS();
  53. $sFilesJS = $this->_getFilesJS();
  54. $sCode = ob_get_clean();
  55. include($this->_sDirTemplates . '_page.php');
  56. }
  57. function setToolbarItem($sIcon, $sLink, $sTitle = '', $sTarget = '')
  58. {
  59. $this->_aToolbarItem = array(
  60. 'icon' => $sIcon,
  61. 'link' => $sLink,
  62. 'title' => $sTitle,
  63. 'target' => $sTarget,
  64. );
  65. }
  66. protected function _getFilesCSS()
  67. {
  68. $s = '';
  69. foreach ($this->_aFilesCss as $sFile)
  70. if (substr($sFile, -4) === '.css')
  71. $s .= '<link rel="stylesheet" href="' . $this->_sUrlCss . $sFile . '" />';
  72. return $s;
  73. }
  74. protected function _getFilesJS()
  75. {
  76. $s = '';
  77. foreach ($this->_aFilesJs as $sFile)
  78. $s .= '<script src="' . $this->_sUrlJs . $sFile . '"></script>';
  79. return $s;
  80. }
  81. protected function _getInlineCSS()
  82. {
  83. require_once($this->_sDirPlugins . 'lessphp/Less.php');
  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. /** @} */