BxBaseStudioLauncher.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 . 'flag-icon-css/css/|flag-icon.min.css',
  51. BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'shepherd/css/|shepherd-theme-' . $this->_sTourTheme . '.css',
  52. );
  53. foreach($this->aIncludes as $sName => $oInclude)
  54. $aCss = array_merge($aCss, $oInclude->getCss());
  55. return $aCss;
  56. }
  57. public function getPageCode($bHidden = false)
  58. {
  59. if(empty($this->aPage) || !is_array($this->aPage))
  60. return '';
  61. $oTemplate = BxDolStudioTemplate::getInstance();
  62. $sIncludes = '';
  63. foreach($this->aIncludes as $sName => $oInclude)
  64. $sIncludes .= $oInclude->getJsCode();
  65. $s = $oTemplate->parseHtmlByName('launcher.html', array(
  66. 'js_object' => $this->getPageJsObject(),
  67. 'includes' => $sIncludes,
  68. 'items' => parent::getPageCode($bHidden),
  69. ));
  70. if (getParam('site_tour_studio') == 'on')
  71. $s .= $oTemplate->parseHtmlByName('launcher_tour.html', array('tour_theme' => $this->_sTourTheme));
  72. return $s;
  73. }
  74. public function serviceGetCacheUpdater()
  75. {
  76. check_logged();
  77. if(!isAdmin())
  78. return '';
  79. $oTemplate = BxDolStudioTemplate::getInstance();
  80. $sContent = $oTemplate->addJs('launcher.js', true);
  81. $sContent .= $oTemplate->parseHtmlByName('launcher_cache_updater.html', array(
  82. 'js_object' => $this->getPageJsObject()
  83. ));
  84. return $sContent;
  85. }
  86. }
  87. /** @} */