BxBaseModGeneralTemplate.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 TridentModules
  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, $aParams = array(), $bWrap = true)
  24. {
  25. $sBaseUri = $this->_oConfig->getBaseUri();
  26. $sJsClass = $this->_oConfig->getJsClass($sType);
  27. $sJsObject = $this->_oConfig->getJsObject($sType);
  28. $aParams = array_merge(array(
  29. 'sActionUri' => $sBaseUri,
  30. 'sActionUrl' => BX_DOL_URL_ROOT . $sBaseUri,
  31. 'sObjName' => $sJsObject,
  32. 'aHtmlIds' => array(),
  33. 'oRequestParams' => array()
  34. ), $aParams);
  35. $sContent = "var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aParams) . ");";
  36. return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
  37. }
  38. function entryLocation ($iContentId)
  39. {
  40. $oModule = BxDolModule::getInstance($this->MODULE);
  41. $CNF = &$oModule->_oConfig->CNF;
  42. if (empty($CNF['OBJECT_METATAGS']))
  43. return '';
  44. bx_import('BxDolMetatags');
  45. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
  46. $aVars = array (
  47. 'location' => $oMetatags->locationsString($iContentId)
  48. );
  49. return $this->parseHtmlByName('entry-location.html', $aVars);
  50. }
  51. }
  52. /** @} */