Improve backend module layout, remove buttons, add sysinfo
This commit is contained in:
+11
-7
@@ -2,21 +2,25 @@
|
||||
|
||||
namespace EP\EpProducts\Backend;
|
||||
|
||||
use EP\EpProducts\Service\ImportTimestampService;
|
||||
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem as CoreSystemInformationToolbarItem;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class SystemInformationToolbarItemExtension
|
||||
{
|
||||
public function addBpnImportInformation(CoreSystemInformationToolbarItem $systemInformation)
|
||||
{
|
||||
$updatedTimestampPath = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport/.lastupdate');
|
||||
if ($updatedTimestampPath && file_exists($updatedTimestampPath)) {
|
||||
$updatedTimestamp = file_get_contents($updatedTimestampPath);
|
||||
}
|
||||
$timestampService = new ImportTimestampService();
|
||||
$productDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/products_import.info');
|
||||
$contingentsDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/contingents_import.info');
|
||||
|
||||
$systemInformation->addSystemInformation(
|
||||
'Letzer XML Abruf',
|
||||
$updatedTimestamp ?: '-',
|
||||
'Letzer Produktdaten-Import',
|
||||
$productDataUpdatedTimestamp ? $productDataUpdatedTimestamp->format('d.m.y H:i:s') : '-',
|
||||
'ep-logo'
|
||||
);
|
||||
$systemInformation->addSystemInformation(
|
||||
'Letzer Kontingente Import',
|
||||
$contingentsDataUpdatedTimestamp ? $contingentsDataUpdatedTimestamp->format('d.m.y H:i:s') : '-',
|
||||
'ep-logo'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,10 +68,6 @@ class BackendController extends ActionController
|
||||
* @var ContingentImportService
|
||||
*/
|
||||
protected $contingentImportService;
|
||||
/**
|
||||
* @var ImportTimestampService
|
||||
*/
|
||||
private $importTimestampService;
|
||||
|
||||
/**
|
||||
* @param DateImportService $dateImportService
|
||||
@@ -84,8 +80,7 @@ class BackendController extends ActionController
|
||||
DateImportService $dateImportService,
|
||||
ContingentImportService $contingentImportService,
|
||||
SnowreportImportService $snowreportService,
|
||||
LogService $logService,
|
||||
ImportTimestampService $importTimestampService
|
||||
LogService $logService
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -94,40 +89,17 @@ class BackendController extends ActionController
|
||||
$this->contingentImportService = $contingentImportService;
|
||||
$this->snowreportImportService = $snowreportService;
|
||||
$this->logService = $logService;
|
||||
$this->importTimestampService = $importTimestampService;
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$updatedTimestamp = $this->importTimestampService->readImportTimestamp('fileadmin/products_import.info');
|
||||
$timestampService = new ImportTimestampService();
|
||||
|
||||
$this->view->assign('updatedTimestamp', $updatedTimestamp);
|
||||
}
|
||||
$productDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/products_import.info');
|
||||
$contingentsDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/contingents_import.info');
|
||||
|
||||
public function importProductsAction()
|
||||
{
|
||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
|
||||
if ($this->dateImportService->checkActiveUpload($path)) {
|
||||
$this->addFlashMessage(
|
||||
'Datenexport aus BusProNet aktiv. Import nicht möglich.',
|
||||
'Import fehlgeschlagen',
|
||||
AbstractMessage::WARNING
|
||||
);
|
||||
} else {
|
||||
$dateCount = $this->dateImportService->import($path);
|
||||
$this->addFlashMessage($dateCount . ' Termine importiert', 'Import abgechlossen', AbstractMessage::OK);
|
||||
$resellerPageUid = $this->settings['resellerExportPageUid'];
|
||||
$this->cacheService->clearPageCache($resellerPageUid);
|
||||
}
|
||||
$this->redirect('index');
|
||||
}
|
||||
|
||||
public function importContingentsAction()
|
||||
{
|
||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexportzimmer');
|
||||
$count = $this->contingentImportService->import($path);
|
||||
$this->addFlashMessage($count . ' Datensätze importiert', 'Import abgechlossen', AbstractMessage::OK);
|
||||
$this->redirect('index');
|
||||
$this->view->assign('productDataUpdatedTimestamp', $productDataUpdatedTimestamp);
|
||||
$this->view->assign('contingentsDataUpdatedTimestamp', $contingentsDataUpdatedTimestamp);
|
||||
}
|
||||
|
||||
public function importSnowReportAction()
|
||||
|
||||
@@ -57,19 +57,14 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
|
||||
* @var Connection
|
||||
*/
|
||||
protected $db;
|
||||
/**
|
||||
* @var ImportTimestampService
|
||||
*/
|
||||
private $importTimestampService;
|
||||
|
||||
/**
|
||||
* @param ConfigurationManagerInterface $manager
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function __construct(ConfigurationManagerInterface $manager, ImportTimestampService $importTimestampService)
|
||||
public function __construct(ConfigurationManagerInterface $manager)
|
||||
{
|
||||
$this->configurationManager = $manager;
|
||||
$this->importTimestampService = $importTimestampService;
|
||||
|
||||
$settings = GeneralUtility::removeDotsFromTS(
|
||||
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
||||
@@ -100,7 +95,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
|
||||
|
||||
public function isImportRequired(): bool
|
||||
{
|
||||
return $this->importTimestampService->isImportRequired(
|
||||
$timestampService = new ImportTimestampService();
|
||||
|
||||
return $timestampService->isImportRequired(
|
||||
'fileadmin/xmlexportzimmer/uebertragung.info',
|
||||
'fileadmin/contingents_import.info'
|
||||
);
|
||||
|
||||
@@ -85,11 +85,6 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
*/
|
||||
protected $cacheService;
|
||||
|
||||
/**
|
||||
* @var ImportTimestampService
|
||||
*/
|
||||
private $importTimestampService;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -101,15 +96,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
* @param ConfigurationManagerInterface $configurationManager
|
||||
* @param CacheService $cacheService
|
||||
*/
|
||||
public function __construct
|
||||
(
|
||||
ConfigurationManagerInterface $configurationManager,
|
||||
CacheService $cacheService,
|
||||
ImportTimestampService $importTimestampService
|
||||
) {
|
||||
public function __construct(ConfigurationManagerInterface $configurationManager, CacheService $cacheService) {
|
||||
$this->configurationManager = $configurationManager;
|
||||
$this->cacheService = $cacheService;
|
||||
$this->importTimestampService = $importTimestampService;
|
||||
|
||||
$settings = GeneralUtility::removeDotsFromTS(
|
||||
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
||||
@@ -145,7 +134,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||
|
||||
public function isImportRequired(): bool
|
||||
{
|
||||
return $this->importTimestampService->isImportRequired(
|
||||
$timestampService = new ImportTimestampService();
|
||||
|
||||
return $timestampService->isImportRequired(
|
||||
'fileadmin/xmlexport/uebertragung.info',
|
||||
'fileadmin/products_import.info'
|
||||
);
|
||||
|
||||
@@ -7,21 +7,23 @@
|
||||
<f:section name="Main">
|
||||
<h1>E&P Funktionen</h1>
|
||||
<f:flashMessages />
|
||||
<p>
|
||||
<strong>Letzter automatischer XML Import: {f:if(condition: updatedTimestamp, then: '{updatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
||||
</p>
|
||||
<p>
|
||||
<f:link.action action="importProducts" class="btn btn-default">
|
||||
<core:icon identifier="actions-refresh"/>
|
||||
Produktdaten aus BusProNet importieren
|
||||
</f:link.action>
|
||||
</p>
|
||||
<p>
|
||||
<f:link.action action="importContingents" class="btn btn-default">
|
||||
<core:icon identifier="actions-refresh"/>
|
||||
Kontingentdaten aus BusProNet importieren
|
||||
</f:link.action>
|
||||
</p>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">BusPro Daten</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<strong>Letzter Produktdaten-Import: {f:if(condition: productDataUpdatedTimestamp, then: '{productDataUpdatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Letzter Kontingente-Import: {f:if(condition: contingentsDataUpdatedTimestamp, then: '{contingentsDataUpdatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Hinweis:</strong> TYPO3 prüft alle 15 Minuten, ob ein XML Upload aus BusPro erfolgt ist (automatisch
|
||||
oder manuell) und führt sofort einen Import durch falls erforderlich.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<f:link.action action="importSnowReport" class="btn btn-default">
|
||||
<core:icon identifier="actions-refresh"/>
|
||||
|
||||
Reference in New Issue
Block a user