BxBaseModGeneralTemplate.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 BaseGeneral Base classes for modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolModuleTemplate');
  12. /**
  13. * Module representation.
  14. */
  15. class BxBaseModGeneralTemplate extends BxDolModuleTemplate
  16. {
  17. protected $MODULE;
  18. function __construct(&$oConfig, &$oDb)
  19. {
  20. parent::__construct($oConfig, $oDb);
  21. $this->addCss ('main.css');
  22. }
  23. public function getJsCode($sType, $aRequestParams = array(), $bWrap = true)
  24. {
  25. $sBaseUri = $this->_oConfig->getBaseUri();
  26. $sJsClass = $this->_oConfig->getJsClass($sType);
  27. $sJsObject = $this->_oConfig->getJsObject($sType);
  28. $aParams = array(
  29. 'sActionUri' => $sBaseUri,
  30. 'sActionUrl' => BX_DOL_URL_ROOT . $sBaseUri,
  31. 'sObjName' => $sJsObject,
  32. 'sObjNameGrid' => $this->_oConfig->getGridObject($sType),
  33. 'oRequestParams' => !empty($aRequestParams) ? $aRequestParams : array()
  34. );
  35. $sContent = "var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aParams) . ");";
  36. return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
  37. }
  38. }
  39. /** @} */