mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-01-11 16:48:42 +00:00
Automated formatting changes
This commit is contained in:
parent
1fcd3a75f6
commit
715d53ac61
|
|
@ -84,8 +84,8 @@ final class ApiController extends Controller
|
|||
{
|
||||
/** @var \Modules\Exchange\Models\InterfaceManager $interface */
|
||||
$interface = InterfaceManagerMapper::get($request->getData('id'));
|
||||
$class = '\\Modules\\Exchange\\Interfaces\\' . $interface->getInterfacePath() . '\\Importer';
|
||||
$importer = new $class($this->app->dbPool->get());
|
||||
$class = '\\Modules\\Exchange\\Interfaces\\' . $interface->getInterfacePath() . '\\Importer';
|
||||
$importer = new $class($this->app->dbPool->get());
|
||||
|
||||
return $importer->importFromRequest($request);
|
||||
}
|
||||
|
|
@ -209,8 +209,8 @@ final class ApiController extends Controller
|
|||
{
|
||||
/** @var \Modules\Exchange\Models\InterfaceManager $interface */
|
||||
$interface = InterfaceManagerMapper::get($request->getData('id'));
|
||||
$class = '\\Modules\\Exchange\\Interfaces\\' . $interface->getInterfacePath() . '\\Exporter';
|
||||
$exporter = new $class($this->app->dbPool->get());
|
||||
$class = '\\Modules\\Exchange\\Interfaces\\' . $interface->getInterfacePath() . '\\Exporter';
|
||||
$exporter = new $class($this->app->dbPool->get());
|
||||
|
||||
return $exporter->exportFromRequest($request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Exchange\Controller;
|
||||
|
||||
use Modules\Exchange\Models\ExchangeLogMapper;
|
||||
use Modules\Exchange\Models\InterfaceManagerMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use Modules\Exchange\Models\ExchangeLogMapper;
|
||||
|
||||
/**
|
||||
* Exchange controller class.
|
||||
|
|
|
|||
|
|
@ -16,16 +16,9 @@ namespace Modules\Exchange\Interfaces\OMS;
|
|||
|
||||
use Modules\Exchange\Models\ExchangeLog;
|
||||
use Modules\Exchange\Models\ExchangeType;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
use phpOMS\Utils\IO\Zip\Zip;
|
||||
use Modules\Exchange\Models\ExporterAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Utils\StringUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -88,11 +81,11 @@ final class Exporter extends ExporterAbstract
|
|||
if ($request->getData('type') === 'language') {
|
||||
$result = $this->exportLanguage();
|
||||
|
||||
$log = new ExchangeLog();
|
||||
$log = new ExchangeLog();
|
||||
$log->createdBy = $this->account;
|
||||
$log->setType(ExchangeType::EXPORT);
|
||||
$log->message = 'Language file exported.'; // @todo: localize!
|
||||
$log->subtype = 'language';
|
||||
$log->message = 'Language file exported.'; // @todo: localize!
|
||||
$log->subtype = 'language';
|
||||
$log->exchange = (int) $request->getData('id');
|
||||
|
||||
$result['logs'][] = $log;
|
||||
|
|
@ -110,11 +103,11 @@ final class Exporter extends ExporterAbstract
|
|||
*/
|
||||
public function exportLanguage() : array
|
||||
{
|
||||
$languageArray = [];
|
||||
$languageArray = [];
|
||||
$supportedLanguages = [];
|
||||
|
||||
$basePath = __DIR__ . '/../../../';
|
||||
$modules = \scandir($basePath);
|
||||
$modules = \scandir($basePath);
|
||||
foreach ($modules as $module) {
|
||||
$themePath = $basePath . $module . '/Theme/';
|
||||
|
||||
|
|
@ -143,8 +136,8 @@ final class Exporter extends ExporterAbstract
|
|||
if (\strlen($components[0]) === 2) {
|
||||
// normal language file
|
||||
$supportedLanguages[] = $components[0];
|
||||
$array = include $themePath . $theme . '/Lang/' . $language;
|
||||
$array = \reset($array);
|
||||
$array = include $themePath . $theme . '/Lang/' . $language;
|
||||
$array = \reset($array);
|
||||
|
||||
if ($array === false) {
|
||||
continue;
|
||||
|
|
@ -174,7 +167,7 @@ final class Exporter extends ExporterAbstract
|
|||
}
|
||||
|
||||
$template = \file_get_contents($item->getPathname());
|
||||
$keys = [];
|
||||
$keys = [];
|
||||
\preg_match_all('/(\$this\->getHtml\(\')([a-zA-Z:]+)(\'\))/', $template, $keys, \PREG_PATTERN_ORDER);
|
||||
|
||||
foreach ($keys[2] ?? [] as $key) {
|
||||
|
|
@ -204,7 +197,7 @@ final class Exporter extends ExporterAbstract
|
|||
return [
|
||||
'type' => 'file',
|
||||
'name' => 'languages.csv',
|
||||
'content' => $content
|
||||
'content' => $content,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,19 +15,14 @@ declare(strict_types=1);
|
|||
namespace Modules\Exchange\Interfaces\OMS;
|
||||
|
||||
use Modules\Exchange\Models\ExchangeLog;
|
||||
use Modules\Exchange\Models\ExchangeType;
|
||||
use Modules\Exchange\Models\ImporterAbstract;
|
||||
use Modules\Media\Controller\ApiController;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||
use phpOMS\DataStorage\Database\Connection\ConnectionFactory;
|
||||
use phpOMS\DataStorage\Database\DatabaseStatus;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\System\File\Local\Directory;
|
||||
use phpOMS\Utils\IO\Zip\Zip;
|
||||
use Modules\Media\Controller\ApiController;
|
||||
use Modules\Exchange\Models\ImporterAbstract;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use Modules\Exchange\Models\ExchangeType;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
|
||||
/**
|
||||
* OMS import class
|
||||
|
|
@ -108,11 +103,11 @@ final class Importer extends ImporterAbstract
|
|||
|
||||
if ($request->getData('type') === 'language') {
|
||||
$this->importLanguage($request);
|
||||
$log = new ExchangeLog();
|
||||
$log = new ExchangeLog();
|
||||
$log->createdBy = $this->account;
|
||||
$log->setType(ExchangeType::IMPORT);
|
||||
$log->message = 'Language file imported.'; // @todo: localize!
|
||||
$log->subtype = 'language';
|
||||
$log->message = 'Language file imported.'; // @todo: localize!
|
||||
$log->subtype = 'language';
|
||||
$log->exchange = (int) $request->getData('id');
|
||||
|
||||
$result['logs'][] = $log;
|
||||
|
|
@ -132,10 +127,10 @@ final class Importer extends ImporterAbstract
|
|||
{
|
||||
$upload = ApiController::uploadFilesToDestination($request->getFiles());
|
||||
|
||||
$fp = \fopen($upload['file0']['path'] . '/' . $upload['file0']['filename'], 'r');
|
||||
$fp = \fopen($upload['file0']['path'] . '/' . $upload['file0']['filename'], 'r');
|
||||
$header = \fgetcsv($fp, 0, ';', '"');
|
||||
|
||||
$languageArray = [];
|
||||
$languageArray = [];
|
||||
$supportedLanguages = \array_slice($header, 3);
|
||||
|
||||
while(($line = \fgetcsv($fp, 0, ';', '"')) !== false) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
$lang = $this->getData('lang');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
$lang = $this->getData('lang');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
|
|||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int|InterfaceManager $exchange = 0;
|
||||
public int |
|
||||
|
||||
InterfaceManager $exchange = 0;
|
||||
|
||||
/**
|
||||
* Date type.
|
||||
|
|
@ -77,7 +79,9 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
|
|||
*/
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
public int|Account $createdBy = 0;
|
||||
public int |
|
||||
|
||||
Account $createdBy = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Exchange\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
* Exchange log mapper class.
|
||||
|
|
@ -34,14 +34,14 @@ final class ExchangeLogMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'exchange_log_id' => ['name' => 'exchange_log_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'exchange_log_message' => ['name' => 'exchange_log_message', 'type' => 'string', 'internal' => 'message'],
|
||||
'exchange_log_fields' => ['name' => 'exchange_log_fields', 'type' => 'Json', 'internal' => 'fields'],
|
||||
'exchange_log_type' => ['name' => 'exchange_log_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'exchange_log_subtype' => ['name' => 'exchange_log_subtype', 'type' => 'string', 'internal' => 'subtype'],
|
||||
'exchange_log_id' => ['name' => 'exchange_log_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'exchange_log_message' => ['name' => 'exchange_log_message', 'type' => 'string', 'internal' => 'message'],
|
||||
'exchange_log_fields' => ['name' => 'exchange_log_fields', 'type' => 'Json', 'internal' => 'fields'],
|
||||
'exchange_log_type' => ['name' => 'exchange_log_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'exchange_log_subtype' => ['name' => 'exchange_log_subtype', 'type' => 'string', 'internal' => 'subtype'],
|
||||
'exchange_log_created_at' => ['name' => 'exchange_log_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'exchange_log_created_by' => ['name' => 'exchange_log_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
'exchange_log_exchange' => ['name' => 'exchange_log_exchange', 'type' => 'int', 'internal' => 'exchange'],
|
||||
'exchange_log_exchange' => ['name' => 'exchange_log_exchange', 'type' => 'int', 'internal' => 'exchange'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ declare(strict_types=1);
|
|||
|
||||
return ['Exchange' => [
|
||||
'Database' => 'Datenbank',
|
||||
'End' => 'Ende',
|
||||
'End' => 'Ende',
|
||||
'Exchange' => 'Exchange',
|
||||
'Export' => 'Export',
|
||||
'Exports' => 'Exporte',
|
||||
'File' => 'Dateien',
|
||||
'Host' => 'Host',
|
||||
'Import' => 'Import',
|
||||
'Imports' => 'Importe',
|
||||
'Login' => 'Login',
|
||||
'Options' => 'Optionen',
|
||||
'Export' => 'Export',
|
||||
'Exports' => 'Exporte',
|
||||
'File' => 'Dateien',
|
||||
'Host' => 'Host',
|
||||
'Import' => 'Import',
|
||||
'Imports' => 'Importe',
|
||||
'Login' => 'Login',
|
||||
'Options' => 'Optionen',
|
||||
'Password' => 'Passwort',
|
||||
'Port' => 'Port',
|
||||
'Start' => 'Start',
|
||||
'Title' => 'Titel',
|
||||
'Website' => 'Webseite',
|
||||
'Port' => 'Port',
|
||||
'Start' => 'Start',
|
||||
'Title' => 'Titel',
|
||||
'Website' => 'Webseite',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ declare(strict_types=1);
|
|||
|
||||
return ['Exchange' => [
|
||||
'Database' => 'Database',
|
||||
'End' => 'End',
|
||||
'End' => 'End',
|
||||
'Exchange' => 'Exchange',
|
||||
'Export' => 'Export',
|
||||
'Exports' => 'Exports',
|
||||
'File' => 'File',
|
||||
'Host' => 'Host',
|
||||
'Import' => 'Import',
|
||||
'Imports' => 'Imports',
|
||||
'Login' => 'Login',
|
||||
'Options' => 'Options',
|
||||
'Export' => 'Export',
|
||||
'Exports' => 'Exports',
|
||||
'File' => 'File',
|
||||
'Host' => 'Host',
|
||||
'Import' => 'Import',
|
||||
'Imports' => 'Imports',
|
||||
'Login' => 'Login',
|
||||
'Options' => 'Options',
|
||||
'Password' => 'Password',
|
||||
'Port' => 'Port',
|
||||
'Start' => 'Start',
|
||||
'Title' => 'Title',
|
||||
'Website' => 'Website',
|
||||
'Port' => 'Port',
|
||||
'Start' => 'Start',
|
||||
'Title' => 'Title',
|
||||
'Website' => 'Website',
|
||||
]];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user