add template block overloadable company logo
This commit is contained in:
parent
beaa79c0e9
commit
d89b00843f
@ -187,37 +187,12 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
|||||||
unset($iSelLang);
|
unset($iSelLang);
|
||||||
|
|
||||||
$this->oTemplateEngine->addGlobal('config', Registry::getConfig());
|
$this->oTemplateEngine->addGlobal('config', Registry::getConfig());
|
||||||
$this->oTemplateEngine->addGlobal('sAlternativePdfLogo', $this->getAlternativePdfLogoFileName());
|
|
||||||
$this->oTemplateEngine->addGlobal('oViewConf', Registry::getConfig()->getActiveView()->getViewConfig());
|
$this->oTemplateEngine->addGlobal('oViewConf', Registry::getConfig()->getActiveView()->getViewConfig());
|
||||||
$this->oTemplateEngine->addGlobal('shop', Registry::getConfig()->getActiveShop());
|
$this->oTemplateEngine->addGlobal('shop', Registry::getConfig()->getActiveShop());
|
||||||
$this->oTemplateEngine->addGlobal('lang', Registry::getLang());
|
$this->oTemplateEngine->addGlobal('lang', Registry::getLang());
|
||||||
$this->oTemplateEngine->addGlobal('document', $this);
|
$this->oTemplateEngine->addGlobal('document', $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAlternativePdfLogoFileName() :string
|
|
||||||
{
|
|
||||||
$sStandardLogoFile = 'pdf_logo.jpg';
|
|
||||||
$oViewConf = Registry::getConfig()->getActiveView()->getViewConfig();
|
|
||||||
$moduleSettingService = ContainerFacade::get(ModuleSettingServiceInterface::class);
|
|
||||||
$sAlternativePdfLogoName = $moduleSettingService->getString(Constants::OXID_MODULE_ID."_sAlternativePdfLogoName", Constants::OXID_MODULE_ID);
|
|
||||||
|
|
||||||
$sAlternativePdfLogoName = trim($sAlternativePdfLogoName) ?: $sStandardLogoFile;
|
|
||||||
|
|
||||||
$bAlternativeFileExists = file_exists(Registry::getConfig()->getImagePath($sAlternativePdfLogoName));
|
|
||||||
$bFileExists = file_exists(Registry::getConfig()->getImagePath($sStandardLogoFile));
|
|
||||||
|
|
||||||
return $bAlternativeFileExists
|
|
||||||
? $oViewConf->getImageUrl($sAlternativePdfLogoName, true)
|
|
||||||
: (
|
|
||||||
$bFileExists
|
|
||||||
? $oViewConf->getImageUrl($sStandardLogoFile, true)
|
|
||||||
: ""
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $iSelLang
|
* @param int $iSelLang
|
||||||
*
|
*
|
||||||
|
@ -8,16 +8,14 @@
|
|||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
|
|
||||||
$sLangName = "Deutsch";
|
$sLangName = "Deutsch";
|
||||||
$aLang = array(
|
$aLang = array(
|
||||||
'charset' => 'utf-8',
|
'charset' => 'utf-8',
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName' => 'Alternativer PDF-Logo Name<br><br>
|
|
||||||
Ohne Angabe ( leer ) wird <u style="color: orangered">automatisch</u> folgender Datei-Name gewählt: <b>pdf_logo.jpg</b><br>
|
|
||||||
Diese Datei muss sich im <b>source/out/THEME/img/</b> Ordner befinden <b>und muss aus technischen Gründen PNG/ JPG sein</b>.<br><br>
|
|
||||||
<u>Notfalls wird kein Bild eingefügt!</u>',
|
|
||||||
|
|
||||||
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
||||||
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
||||||
|
@ -8,16 +8,14 @@
|
|||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
|
|
||||||
$sLangName = "English";
|
$sLangName = "English";
|
||||||
$aLang = array(
|
$aLang = array(
|
||||||
'charset' => 'utf-8',
|
'charset' => 'utf-8',
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName' => 'Alternative PDF Logo Name<br><br>
|
|
||||||
Without specification (empty) the following file name will be <u style="color: orangered">automatically</u> selected: <b>pdf_logo.jpg</b><br>
|
|
||||||
This file must be located in the <b>source/out/THEME/img/</b> folder <b>and must be PNG or JPG for technical reasons</b>.<br><br>
|
|
||||||
<u>If necessary, no image will be inserted!</u>',
|
|
||||||
|
|
||||||
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
||||||
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
||||||
|
@ -15,11 +15,7 @@ $aLang = array(
|
|||||||
'charset' => 'utf-8',
|
'charset' => 'utf-8',
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName' => 'Alternativer PDF-Logo Name<br><br>
|
|
||||||
Ohne Angabe ( leer ) wird <u style="color: orangered">automatisch</u> folgender Datei-Name gewählt: <b>pdf_logo.jpg</b><br>
|
|
||||||
Diese Datei muss sich im <b>source/out/THEME/img/</b> Ordner befinden <b>und muss aus technischen Gründen PNG oder JPG sein</b>.<br><br>
|
|
||||||
<u>Notfalls wird kein Bild eingefügt!</u>',
|
|
||||||
|
|
||||||
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
||||||
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
||||||
|
@ -8,16 +8,14 @@
|
|||||||
* @link http://www.oxidmodule.com
|
* @link http://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use D3\PdfDocuments\Application\Model\Constants;
|
||||||
|
|
||||||
$sLangName = "English";
|
$sLangName = "English";
|
||||||
$aLang = array(
|
$aLang = array(
|
||||||
'charset' => 'utf-8',
|
'charset' => 'utf-8',
|
||||||
|
|
||||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
||||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName' => 'Alternative PDF Logo Name<br><br>
|
|
||||||
Without specification (empty) the following file name will be <u style="color: orangered">automatically</u> selected: <b>pdf_logo.jpg</b><br>
|
|
||||||
This file must be located in the <b>source/out/THEME/img/</b> folder <b>and must be PNG/ JPG for technical reasons</b>.<br><br>
|
|
||||||
<u>If necessary, no image will be inserted!</u>',
|
|
||||||
|
|
||||||
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
||||||
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
||||||
|
@ -38,7 +38,8 @@ Detailed installation instructions can be found [online](https://docs.oxidmodule
|
|||||||
|
|
||||||
## Credits:
|
## Credits:
|
||||||
|
|
||||||
- PDF logo made by Dimitriy Morilubov from www.flaticon.com
|
- PDF logo made by Dimitriy Morilubov by www.flaticon.com
|
||||||
|
- example company logo by https://www.logologo.com/
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ Eine detaillierte Installationsanleitung finden Sie [online](https://docs.oxidmo
|
|||||||
## Danksagung:
|
## Danksagung:
|
||||||
|
|
||||||
- PDF-Logo erstellt von Dimitriy Morilubov von www.flaticon.com
|
- PDF-Logo erstellt von Dimitriy Morilubov von www.flaticon.com
|
||||||
|
- Beispielfirmenlogo von https://www.logologo.com/
|
||||||
|
|
||||||
## Lizenz
|
## Lizenz
|
||||||
|
|
||||||
|
BIN
assets/out/img/clogo.jpg
Normal file
BIN
assets/out/img/clogo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
@ -92,12 +92,6 @@ $aModule = [
|
|||||||
'name' => Constants::OXID_MODULE_ID.'bDev',
|
'name' => Constants::OXID_MODULE_ID.'bDev',
|
||||||
'type' => 'bool',
|
'type' => 'bool',
|
||||||
'value' => false
|
'value' => false
|
||||||
],
|
|
||||||
[
|
|
||||||
'group' => Constants::OXID_MODULE_ID.'main',
|
|
||||||
'name' => Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName',
|
|
||||||
'type' => 'str',
|
|
||||||
'value' => ''
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
[{block name="pdfHeader"}]
|
[{block name="pdfHeader"}]
|
||||||
<div class="header">
|
<div class="header">
|
||||||
[{if $showLogo}]
|
[{if $showLogo}]
|
||||||
[{* pdf logo is available only in non admin theme *}]
|
[{block name="pdfHeaderLogo"}]
|
||||||
[{assign var="isAdmin" value=$viewConfig->isAdmin()}]
|
<img class="logo" alt="Logo" src="[{$oViewConf->getModulePath('d3PdfDocuments', 'out/img/clogo.jpg')}]">
|
||||||
[{$viewConfig->setAdminMode(false)}]
|
[{/block}]
|
||||||
<img class="logo" alt="Logo" src="[{$viewConfig->getImageUrl('pdf_logo.jpg')}]">
|
|
||||||
[{$viewConfig->setAdminMode($isAdmin)}]
|
|
||||||
[{/if}]
|
[{/if}]
|
||||||
</div>
|
</div>
|
||||||
[{/block}]
|
[{/block}]
|
@ -1,16 +1,11 @@
|
|||||||
{% set showLogo = showLogo|default(1) %}
|
{% set showLogo = showLogo|default(1) %}
|
||||||
{% set sPdfLogo = sAlternativePdfLogo %}
|
|
||||||
|
|
||||||
{% block pdfHeader %}
|
{% block pdfHeader %}
|
||||||
<div class="header">
|
<div class="header">
|
||||||
{% if showLogo %}
|
{% if showLogo %}
|
||||||
{# pdf logo is available only in non admin theme #}
|
{% block pdfHeaderLogo %}
|
||||||
{% set isAdmin = oViewConf.isAdmin() %}
|
<img class="logo" alt="Logo" src="{{ oViewConf.getModulePath('d3PdfDocuments', 'out/img/clogo.jpg') }}">
|
||||||
{{ oViewConf.setAdminMode(false) }}
|
{% endblock %}
|
||||||
{% if sPdfLogo %}
|
|
||||||
<img class="logo" alt="Logo" src="{{ sPdfLogo }}">
|
|
||||||
{% endif %}
|
|
||||||
{{ oViewConf.setAdminMode(isAdmin) }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user