BxBaseStudioLauncher.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php defined('BX_DOL') 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 TridentView Trident Studio Representation classes
  7. * @ingroup TridentStudio
  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. return BxDolStudioTemplate::getInstance()->parseHtmlByName('launcher.html', array(
  64. 'js_object' => $this->getPageJsObject(),
  65. 'includes' => $sIncludes,
  66. 'items' => parent::getPageCode($bHidden),
  67. 'tour_theme' => $this->_sTourTheme,
  68. ));
  69. }
  70. public function serviceGetCacheUpdater()
  71. {
  72. check_logged();
  73. if(!isAdmin())
  74. return '';
  75. $oTemplate = BxDolStudioTemplate::getInstance();
  76. $sContent = $oTemplate->addJs('launcher.js', true);
  77. $sContent .= $oTemplate->parseHtmlByName('launcher_cache_updater.html', array(
  78. 'js_object' => $this->getPageJsObject()
  79. ));
  80. return $sContent;
  81. }
  82. }
  83. /** @} */