BxBaseStudioLauncher.php 2.6 KB

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