Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/template-cologne
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (7)
werden angezeigt mit 132 Ergänzungen und 136 Löschungen
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_template-cologne_ajax_countLang', 'package_quiqqer_template-cologne_ajax_countLang',
function () { function () {
$Site = QUI::getRewrite()->getSite(); $Site = QUI::getRewrite()->getSite();
$Project = $Site->getProject(); $Project = $Site->getProject();
return \count($Project->getLanguages()); return count($Project->getLanguages());
} }
); );
...@@ -12,22 +12,21 @@ ...@@ -12,22 +12,21 @@
QUI::$Ajax->registerFunction( QUI::$Ajax->registerFunction(
'package_quiqqer_template-cologne_ajax_getLangList', 'package_quiqqer_template-cologne_ajax_getLangList',
function ($flagFolderPath, $siteId) { function ($flagFolderPath, $siteId) {
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$Project = QUI::getRewrite()->getProject(); $Project = QUI::getRewrite()->getProject();
$Site = $Project->get($siteId); $Site = $Project->get($siteId);
$langs = $Project->getLanguages(); $langs = $Project->getLanguages();
if (count($langs) < 2) { if (count($langs) < 2) {
return ''; return '';
} }
$Engine->assign([ $Engine->assign([
'Site' => $Site, 'Site' => $Site,
'projectLang' => $Project->getLang(), 'projectLang' => $Project->getLang(),
'DefaultCurrency' => QUI\ERP\Currency\Handler::getDefaultCurrency(), 'DefaultCurrency' => QUI\ERP\Currency\Handler::getDefaultCurrency(),
'langs' => $langs, 'langs' => $langs,
'path' => $flagFolderPath 'path' => $flagFolderPath
]); ]);
return QUI\Output::getInstance()->parse($Engine->fetch(dirname(__FILE__) . '/template/LangList.html')); return QUI\Output::getInstance()->parse($Engine->fetch(dirname(__FILE__) . '/template/LangList.html'));
......
{ {
"name": "quiqqer\/template-cologne", "name": "quiqqer/template-cologne",
"type": "quiqqer-template", "type": "quiqqer-template",
"description": "The QUIQQER Cologne E-Commerce Template", "description": "The QUIQQER Cologne E-Commerce Template",
"license": "GPLv3", "license": "GPLv3",
...@@ -7,32 +7,32 @@ ...@@ -7,32 +7,32 @@
{ {
"name": "Henning Leutz", "name": "Henning Leutz",
"email": "support@pcsg.de", "email": "support@pcsg.de",
"homepage": "http:\/\/www.pcsg.de", "homepage": "https://www.pcsg.de",
"role": "Developer" "role": "Developer"
} }
], ],
"support": { "support": {
"email": "support@pcsg.de", "email": "support@pcsg.de",
"url": "http:\/\/www.pcsg.de" "url": "https://www.pcsg.de"
}, },
"require": { "require": {
"php": ">=5.3", "php": "^8.1",
"quiqqer\/quiqqer": "1.*|dev-master|dev-dev", "quiqqer/core": "^2",
"quiqqer\/erp": "^1|^2|^3|dev-master|dev-dev", "quiqqer/erp": "^3",
"quiqqer\/products": "^1.3.1|dev-master|dev-dev", "quiqqer/products": "^2",
"quiqqer\/order": "^1.6|dev-master|dev-dev", "quiqqer/order": "^2",
"quiqqer\/product-bricks": "1.*|dev-master|dev-dev", "quiqqer/product-bricks": "^2",
"quiqqer\/frontend-users": "1.*|dev-master|dev-dev", "quiqqer/frontend-users": "^2",
"quiqqer\/menu": "2.*|dev-master|dev-dev", "quiqqer/menu": "^3",
"quiqqer\/sitetypes": "1.*|dev-master|dev-dev", "quiqqer/sitetypes": "^2",
"quiqqer\/unsemantic": "1.*", "quiqqer/unsemantic": "^2",
"quiqqer-asset\/fastclick": "1.*", "quiqqer-asset/fastclick": "^1",
"quiqqer\/tooltips": "1.*|dev-master|dev-dev", "quiqqer/tooltips": "^2",
"quiqqer\/currency": ">=1.1|*@dev" "quiqqer/currency": "^2"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"QUI\\TemplateCologne\\": "src\/QUI\/TemplateCologne" "QUI\\TemplateCologne\\": "src/QUI/TemplateCologne"
} }
} }
} }
...@@ -18,7 +18,7 @@ class CurrencySwitch extends QUI\Control ...@@ -18,7 +18,7 @@ class CurrencySwitch extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'class' => 'quiqqer-currency-switch', 'class' => 'quiqqer-currency-switch',
...@@ -37,7 +37,7 @@ public function __construct($attributes = []) ...@@ -37,7 +37,7 @@ public function __construct($attributes = [])
* @see \QUI\Control::create() * @see \QUI\Control::create()
* *
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
...@@ -79,9 +79,8 @@ public function getBody() ...@@ -79,9 +79,8 @@ public function getBody()
* Is currency switch allowed? Setting has over currencies number. * Is currency switch allowed? Setting has over currencies number.
* *
* @return bool * @return bool
* @throws QUI\Exception
*/ */
protected function isCurrencySwitchAllowed() protected function isCurrencySwitchAllowed(): bool
{ {
if (!$this->getAttribute('userRelatedCurrency')) { if (!$this->getAttribute('userRelatedCurrency')) {
return false; return false;
......
...@@ -18,13 +18,13 @@ class LangCurrencySwitch extends QUI\Control ...@@ -18,13 +18,13 @@ class LangCurrencySwitch extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'class' => 'lang-currency-switch', 'class' => 'lang-currency-switch',
'data-qui' => 'package/quiqqer/template-cologne/bin/javascript/controls/LangCurrencySwitch', 'data-qui' => 'package/quiqqer/template-cologne/bin/javascript/controls/LangCurrencySwitch',
'userRelatedCurrency' => 1, // 1 / 0 -> is user allowed to change currency? 'userRelatedCurrency' => 1, // 1 / 0 -> is user allowed to change currency?
'flagFolder' => URL_BIN_DIR . '16x16/flags/', 'flagFolder' => URL_BIN_DIR . '16x16/flags/',
]); ]);
$this->addCSSFile(dirname(__FILE__) . '/LangCurrencySwitch.css'); $this->addCSSFile(dirname(__FILE__) . '/LangCurrencySwitch.css');
...@@ -39,19 +39,15 @@ public function __construct($attributes = []) ...@@ -39,19 +39,15 @@ public function __construct($attributes = [])
* @see \QUI\Control::create() * @see \QUI\Control::create()
* *
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite(); $Site = $this->getSite();
$Project = $Site->getProject(); $Project = $Site->getProject();
$Locale = QUI::getLocale(); $Locale = QUI::getLocale();
$flagFolder = $this->getAttribute('flagFolder'); $flagFolder = $this->getAttribute('flagFolder');
$enableChange = false; $enableChange = false;
if (!$Site) {
return '';
}
// is user allowed to change currency? // is user allowed to change currency?
$currencySwitch = false; $currencySwitch = false;
$this->setJavaScriptControlOption('userrelatedcurrency', '0'); $this->setJavaScriptControlOption('userrelatedcurrency', '0');
...@@ -59,7 +55,7 @@ public function getBody() ...@@ -59,7 +55,7 @@ public function getBody()
if ($this->isCurrencySwitchAllowed()) { if ($this->isCurrencySwitchAllowed()) {
try { try {
$Package = QUI::getPackage('quiqqer/erp'); $Package = QUI::getPackage('quiqqer/erp');
$Config = $Package->getConfig(); $Config = $Package->getConfig();
if ($Config->getValue('general', 'userRelatedCurrency')) { if ($Config->getValue('general', 'userRelatedCurrency')) {
$this->setJavaScriptControlOption('userrelatedcurrency', '1'); $this->setJavaScriptControlOption('userrelatedcurrency', '1');
...@@ -93,13 +89,13 @@ public function getBody() ...@@ -93,13 +89,13 @@ public function getBody()
}; };
$Engine->assign([ $Engine->assign([
'this' => $this, 'this' => $this,
'projectLang' => $Project->getLang(), 'projectLang' => $Project->getLang(),
'currencySwitch' => $currencySwitch, 'currencySwitch' => $currencySwitch,
'DefaultCurrency' => $Currency, 'DefaultCurrency' => $Currency,
'flagFolderPath' => $flagFolder, 'flagFolderPath' => $flagFolder,
'imgAltText' => $imgAltText, 'imgAltText' => $imgAltText,
'enableChange' => $enableChange 'enableChange' => $enableChange
]); ]);
return $Engine->fetch(dirname(__FILE__) . '/LangCurrencySwitch.html'); return $Engine->fetch(dirname(__FILE__) . '/LangCurrencySwitch.html');
...@@ -108,10 +104,10 @@ public function getBody() ...@@ -108,10 +104,10 @@ public function getBody()
/** /**
* Return the Project * Return the Project
* *
* @return mixed|QUI\Projects\Site * @return QUI\Interfaces\Projects\Site
* @throws QUI\Exception * @throws QUI\Exception
*/ */
protected function getSite() protected function getSite(): QUI\Interfaces\Projects\Site
{ {
if ($this->getAttribute('Site')) { if ($this->getAttribute('Site')) {
return $this->getAttribute('Site'); return $this->getAttribute('Site');
...@@ -124,11 +120,9 @@ protected function getSite() ...@@ -124,11 +120,9 @@ protected function getSite()
* Is currency switch allowed? Setting has over currencies number. * Is currency switch allowed? Setting has over currencies number.
* *
* @return bool * @return bool
* @throws QUI\Exception
*/ */
protected function isCurrencySwitchAllowed() protected function isCurrencySwitchAllowed(): bool
{ {
if (!$this->getAttribute('userRelatedCurrency')) { if (!$this->getAttribute('userRelatedCurrency')) {
return false; return false;
} }
......
...@@ -18,11 +18,11 @@ class LoginAndRegister extends QUI\Control ...@@ -18,11 +18,11 @@ class LoginAndRegister extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'nodeName' => 'section', 'nodeName' => 'section',
'class' => 'loginAndRegister' 'class' => 'loginAndRegister'
]); ]);
$this->addCSSFile(dirname(__FILE__) . '/LoginAndRegister.css'); $this->addCSSFile(dirname(__FILE__) . '/LoginAndRegister.css');
...@@ -31,18 +31,14 @@ public function __construct($attributes = []) ...@@ -31,18 +31,14 @@ public function __construct($attributes = [])
} }
/** /**
* (non-PHPdoc) * @return string
*
* @throws QUI\Exception
* @see \QUI\Control::create()
*
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Login = new QUI\FrontendUsers\Controls\Login([ $Login = new QUI\FrontendUsers\Controls\Login([
'header' => true, 'header' => true,
'passwordReset' => true 'passwordReset' => true
]); ]);
...@@ -51,7 +47,7 @@ public function getBody() ...@@ -51,7 +47,7 @@ public function getBody()
]); ]);
$Engine->assign([ $Engine->assign([
'Login' => $Login, 'Login' => $Login,
'Registration' => $Registration 'Registration' => $Registration
]); ]);
......
...@@ -3,17 +3,22 @@ ...@@ -3,17 +3,22 @@
/** /**
* This file contains QUI\TemplateCologne\Controls\Menu\Categories * This file contains QUI\TemplateCologne\Controls\Menu\Categories
* *
* Creates an "slide out" menu with product categories. * Creates a "slide out" menu with product categories.
* *
* @author www.pcsg.de (Michael Danielczok) * @author www.pcsg.de (Michael Danielczok)
*/ */
namespace QUI\TemplateCologne\Controls\Menu; namespace QUI\TemplateCologne\Controls\Menu;
use Exception;
use QUI; use QUI;
use QUI\Menu\EventHandler; use QUI\Menu\EventHandler;
use QUI\Projects\Site\Utils; use QUI\Projects\Site\Utils;
use function dirname;
use function md5;
use function serialize;
/** /**
* Class Categories * Class Categories
*/ */
...@@ -24,28 +29,28 @@ class Categories extends QUI\Control ...@@ -24,28 +29,28 @@ class Categories extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'class' => 'quiqqer-categories-menu', 'class' => 'quiqqer-categories-menu',
'startId' => 1, // site id or site link where menu starts by. 1 is start page (first project page) 'startId' => 1, // site id or site link where menu starts by. 1 is start page (first project page)
'template' => \dirname(__FILE__) . '/Categories.html', // nav wrapper 'template' => dirname(__FILE__) . '/Categories.html', // nav wrapper
'menuFile' => \dirname(__FILE__) . '/Categories.Menu.html', // contains children (sites), 'menuFile' => dirname(__FILE__) . '/Categories.Menu.html', // contains children (sites),
'jsControl' => 'package/quiqqer/template-cologne/bin/javascript/controls/Menu/Categories', 'jsControl' => 'package/quiqqer/template-cologne/bin/javascript/controls/Menu/Categories',
'showDescFor' => 'all', // Show category description: all / firstLevel / none 'showDescFor' => 'all', // Show category description: all / firstLevel / none
'showBasketButton' => false 'showBasketButton' => false
]); ]);
$this->addCSSFile(\dirname(__FILE__) . '/Categories.css'); $this->addCSSFile(dirname(__FILE__) . '/Categories.css');
parent::__construct($attributes); parent::__construct($attributes);
} }
/** /**
* @return string * @return string
* @throws QUI\Exception * @throws QUI\Exception|Exception
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Project = $this->getProject(); $Project = $this->getProject();
...@@ -68,14 +73,14 @@ public function getBody() ...@@ -68,14 +73,14 @@ public function getBody()
$cache = EventHandler::menuCacheName() . '/megaMenu/'; $cache = EventHandler::menuCacheName() . '/megaMenu/';
$cache .= \md5( $cache .= md5(
$this->getSite()->getCachePath() . $this->getSite()->getCachePath() .
\serialize($this->getAttributes()) serialize($this->getAttributes())
); );
try { try {
return QUI\Cache\Manager::get($cache); return QUI\Cache\Manager::get($cache);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
} }
$showBasketButton = $this->getAttribute('showBasketButton'); $showBasketButton = $this->getAttribute('showBasketButton');
...@@ -103,9 +108,10 @@ public function getBody() ...@@ -103,9 +108,10 @@ public function getBody()
/** /**
* Return the current site * Return the current site
* *
* @return mixed|QUI\Projects\Site * @return QUI\Interfaces\Projects\Site
* @throws QUI\Exception
*/ */
protected function getSite() protected function getSite(): QUI\Interfaces\Projects\Site
{ {
if ($this->getAttribute('Site')) { if ($this->getAttribute('Site')) {
return $this->getAttribute('Site'); return $this->getAttribute('Site');
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
use QUI; use QUI;
use function class_exists;
use function file_exists;
/** /**
* Class Payments * Class Payments
*/ */
...@@ -23,7 +26,7 @@ class Payments extends QUI\Control ...@@ -23,7 +26,7 @@ class Payments extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'class' => 'quiqqer-payments-control', 'class' => 'quiqqer-payments-control',
...@@ -39,20 +42,16 @@ public function __construct($attributes = []) ...@@ -39,20 +42,16 @@ public function __construct($attributes = [])
} }
/** /**
* (non-PHPdoc) * @return string
*
* @throws QUI\Exception
* @see \QUI\Control::create()
*
*/ */
public function getBody() public function getBody(): string
{ {
if (!\class_exists('\QUI\ERP\Accounting\Payments\Payments')) { if (!class_exists('\QUI\ERP\Accounting\Payments\Payments')) {
return ''; return '';
} }
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Payments = \QUI\ERP\Accounting\Payments\Payments::getInstance(); $Payments = QUI\ERP\Accounting\Payments\Payments::getInstance();
$payments = $Payments->getpayments(); $payments = $Payments->getpayments();
if (count($payments) < 1) { if (count($payments) < 1) {
...@@ -70,8 +69,8 @@ public function getBody() ...@@ -70,8 +69,8 @@ public function getBody()
$customTemplate = $this->getAttribute('customTemplate'); $customTemplate = $this->getAttribute('customTemplate');
$customCss = $this->getAttribute('customCss'); $customCss = $this->getAttribute('customCss');
if ($customTemplate && \file_exists($customTemplate)) { if ($customTemplate && file_exists($customTemplate)) {
if ($customCss && \file_exists($customCss)) { if ($customCss && file_exists($customCss)) {
$this->addCSSFile($this->getAttribute('customCss')); $this->addCSSFile($this->getAttribute('customCss'));
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
namespace QUI\TemplateCologne\Controls; namespace QUI\TemplateCologne\Controls;
use Exception;
use QUI; use QUI;
use QUI\ERP\Products\Handler\Fields; use QUI\ERP\Products\Handler\Fields;
...@@ -22,7 +23,7 @@ class ProductGallery extends QUI\Control ...@@ -22,7 +23,7 @@ class ProductGallery extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'Product' => false 'Product' => false
...@@ -32,13 +33,10 @@ public function __construct($attributes = []) ...@@ -32,13 +33,10 @@ public function __construct($attributes = [])
} }
/** /**
* (non-PHPdoc) * @return string
* * @throws Exception
* @throws QUI\Exception
* @see \QUI\Control::create()
*
*/ */
public function getBody() public function getBody(): string
{ {
if (!$this->getAttribute('Product')) { if (!$this->getAttribute('Product')) {
return ''; return '';
...@@ -69,7 +67,7 @@ public function getBody() ...@@ -69,7 +67,7 @@ public function getBody()
try { try {
$Gallery->setAttribute('folderId', $Product->getFieldValue(Fields::FIELD_FOLDER)); $Gallery->setAttribute('folderId', $Product->getFieldValue(Fields::FIELD_FOLDER));
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
} }
if ($typeVariantParent || $typeVariantChild) { if ($typeVariantParent || $typeVariantChild) {
...@@ -132,7 +130,7 @@ protected function getVariantImages(QUI\ERP\Products\Product\Product $Product): ...@@ -132,7 +130,7 @@ protected function getVariantImages(QUI\ERP\Products\Product\Product $Product):
if (!$hasMainImage) { if (!$hasMainImage) {
$images[] = $MainImage; $images[] = $MainImage;
} }
} catch (\Exception $Exception) { } catch (Exception $Exception) {
QUI\System\Log::writeDebugException($Exception); QUI\System\Log::writeDebugException($Exception);
$mainImageId = false; $mainImageId = false;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace QUI\TemplateCologne\Controls; namespace QUI\TemplateCologne\Controls;
use QUI; use QUI;
use QUI\Database\Exception;
/** /**
* Class ProductGallery * Class ProductGallery
...@@ -18,7 +19,7 @@ class SimpleUserInfo extends QUI\Control ...@@ -18,7 +19,7 @@ class SimpleUserInfo extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
$this->setAttributes([ $this->setAttributes([
'User' => null 'User' => null
...@@ -35,7 +36,7 @@ public function __construct($attributes = []) ...@@ -35,7 +36,7 @@ public function __construct($attributes = [])
* @throws QUI\Exception * @throws QUI\Exception
* @see \QUI\Control::create() * @see \QUI\Control::create()
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$User = $this->getUser(); $User = $this->getUser();
...@@ -62,7 +63,7 @@ public function getBody() ...@@ -62,7 +63,7 @@ public function getBody()
* @return QUI\Interfaces\Users\User * @return QUI\Interfaces\Users\User
* @throws QUI\FrontendUsers\Exception * @throws QUI\FrontendUsers\Exception
*/ */
public function getUser() public function getUser(): QUI\Interfaces\Users\User
{ {
$User = $this->getAttribute('User'); $User = $this->getAttribute('User');
...@@ -83,10 +84,10 @@ public function getUser() ...@@ -83,10 +84,10 @@ public function getUser()
/** /**
* Return the current site * Return the current site
* *
* @return QUI\Projects\Site * @return QUI\Interfaces\Projects\Site
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public function getSite() public function getSite(): QUI\Interfaces\Projects\Site
{ {
if ($this->getAttribute('Site')) { if ($this->getAttribute('Site')) {
return $this->getAttribute('Site'); return $this->getAttribute('Site');
...@@ -101,8 +102,9 @@ public function getSite() ...@@ -101,8 +102,9 @@ public function getSite()
* @param $User QUI\Interfaces\Users\User * @param $User QUI\Interfaces\Users\User
* *
* @return int * @return int
* @throws Exception
*/ */
public function getOrdersNumber($User) public function getOrdersNumber(QUI\Interfaces\Users\User $User): int
{ {
$Orders = QUI\ERP\Order\Handler::getInstance(); $Orders = QUI\ERP\Order\Handler::getInstance();
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace QUI\TemplateCologne; namespace QUI\TemplateCologne;
use QUI; use QUI;
use QUI\ERP\Products\Product\ViewFrontend;
use QUI\Smarty\Collector;
/** /**
* Event Class * Event Class
...@@ -20,13 +22,9 @@ class EventHandler ...@@ -20,13 +22,9 @@ class EventHandler
* *
* @return void * @return void
*/ */
public static function onProjectConfigSave() public static function onProjectConfigSave(): void
{ {
try { QUI\Cache\Manager::clear('quiqqer/templateCologne');
QUI\Cache\Manager::clear('quiqqer/templateCologne');
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
} }
/** /**
...@@ -34,25 +32,21 @@ public static function onProjectConfigSave() ...@@ -34,25 +32,21 @@ public static function onProjectConfigSave()
* *
* @return void * @return void
*/ */
public static function onSiteSave() public static function onSiteSave(): void
{ {
try { QUI\Cache\Manager::clear('quiqqer/templateCologne');
QUI\Cache\Manager::clear('quiqqer/templateCologne');
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
} }
/** /**
* @param \Quiqqer\Engine\Collector $Collector * @param Collector $Collector
* @param QUI\ERP\Products\Product\ViewFrontend $Product * @param ViewFrontend $Product
* *
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public static function onQuiqqerProductsProductButtonsEnd( public static function onQuiqqerProductsProductButtonsEnd(
\Quiqqer\Engine\Collector $Collector, QUI\Smarty\Collector $Collector,
\QUI\ERP\Products\Product\ViewFrontend $Product ViewFrontend $Product
) { ): void {
// setting // setting
$Project = QUI::getRewrite()->getProject(); $Project = QUI::getRewrite()->getProject();
......
...@@ -7,8 +7,16 @@ ...@@ -7,8 +7,16 @@
namespace QUI\TemplateCologne; namespace QUI\TemplateCologne;
use QUI; use QUI;
use QUI\Database\Exception;
use QUI\ERP\Shipping\Shipping; use QUI\ERP\Shipping\Shipping;
use QUI\ERP\StockManagement\StockManager; use QUI\ERP\StockManagement\StockManager;
use QUI\Projects\Project;
use QUI\Projects\Site;
use QUI\TemplateCologne\Controls\Payments;
use function class_exists;
use function count;
use function method_exists;
/** /**
* Class Utils * Class Utils
...@@ -24,7 +32,7 @@ class Utils ...@@ -24,7 +32,7 @@ class Utils
* @throws QUI\Exception * @throws QUI\Exception
* *
*/ */
public static function getAvatar($User) public static function getAvatar(mixed $User): QUI\Projects\Media\Image|bool
{ {
if (!$User instanceof QUI\Interfaces\Users\User) { if (!$User instanceof QUI\Interfaces\Users\User) {
throw new QUI\Exception([ throw new QUI\Exception([
...@@ -38,7 +46,7 @@ public static function getAvatar($User) ...@@ -38,7 +46,7 @@ public static function getAvatar($User)
$result = QUI::getEvents()->fireEvent('userGetAvatar', [$User]); $result = QUI::getEvents()->fireEvent('userGetAvatar', [$User]);
foreach ($result as $Entry) { foreach ($result as $Entry) {
if ($Entry instanceof QUI\Interfaces\Projects\Media\File) { if ($Entry instanceof QUI\Projects\Media\Image) {
return $Entry; return $Entry;
} }
} }
...@@ -51,7 +59,7 @@ public static function getAvatar($User) ...@@ -51,7 +59,7 @@ public static function getAvatar($User)
try { try {
return QUI\Projects\Media\Utils::getImageByUrl($avatar); return QUI\Projects\Media\Utils::getImageByUrl($avatar);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
} }
return false; return false;
...@@ -60,17 +68,17 @@ public static function getAvatar($User) ...@@ -60,17 +68,17 @@ public static function getAvatar($User)
/** /**
* Returns config. If a cache exists, it will be returned. * Returns config. If a cache exists, it will be returned.
* *
* @param $params * @param array $params
* *
* @return array|bool|object|string * @return array|bool|object|string
* @throws QUI\Exception * @throws QUI\Exception
*/ */
public static function getConfig($params) public static function getConfig(array $params): object|array|bool|string
{ {
/** @var $Site \QUI\Projects\Site */ /** @var $Site Site */
$Site = $params['Site']; $Site = $params['Site'];
/* @var $Project QUI\Projects\Project */ /* @var $Project Project */
$Project = $params['Project']; $Project = $params['Project'];
/* @var $Project QUI\Template */ /* @var $Project QUI\Template */
...@@ -370,11 +378,12 @@ public static function getConfig($params) ...@@ -370,11 +378,12 @@ public static function getConfig($params)
/** /**
* Returns data for predefined footer if enabled. * Returns data for predefined footer if enabled.
* *
* @param \QUI\Projects\Project $Project * @param Project $Project
* *
* @return array - data for predefined footer * @return array - data for predefined footer
* @throws Exception
*/ */
private static function getPredefinedFooter($Project) private static function getPredefinedFooter(Project $Project): array
{ {
$lang = $Project->getLang(); $lang = $Project->getLang();
...@@ -552,9 +561,9 @@ private static function getPredefinedFooter($Project) ...@@ -552,9 +561,9 @@ private static function getPredefinedFooter($Project)
if ( if (
$Project->getConfig('templateCologne.settings.predefinedFooter.payments') $Project->getConfig('templateCologne.settings.predefinedFooter.payments')
&& \class_exists('\QUI\ERP\Accounting\Payments\Payments') && class_exists('\QUI\ERP\Accounting\Payments\Payments')
) { ) {
$PaymentsControl = new \QUI\TemplateCologne\Controls\Payments([ $PaymentsControl = new Payments([
'template' => $Project->getConfig('templateCologne.settings.predefinedFooter.payments.layout') 'template' => $Project->getConfig('templateCologne.settings.predefinedFooter.payments.layout')
]); ]);
...@@ -662,7 +671,7 @@ public static function getStockFrontendView(int $productId) ...@@ -662,7 +671,7 @@ public static function getStockFrontendView(int $productId)
/** @var QUI\ERP\StockManagement\Products\Fields\StockView $StockView */ /** @var QUI\ERP\StockManagement\Products\Fields\StockView $StockView */
$StockView = $StockField->getFrontendView(); $StockView = $StockField->getFrontendView();
if (\method_exists($StockView, 'setProduct')) { if (method_exists($StockView, 'setProduct')) {
$StockView->setProduct($Product); $StockView->setProduct($Product);
} }
...@@ -676,9 +685,9 @@ public static function getStockFrontendView(int $productId) ...@@ -676,9 +685,9 @@ public static function getStockFrontendView(int $productId)
* *
* @return string * @return string
*/ */
public static function convertBrickCSSClass(array $classes) public static function convertBrickCSSClass(array $classes): string
{ {
if (\count($classes) < 1) { if (count($classes) < 1) {
return ''; return '';
} }
......