| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- /**
- * @package Dolphin Core
- * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
- * @license CC-BY - http://creativecommons.org/licenses/by/3.0/
- */
- defined('BX_DOL') or die('hack attempt');
- bx_import('BxDolTemplate');
- class BxDolModuleTemplate extends BxDolTemplate {
- var $_oDb;
- var $_oConfig;
- var $_bObStarted = 0;
- /*
- * Constructor.
- */
- function BxDolModuleTemplate(&$oConfig, &$oDb, $sRootPath = BX_DIRECTORY_PATH_ROOT, $sRootUrl = BX_DOL_URL_ROOT) {
- parent::__construct($sRootPath, $sRootUrl);
- $this->_oDb = &$oDb;
- $this->_oConfig = &$oConfig;
- $sName = $oConfig->getName();
- $sHomePath = $oConfig->getHomePath();
- $sHomeUrl = $oConfig->getHomeUrl();
- $this->addLocation($sName, $sHomePath, $sHomeUrl);
- $this->addLocationJs($sName, $sHomePath . 'js/', $sHomeUrl . 'js/');
- }
- function addCss($mixedFiles, $bDynamic = false) {
- return $this->_addFiles(BxDolTemplate::getInstance(), 'addCss', 'addLocation', 'removeLocation', '', $mixedFiles, $bDynamic, true);
- }
- function addJs($mixedFiles, $bDynamic = false) {
- return $this->_addFiles(BxDolTemplate::getInstance(), 'addJs', 'addLocationJs', 'removeLocationJs', 'js/', $mixedFiles, $bDynamic, true);
- }
- function addJsTranslation($mixedKey) {
- BxDolTemplate::getInstance()->addJsTranslation($mixedKey);
- }
- function addStudioCss($mixedFiles, $bDynamic = false, $bSearchInModule = true) {
- bx_import('BxDolStudioTemplate');
- return $this->_addFiles(BxDolStudioTemplate::getInstance(), 'addCss', 'addLocation', 'removeLocation', '', $mixedFiles, $bDynamic, $bSearchInModule);
- }
- function addStudioJs($mixedFiles, $bDynamic = false, $bSearchInModule = true) {
- bx_import('BxDolStudioTemplate');
- return $this->_addFiles(BxDolStudioTemplate::getInstance(), 'addJs', 'addLocationJs', 'removeLocationJs', 'js/', $mixedFiles, $bDynamic, $bSearchInModule);
- }
- function _addFiles($oTemplate, $sFuncAddFiles, $sFuncAddLocation, $sFuncRemoveLocation, $sPath, $mixedFiles, $bDynamic = false, $bSearchInModule = true) {
- $sLocationKey = $bSearchInModule ? $oTemplate->$sFuncAddLocation($this->_oConfig->getUri(), $this->_oConfig->getHomePath() . $sPath, $this->_oConfig->getHomeUrl() . $sPath) : '';
- $mixedResult = $oTemplate->$sFuncAddFiles($mixedFiles, $bDynamic);
- if($sLocationKey != '')
- $oTemplate->$sFuncRemoveLocation($sLocationKey);
- return $mixedResult;
- }
- function addStudioInjection($sKey, $sType, $sData, $iReplace = 0) {
- bx_import('BxDolStudioTemplate');
- BxDolStudioTemplate::getInstance()->aPage['injections']['page_0'][$sKey][] = array(
- 'page_index' => 0,
- 'key' => $sKey,
- 'type' => $sType,
- 'data' => $sData,
- 'replace' => $iReplace
- );
- }
- function pageStart () {
- if (0 == $this->_bObStarted) {
- ob_start ();
- $this->_bObStarted = 1;
- }
- }
- function pageEnd ($isGetContent = true) {
- if (1 == $this->_bObStarted) {
- $sRet = '';
- if ($isGetContent)
- $sRet = ob_get_clean();
- else
- ob_end_clean();
- $this->_bObStarted = 0;
- return $sRet;
- }
- }
- }
|