Skip to content
Code-Schnipsel Gruppen Projekte
Commit 111b6752 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'dev' into 'next'

feat!: quiqqer v2

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