[Changed] engine handler

adjust it for twit ( no safe changes! )
This commit is contained in:
MaxBuhe01 2024-09-02 22:58:49 +02:00
parent ce05a811a9
commit 8392de0566
2 changed files with 16 additions and 15 deletions

View File

@ -38,7 +38,7 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
public $filenameExtension = 'pdf'; public $filenameExtension = 'pdf';
/** @var Smarty */ /** @var Smarty */
public $oSmarty; public $oTemplateEngine;
/** @var string */ /** @var string */
public $filename; public $filename;
@ -55,7 +55,8 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
->get(TemplateRendererBridgeInterface::class) ->get(TemplateRendererBridgeInterface::class)
->getTemplateRenderer(); ->getTemplateRenderer();
$this->oSmarty = $oTemplateRenderer->getTemplateEngine()->getSmarty(); //ToDo: hier nochmal prüfen, wie das mit smarty aussieht!
$this->oTemplateEngine = $oTemplateRenderer->getTemplateEngine();
} }
public function runPreAction() public function runPreAction()
@ -161,15 +162,15 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
/** /**
* @param int $iSelLang * @param int $iSelLang
*/ */
public function setSmartyVars($iSelLang) public function setTemplateEngineVars($iSelLang)
{ {
unset($iSelLang); unset($iSelLang);
$this->oSmarty->assign('config', Registry::getConfig()); $this->oTemplateEngine->addGlobal('config', Registry::getConfig());
$this->oSmarty->assign('viewConfig', Registry::getConfig()->getActiveView()->getViewConfig()); $this->oTemplateEngine->addGlobal('viewConfig', Registry::getConfig()->getActiveView()->getViewConfig());
$this->oSmarty->assign('shop', Registry::getConfig()->getActiveShop()); $this->oTemplateEngine->addGlobal('shop', Registry::getConfig()->getActiveShop());
$this->oSmarty->assign('lang', Registry::getLang()); $this->oTemplateEngine->addGlobal('lang', Registry::getLang());
$this->oSmarty->assign('document', $this); $this->oTemplateEngine->addGlobal('document', $this);
} }
/** /**
@ -188,9 +189,9 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
$currTplLang = $lang->getTplLanguage(); $currTplLang = $lang->getTplLanguage();
$lang->setTplLanguage($iSelLang); $lang->setTplLanguage($iSelLang);
$this->setSmartyVars($iSelLang); $this->setTemplateEngineVars($iSelLang);
$content = $this->oSmarty->fetch($this->getTemplate()); $content = $this->oTemplateEngine->render($this->getTemplate());
$lang->setTplLanguage($currTplLang); $lang->setTplLanguage($currTplLang);

View File

@ -57,19 +57,19 @@ abstract class pdfdocumentsOrder extends pdfdocumentsGeneric implements orderInt
* @param int $iSelLang * @param int $iSelLang
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function setSmartyVars($iSelLang) public function setTemplateEngineVars($iSelLang)
{ {
parent::setSmartyVars($iSelLang); parent::setTemplateEngineVars($iSelLang);
$this->oSmarty->assign('order', $this->getOrder()); $this->oTemplateEngine->addGlobal('order', $this->getOrder());
$oUser = oxNew(User::Class); $oUser = oxNew(User::Class);
$oUser->load($this->getOrder()->getFieldData('oxuserid')); $oUser->load($this->getOrder()->getFieldData('oxuserid'));
$this->oSmarty->assign('user', $oUser); $this->oTemplateEngine->addGlobal('user', $oUser);
$oPayment = oxNew(Payment::class); $oPayment = oxNew(Payment::class);
$oPayment->loadInLang($iSelLang, $this->getOrder()->getFieldData('oxpaymenttype')); $oPayment->loadInLang($iSelLang, $this->getOrder()->getFieldData('oxpaymenttype'));
$this->oSmarty->assign('payment', $oPayment); $this->oTemplateEngine->addGlobal('payment', $oPayment);
} }
/** /**