BxBaseModGeneralTemplate.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /**
  12. * Module representation.
  13. */
  14. class BxBaseModGeneralTemplate extends BxDolModuleTemplate
  15. {
  16. protected $MODULE;
  17. function __construct(&$oConfig, &$oDb)
  18. {
  19. parent::__construct($oConfig, $oDb);
  20. $this->addCss ('main.css');
  21. }
  22. public function getJsCode($sType, $aParams = array(), $bWrap = true)
  23. {
  24. $sBaseUri = $this->_oConfig->getBaseUri();
  25. $sJsClass = $this->_oConfig->getJsClass($sType);
  26. $sJsObject = $this->_oConfig->getJsObject($sType);
  27. $aParams = array_merge(array(
  28. 'sActionUri' => $sBaseUri,
  29. 'sActionUrl' => BX_DOL_URL_ROOT . $sBaseUri,
  30. 'sObjName' => $sJsObject,
  31. 'aHtmlIds' => array(),
  32. 'oRequestParams' => array()
  33. ), $aParams);
  34. $sContent = "var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aParams) . ");";
  35. return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
  36. }
  37. function entryLocation ($iContentId)
  38. {
  39. $oModule = BxDolModule::getInstance($this->MODULE);
  40. $CNF = &$oModule->_oConfig->CNF;
  41. if (empty($CNF['OBJECT_METATAGS']))
  42. return '';
  43. $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
  44. if (!($sLocationString = $oMetatags->locationsString($iContentId)))
  45. return '';
  46. $aVars = array (
  47. 'location' => $sLocationString
  48. );
  49. return $this->parseHtmlByName('entry-location.html', $aVars);
  50. }
  51. }
  52. /** @} */