BxBaseStudioLauncher.php 2.5 KB

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