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);
|
||||
|
||||
$this->oTemplateEngine->addGlobal('config', Registry::getConfig());
|
||||
$this->oTemplateEngine->addGlobal('sAlternativePdfLogo', $this->getAlternativePdfLogoFileName());
|
||||
$this->oTemplateEngine->addGlobal('oViewConf', Registry::getConfig()->getActiveView()->getViewConfig());
|
||||
$this->oTemplateEngine->addGlobal('shop', Registry::getConfig()->getActiveShop());
|
||||
$this->oTemplateEngine->addGlobal('lang', Registry::getLang());
|
||||
$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
|
||||
*
|
||||
|
@ -8,16 +8,14 @@
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
use D3\PdfDocuments\Application\Model\Constants;
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
$aLang = array(
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||
'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>',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
||||
|
@ -8,16 +8,14 @@
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
use D3\PdfDocuments\Application\Model\Constants;
|
||||
|
||||
$sLangName = "English";
|
||||
$aLang = array(
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
||||
'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>',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
||||
|
@ -15,11 +15,7 @@ $aLang = array(
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||
'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>',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
|
||||
|
@ -8,16 +8,14 @@
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
use D3\PdfDocuments\Application\Model\Constants;
|
||||
|
||||
$sLangName = "English";
|
||||
$aLang = array(
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
|
||||
'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>',
|
||||
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
|
||||
|
||||
'D3_PDFDOCUMENTS' => 'PDF Documents',
|
||||
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
|
||||
|
@ -38,7 +38,8 @@ Detailed installation instructions can be found [online](https://docs.oxidmodule
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -39,6 +39,7 @@ Eine detaillierte Installationsanleitung finden Sie [online](https://docs.oxidmo
|
||||
## Danksagung:
|
||||
|
||||
- PDF-Logo erstellt von Dimitriy Morilubov von www.flaticon.com
|
||||
- Beispielfirmenlogo von https://www.logologo.com/
|
||||
|
||||
## 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',
|
||||
'type' => 'bool',
|
||||
'value' => false
|
||||
],
|
||||
[
|
||||
'group' => Constants::OXID_MODULE_ID.'main',
|
||||
'name' => Constants::OXID_MODULE_ID.'_sAlternativePdfLogoName',
|
||||
'type' => 'str',
|
||||
'value' => ''
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -3,11 +3,9 @@
|
||||
[{block name="pdfHeader"}]
|
||||
<div class="header">
|
||||
[{if $showLogo}]
|
||||
[{* pdf logo is available only in non admin theme *}]
|
||||
[{assign var="isAdmin" value=$viewConfig->isAdmin()}]
|
||||
[{$viewConfig->setAdminMode(false)}]
|
||||
<img class="logo" alt="Logo" src="[{$viewConfig->getImageUrl('pdf_logo.jpg')}]">
|
||||
[{$viewConfig->setAdminMode($isAdmin)}]
|
||||
[{block name="pdfHeaderLogo"}]
|
||||
<img class="logo" alt="Logo" src="[{$oViewConf->getModulePath('d3PdfDocuments', 'out/img/clogo.jpg')}]">
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
</div>
|
||||
[{/block}]
|
@ -1,16 +1,11 @@
|
||||
{% set showLogo = showLogo|default(1) %}
|
||||
{% set sPdfLogo = sAlternativePdfLogo %}
|
||||
|
||||
{% block pdfHeader %}
|
||||
<div class="header">
|
||||
{% if showLogo %}
|
||||
{# pdf logo is available only in non admin theme #}
|
||||
{% set isAdmin = oViewConf.isAdmin() %}
|
||||
{{ oViewConf.setAdminMode(false) }}
|
||||
{% if sPdfLogo %}
|
||||
<img class="logo" alt="Logo" src="{{ sPdfLogo }}">
|
||||
{% endif %}
|
||||
{{ oViewConf.setAdminMode(isAdmin) }}
|
||||
{% block pdfHeaderLogo %}
|
||||
<img class="logo" alt="Logo" src="{{ oViewConf.getModulePath('d3PdfDocuments', 'out/img/clogo.jpg') }}">
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user