1
0

BxBaseStudioModules.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. class BxBaseStudioModules extends BxDolStudioModules
  11. {
  12. public function __construct()
  13. {
  14. parent::__construct();
  15. }
  16. public function getCss()
  17. {
  18. return array('module.css');
  19. }
  20. public function getJs()
  21. {
  22. return array('jquery.anim.js', 'page.js', 'module.js');
  23. }
  24. public function getJsClass()
  25. {
  26. return $this->sJsClass;
  27. }
  28. public function getJsObject()
  29. {
  30. return $this->sJsObject;
  31. }
  32. public function getJsParams($aParams = array())
  33. {
  34. return array_merge(array(
  35. 'sActionUrl' => BX_DOL_URL_STUDIO . $this->sActionUri,
  36. 'sActionsPrefix' => $this->sParamPrefix,
  37. ), $aParams);
  38. }
  39. public function getJsCode($aParams = array(), $mixedWrap = true)
  40. {
  41. $sJsObject = $this->getJsObject();
  42. $sJsClass = $this->getJsClass();
  43. $aParams = $this->getJsParams($aParams);
  44. $sContent = bx_replace_markers("var {object} = new {class}({params});", array(
  45. 'object' => $sJsObject,
  46. 'class' => $sJsClass,
  47. 'params' => json_encode($aParams)
  48. ));
  49. return ($mixedWrap === true || (is_array($mixedWrap) && isset($mixedWrap['wrap']) && $mixedWrap['wrap'] === true)) ? BxDolStudioTemplate::getInstance()->_wrapInTagJsCode($sContent) : $sContent;
  50. }
  51. }
  52. /** @} */