BxBaseStudioLauncher.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. define('BX_DOL_STUDIO_LAUNCHER_JS_OBJECT', 'oBxDolStudioLauncher');
  11. class BxBaseStudioLauncher extends BxDolStudioLauncher
  12. {
  13. protected $_sTourTheme = 'default';
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function getPageIndex()
  19. {
  20. if(!is_array($this->aPage || empty($this->aPage)))
  21. return BX_PAGE_DEFAULT;
  22. return !empty($this->aPage[$this->sPageSelected]) ? $this->aPage[$this->sPageSelected]->getPageIndex() : BX_PAGE_DEFAULT;
  23. }
  24. public function getPageJs()
  25. {
  26. $aJs = array(
  27. 'jquery-ui/jquery.ui.core.min.js',
  28. 'jquery-ui/jquery.ui.widget.min.js',
  29. 'jquery-ui/jquery.ui.mouse.min.js',
  30. 'jquery-ui/jquery.ui.sortable.min.js',
  31. 'jquery.ui.touch-punch.min.js',
  32. 'jquery.easing.js',
  33. 'jquery.cookie.min.js',
  34. 'launcher.js',
  35. 'shepherd/js/tether.min.js',
  36. 'shepherd/js/shepherd.min.js',
  37. );
  38. foreach($this->aIncludes as $sName => $oInclude)
  39. $aJs = array_merge($aJs, $oInclude->getJs());
  40. return $aJs;
  41. }
  42. public function getPageJsObject()
  43. {
  44. return BX_DOL_STUDIO_LAUNCHER_JS_OBJECT;
  45. }
  46. public function getPageCss()
  47. {
  48. $aCss = array(
  49. 'launcher.css',
  50. BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'shepherd/css/|shepherd-theme-' . $this->_sTourTheme . '.css',
  51. );
  52. foreach($this->aIncludes as $sName => $oInclude)
  53. $aCss = array_merge($aCss, $oInclude->getCss());
  54. return $aCss;
  55. }
  56. public function getPageCode($bHidden = false)
  57. {
  58. if(empty($this->aPage) || !is_array($this->aPage))
  59. return '';
  60. $sIncludes = '';
  61. foreach($this->aIncludes as $sName => $oInclude)
  62. $sIncludes .= $oInclude->getJsCode();
  63. $s = BxDolStudioTemplate::getInstance()->parseHtmlByName('launcher.html', array(
  64. 'js_object' => $this->getPageJsObject(),
  65. 'includes' => $sIncludes,
  66. 'items' => parent::getPageCode($bHidden),
  67. ));
  68. if (getParam('site_tour_studio') == 'on')
  69. $s .= BxDolStudioTemplate::getInstance()->parseHtmlByName('launcher_tour.html', array('tour_theme' => $this->_sTourTheme));
  70. return $s;
  71. }
  72. public function serviceGetCacheUpdater()
  73. {
  74. check_logged();
  75. if(!isAdmin())
  76. return '';
  77. $oTemplate = BxDolStudioTemplate::getInstance();
  78. $sContent = $oTemplate->addJs('launcher.js', true);
  79. $sContent .= $oTemplate->parseHtmlByName('launcher_cache_updater.html', array(
  80. 'js_object' => $this->getPageJsObject()
  81. ));
  82. return $sContent;
  83. }
  84. }
  85. /** @} */