2021-04-16 14:04:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2021-04-20 11:20:34 +02:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
2021-04-16 14:04:30 +02:00
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2021-04-20 11:20:34 +02:00
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
2021-04-16 14:04:30 +02:00
|
|
|
*/
|
|
|
|
|
2021-04-20 09:57:44 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-04-16 14:04:30 +02:00
|
|
|
namespace D3\DataWizard\Application\Controller\Admin;
|
|
|
|
|
|
|
|
use D3\DataWizard\Application\Model\Configuration;
|
2021-04-20 09:50:49 +02:00
|
|
|
use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
|
|
|
|
use D3\DataWizard\Application\Model\Exceptions\DebugException;
|
2021-04-20 16:18:40 +02:00
|
|
|
use D3\ModCfg\Application\Model\d3database;
|
2021-04-20 09:50:49 +02:00
|
|
|
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
|
|
|
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
2021-04-18 23:17:48 +02:00
|
|
|
use Doctrine\DBAL\DBALException;
|
2021-04-16 14:04:30 +02:00
|
|
|
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
2021-04-20 09:50:49 +02:00
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
2021-04-16 23:19:28 +02:00
|
|
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
2021-04-16 14:04:30 +02:00
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
|
|
|
|
class d3ExportWizard extends AdminDetailsController
|
|
|
|
{
|
|
|
|
protected $_sThisTemplate = 'd3ExportWizard.tpl';
|
|
|
|
|
|
|
|
/** @var Configuration */
|
|
|
|
protected $configuration;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->configuration = oxNew(Configuration::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getGroups()
|
|
|
|
{
|
|
|
|
return $this->configuration->getGroups();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getGroupExports($group)
|
|
|
|
{
|
|
|
|
return $this->configuration->getExportsByGroup($group);
|
|
|
|
}
|
|
|
|
|
2021-04-18 23:17:48 +02:00
|
|
|
/**
|
2021-04-20 09:50:49 +02:00
|
|
|
* @throws DatabaseConnectionException
|
|
|
|
* @throws StandardException
|
|
|
|
* @throws d3ShopCompatibilityAdapterException
|
|
|
|
* @throws d3_cfg_mod_exception
|
2021-04-18 23:17:48 +02:00
|
|
|
*/
|
2021-04-16 14:04:30 +02:00
|
|
|
public function doExport()
|
|
|
|
{
|
2021-04-18 23:17:48 +02:00
|
|
|
try {
|
|
|
|
$id = Registry::getRequest()->getRequestEscapedParameter('exportid');
|
|
|
|
$export = $this->configuration->getExportById($id);
|
2021-04-16 23:19:28 +02:00
|
|
|
|
2021-04-20 16:18:40 +02:00
|
|
|
[ $queryString, $parameters ] = $export->getQuery();
|
|
|
|
|
2021-04-18 23:17:48 +02:00
|
|
|
if (Registry::getConfig()->getConfigParam('d3datawizard_debug')) {
|
|
|
|
throw oxNew(
|
2021-04-20 09:50:49 +02:00
|
|
|
DebugException::class,
|
2021-04-20 16:18:40 +02:00
|
|
|
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
|
2021-04-18 23:17:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-04-19 13:30:52 +02:00
|
|
|
$export->run(Registry::getRequest()->getRequestEscapedParameter('exportformat'));
|
2021-04-20 09:50:49 +02:00
|
|
|
} catch (DataWizardException|DBALException|DatabaseErrorException $e) {
|
2021-04-18 23:17:48 +02:00
|
|
|
Registry::getUtilsView()->addErrorToDisplay($e);
|
|
|
|
}
|
2021-04-16 14:04:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getUserMessages()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHelpURL()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|