31 Commits

Author SHA1 Message Date
f5d35021f5 fix composer.json 2021-11-11 11:15:23 +01:00
e134a4c14a adjust version informations 2021-11-11 09:35:35 +01:00
b5d6936074 change deprecated CSV export code 2021-11-11 09:34:30 +01:00
ac7ae90310 update READMEs 2021-11-10 15:29:30 +01:00
067326e704 add data wizard link suggestion 2021-11-10 14:09:19 +01:00
ae09cf88a5 enable controller based exception handling 2021-11-10 13:50:22 +01:00
3b47f4da05 add extendable tpl blocks for submit elements on tasks 2021-11-10 13:50:21 +01:00
903d178124 add tpl block for easy extension 2021-11-10 13:50:20 +01:00
bd90f18a87 force get translations from admin 2021-11-10 13:50:20 +01:00
74edceafc8 add JSON export renderer 2021-11-10 13:49:55 +01:00
ea77239510 change deprecated CSV export code 2021-10-29 11:38:29 +02:00
e1502b274e show registered export renderers in admin submit without required tpl block extension 2021-10-29 11:37:51 +02:00
500f226399 make installable in OXID 6.3.1 2021-09-10 15:18:11 +02:00
1023bd2fa6 adjust note for example tasks 2021-09-08 13:42:57 +02:00
dd7b8ed1e6 add screenshot 2021-09-08 11:34:20 +02:00
a1cd84b415 can handle long task description text 2021-07-29 17:31:15 +02:00
af10e80086 make admin controller templates more generic 2021-07-29 16:35:25 +02:00
148f4f8213 move example tasks to Data Wizard tasks module 2021-07-27 15:37:54 +02:00
f2935209ed add english translations 2021-07-27 09:42:51 +02:00
a7e6c91042 adjust changelog 2021-07-27 09:08:56 +02:00
9e9a0fdd4c Merge remote-tracking branch 'remotes/origin/Branch_dev_1.x_cli' into rel_1.x 2021-07-23 09:09:50 +02:00
eef594d970 allow older form-manager because of incompatibilities in OXID 6.1 2021-07-23 08:57:59 +02:00
759e8a377d improve code 2021-07-14 23:04:33 +02:00
f42c42cbe4 update README files 2021-07-14 14:59:54 +02:00
baf30ef196 accept different letter cases in export format arguments 2021-07-14 13:27:58 +02:00
8b354993ca fix typo in export title 2021-07-14 12:23:19 +02:00
4c91b0d699 can get format list 2021-07-14 12:22:01 +02:00
34b2b0b061 can export save in file 2021-07-14 12:21:12 +02:00
9e9bab88f0 Resolve source directory and add blacklist filter 2021-07-13 10:51:45 +02:00
466e751a5c update version informations 2021-06-25 15:44:33 +02:00
5367dfdb5a #10782: implement form manager for task specific form elements 2021-06-25 15:33:57 +02:00
37 changed files with 678 additions and 567 deletions

View File

@ -47,7 +47,7 @@ class d3ActionWizard extends AdminDetailsController
return $this->configuration->getActionGroups(); return $this->configuration->getActionGroups();
} }
public function getGroupActions($group) public function getGroupTasks($group)
{ {
return $this->configuration->getActionsByGroup($group); return $this->configuration->getActionsByGroup($group);
} }
@ -58,27 +58,37 @@ class d3ActionWizard extends AdminDetailsController
* @throws d3ShopCompatibilityAdapterException * @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception * @throws d3_cfg_mod_exception
*/ */
public function doAction() public function runTask()
{ {
try { try {
$id = Registry::getRequest()->getRequestEscapedParameter('actionid'); $this->execute();
$action = $this->configuration->getActionById($id);
[ $queryString, $parameters ] = $action->getQuery();
if (Registry::getConfig()->getConfigParam('d3datawizard_debug')) {
throw oxNew(
DebugException::class,
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
);
}
$action->run();
} catch (DataWizardException|DBALException|DatabaseErrorException $e) { } catch (DataWizardException|DBALException|DatabaseErrorException $e) {
Registry::getLogger()->error($e->getMessage());
Registry::getUtilsView()->addErrorToDisplay($e); Registry::getUtilsView()->addErrorToDisplay($e);
} }
} }
/**
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/
protected function execute()
{
$id = Registry::getRequest()->getRequestEscapedParameter('taskid');
$action = $this->configuration->getActionById($id);
[ $queryString, $parameters ] = $action->getQuery();
if (Registry::getConfig()->getConfigParam('d3datawizard_debug')) {
throw oxNew(
DebugException::class,
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
);
}
$action->run();
}
public function getUserMessages() public function getUserMessages()
{ {
return null; return null;

View File

@ -18,6 +18,8 @@ namespace D3\DataWizard\Application\Controller\Admin;
use D3\DataWizard\Application\Model\Configuration; use D3\DataWizard\Application\Model\Configuration;
use D3\DataWizard\Application\Model\Exceptions\DataWizardException; use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
use D3\DataWizard\Application\Model\Exceptions\DebugException; use D3\DataWizard\Application\Model\Exceptions\DebugException;
use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException;
use D3\DataWizard\Application\Model\Exceptions\TaskException;
use D3\ModCfg\Application\Model\d3database; use D3\ModCfg\Application\Model\d3database;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception; use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException; use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
@ -47,7 +49,7 @@ class d3ExportWizard extends AdminDetailsController
return $this->configuration->getExportGroups(); return $this->configuration->getExportGroups();
} }
public function getGroupExports($group) public function getGroupTasks($group)
{ {
return $this->configuration->getExportsByGroup($group); return $this->configuration->getExportsByGroup($group);
} }
@ -58,27 +60,43 @@ class d3ExportWizard extends AdminDetailsController
* @throws d3ShopCompatibilityAdapterException * @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception * @throws d3_cfg_mod_exception
*/ */
public function doExport() public function runTask()
{ {
try { try {
$id = Registry::getRequest()->getRequestEscapedParameter('exportid'); $this->execute();
$export = $this->configuration->getExportById($id);
[ $queryString, $parameters ] = $export->getQuery();
if (Registry::getConfig()->getConfigParam('d3datawizard_debug')) {
throw oxNew(
DebugException::class,
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
);
}
$export->run(Registry::getRequest()->getRequestEscapedParameter('exportformat'));
} catch (DataWizardException|DBALException|DatabaseErrorException $e) { } catch (DataWizardException|DBALException|DatabaseErrorException $e) {
Registry::getLogger()->error($e->getMessage());
Registry::getUtilsView()->addErrorToDisplay($e); Registry::getUtilsView()->addErrorToDisplay($e);
} }
} }
/**
* @throws DBALException
* @throws DatabaseConnectionException
* @throws DatabaseErrorException
* @throws StandardException
* @throws NoSuitableRendererException
* @throws TaskException
* @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception
*/
protected function execute()
{
$id = Registry::getRequest()->getRequestEscapedParameter('taskid');
$export = $this->configuration->getExportById($id);
[ $queryString, $parameters ] = $export->getQuery();
if (Registry::getConfig()->getConfigParam('d3datawizard_debug')) {
throw oxNew(
DebugException::class,
d3database::getInstance()->getPreparedStatementQuery($queryString, $parameters)
);
}
$export->run(Registry::getRequest()->getRequestEscapedParameter('format'));
}
public function getUserMessages() public function getUserMessages()
{ {
return null; return null;

View File

@ -15,6 +15,10 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model; namespace D3\DataWizard\Application\Model;
use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException;
use FormManager\Inputs\Checkbox;
use FormManager\Inputs\Input;
use FormManager\Inputs\Radio;
use OxidEsales\Eshop\Core\DatabaseProvider; use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -22,7 +26,10 @@ use OxidEsales\Eshop\Core\Registry;
abstract class ActionBase implements QueryBase abstract class ActionBase implements QueryBase
{ {
protected $formElements = [];
/** /**
* Ensure that the translations are equally available in the frontend and the backend
* @return string * @return string
*/ */
public function getDescription() : string public function getDescription() : string
@ -36,6 +43,15 @@ abstract class ActionBase implements QueryBase
*/ */
public function run() public function run()
{ {
if ($this->hasFormElements()) {
/** @var Input $element */
foreach ($this->getFormElements() as $element) {
if (false === $element->isValid()) {
throw oxNew(InputUnvalidException::class, $this, $element);
}
}
}
$this->executeAction( $this->getQuery() ); $this->executeAction( $this->getQuery() );
} }
@ -81,4 +97,38 @@ abstract class ActionBase implements QueryBase
{ {
return "D3_DATAWIZARD_ACTION_SUBMIT"; return "D3_DATAWIZARD_ACTION_SUBMIT";
} }
/**
* @param Input $input
*/
public function registerFormElement(Input $input)
{
switch (get_class($input)) {
case Radio::class:
case Checkbox::class:
$input->setTemplate('<p class="form-check">{{ input }} {{ label }}</p>');
$input->setAttribute('class', 'form-check-input');
break;
default:
$input->setTemplate('<p class="formElements">{{ label }} {{ input }}</p>');
$input->setAttribute('class', 'form-control');
}
$this->formElements[] = $input;
}
/**
* @return bool
*/
public function hasFormElements(): bool
{
return (bool) count($this->formElements);
}
/**
* @return array
*/
public function getFormElements(): array
{
return $this->formElements;
}
} }

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model; namespace D3\DataWizard\Application\Model;
use D3\DataWizard\Application\Model\Actions\FixArtextendsItems; use D3\DataWizard\Application\Model\Actions\FixArtextendsItems;
use D3\DataWizard\Application\Model\Exceptions\DataWizardException;
use D3\DataWizard\Application\Model\Exports\InactiveCategories; use D3\DataWizard\Application\Model\Exports\InactiveCategories;
use D3\DataWizard\Application\Model\Exports\KeyFigures; use D3\DataWizard\Application\Model\Exports\KeyFigures;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
@ -28,6 +29,7 @@ class Configuration
const GROUP_USERS = 'D3_DATAWIZARD_GROUP_USERS'; const GROUP_USERS = 'D3_DATAWIZARD_GROUP_USERS';
const GROUP_ORDERS = 'D3_DATAWIZARD_GROUP_ORDERS'; const GROUP_ORDERS = 'D3_DATAWIZARD_GROUP_ORDERS';
const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS'; const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS';
const GROUP_CMS = 'D3_DATAWIZARD_GROUP_CMS';
protected $actions = []; protected $actions = [];
protected $exports = []; protected $exports = [];
@ -39,12 +41,7 @@ class Configuration
public function configure() public function configure()
{ {
if (false === Registry::getConfig()->getConfigParam('d3datawizard_hideexamples', false)) { // extend to add exports and actions via 'registerAction()' or 'registerExport()' method
$this->registerAction(self::GROUP_ARTICLES, oxNew(FixArtextendsItems::class));
$this->registerExport(self::GROUP_CATEGORY, oxNew(InactiveCategories::class));
$this->registerExport(self::GROUP_SHOP, oxNew(KeyFigures::class));
}
} }
/** /**
@ -53,7 +50,7 @@ class Configuration
*/ */
public function registerAction($group, ActionBase $action) public function registerAction($group, ActionBase $action)
{ {
$this->actions[$group][md5(serialize($action))] = $action; $this->actions[$group][md5(get_class($action))] = $action;
} }
/** /**
@ -62,7 +59,7 @@ class Configuration
*/ */
public function registerExport($group, ExportBase $export) public function registerExport($group, ExportBase $export)
{ {
$this->exports[$group][md5(serialize($export))] = $export; $this->exports[$group][md5(get_class($export))] = $export;
} }
/** /**
@ -162,6 +159,12 @@ class Configuration
*/ */
public function getExportById($id) : ExportBase public function getExportById($id) : ExportBase
{ {
return $this->getAllExports()[$id]; $allExports = $this->getAllExports();
if (false == $allExports[$id]) {
throw oxNew(DataWizardException::class, 'no export with id '.$id);
}
return $allExports[$id];
} }
} }

View File

@ -17,6 +17,6 @@ namespace D3\DataWizard\Application\Model\Exceptions;
use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Exception\StandardException;
class RenderException extends StandardException implements DataWizardException class DataWizardException extends StandardException
{ {
} }

View File

@ -16,10 +16,9 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions; namespace D3\DataWizard\Application\Model\Exceptions;
use Exception; use Exception;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
class DebugException extends StandardException implements DataWizardException class DebugException extends DataWizardException
{ {
public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null ) public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null )
{ {

View File

@ -0,0 +1,32 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions;
use Exception;
use OxidEsales\Eshop\Core\Registry;
class ExportFileException extends DataWizardException
{
public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null )
{
$sMessage = sprintf(
Registry::getLang()->translateString('D3_DATAWIZARD_ERR_EXPORTFILEERROR'),
$sMessage
);
parent::__construct($sMessage, $iCode, $previous );
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions;
use D3\DataWizard\Application\Model\QueryBase;
use Exception;
use FormManager\Inputs\Input;
class InputUnvalidException extends DataWizardException
{
/** @var QueryBase */
public $task;
/**
* InputUnvalidException constructor.
* @param QueryBase $task
* @param Input $inputElement
* @param int $iCode
* @param Exception|null $previous
* @throws Exception
*/
public function __construct( QueryBase $task, Input $inputElement, $iCode = 0, Exception $previous = null )
{
$messages = [];
foreach ($inputElement->getError()->getIterator() as $item) {
$messages[] = $inputElement->label->innerHTML.' -> '.$item->getMessage();
}
$sMessage = implode(
' - ',
[
$task->getTitle(),
implode(', ', $messages)
]
);
parent::__construct( $sMessage, $iCode, $previous );
$this->task = $task;
}
}

View File

@ -16,10 +16,9 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions; namespace D3\DataWizard\Application\Model\Exceptions;
use Exception; use Exception;
use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
class NoSuitableRendererException extends StandardException implements DataWizardException class NoSuitableRendererException extends DataWizardException
{ {
public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null ) public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null )
{ {

View File

@ -15,6 +15,6 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Exceptions; namespace D3\DataWizard\Application\Model\Exceptions;
interface DataWizardException class RenderException extends DataWizardException
{ {
} }

View File

@ -17,9 +17,8 @@ namespace D3\DataWizard\Application\Model\Exceptions;
use D3\DataWizard\Application\Model\QueryBase; use D3\DataWizard\Application\Model\QueryBase;
use Exception; use Exception;
use OxidEsales\Eshop\Core\Exception\StandardException;
class TaskException extends StandardException implements DataWizardException class TaskException extends DataWizardException
{ {
/** @var QueryBase */ /** @var QueryBase */
public $task; public $task;

View File

@ -15,11 +15,16 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model; namespace D3\DataWizard\Application\Model;
use D3\DataWizard\Application\Model\Exceptions\ExportFileException;
use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException;
use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge; use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge;
use D3\ModCfg\Application\Model\d3filesystem; use D3\ModCfg\Application\Model\d3filesystem;
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception; use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException; use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use FormManager\Inputs\Checkbox;
use FormManager\Inputs\Input;
use FormManager\Inputs\Radio;
use OxidEsales\Eshop\Core\DatabaseProvider; use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -28,7 +33,10 @@ use OxidEsales\Eshop\Core\Registry;
abstract class ExportBase implements QueryBase abstract class ExportBase implements QueryBase
{ {
protected $formElements = [];
/** /**
* Ensure that the translations are equally available in the frontend and the backend
* @return string * @return string
*/ */
public function getDescription() : string public function getDescription() : string
@ -38,6 +46,7 @@ abstract class ExportBase implements QueryBase
/** /**
* @param string $format * @param string $format
* @param $path
* *
* @throws DBALException * @throws DBALException
* @throws DatabaseConnectionException * @throws DatabaseConnectionException
@ -47,19 +56,36 @@ abstract class ExportBase implements QueryBase
* @throws StandardException * @throws StandardException
* @throws d3ShopCompatibilityAdapterException * @throws d3ShopCompatibilityAdapterException
* @throws d3_cfg_mod_exception * @throws d3_cfg_mod_exception
* @return string
*/ */
public function run($format = RendererBridge::FORMAT_CSV) public function run( string $format = RendererBridge::FORMAT_CSV, $path = null): string
{ {
if ($this->hasFormElements()) {
/** @var Input $element */
foreach ($this->getFormElements() as $element) {
if (false === $element->isValid()) {
throw oxNew(InputUnvalidException::class, $this, $element);
}
}
}
[ $rows, $fieldNames ] = $this->getExportData( $this->getQuery() ); [ $rows, $fieldNames ] = $this->getExportData( $this->getQuery() );
$content = $this->renderContent($rows, $fieldNames, $format); $content = $this->renderContent($rows, $fieldNames, $format);
/** @var $oFS d3filesystem */ /** @var $oFS d3filesystem */
$oFS = oxNew(d3filesystem::class); $oFS = oxNew( d3filesystem::class );
$oFS->startDirectDownload( if (is_null($path)) {
$oFS->filterFilename($this->getExportFileName($format)), $oFS->startDirectDownload( $oFS->filterFilename( $this->getExportFileName( $format ) ), $content );
$content } else {
); $filePath = $oFS->trailingslashit($path).$oFS->filterFilename( $this->getExportFileName( $format ) );
if (false === $oFS->createFile($filePath, $content,true)) {
throw oxNew(ExportFileException::class, $filePath);
}
return $filePath;
}
return '';
} }
/** /**
@ -78,7 +104,15 @@ abstract class ExportBase implements QueryBase
*/ */
public function getRenderer($format): ExportRenderer\RendererInterface public function getRenderer($format): ExportRenderer\RendererInterface
{ {
return oxNew(RendererBridge::class)->getRenderer($format); return $this->getRendererBridge()->getRenderer($format);
}
/**
* @return RendererBridge
*/
public function getRendererBridge()
{
return oxNew(RendererBridge::class);
} }
/** /**
@ -152,7 +186,7 @@ abstract class ExportBase implements QueryBase
throw oxNew( throw oxNew(
Exceptions\TaskException::class, Exceptions\TaskException::class,
$this, $this,
Registry::getLang()->translateString( 'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' ) Registry::getLang()->translateString( 'D3_DATAWIZARD_ERR_NOEXPORTCONTENT', null, true )
); );
} }
@ -160,4 +194,38 @@ abstract class ExportBase implements QueryBase
return [ $rows, $fieldNames ]; return [ $rows, $fieldNames ];
} }
/**
* @param Input $input
*/
public function registerFormElement(Input $input)
{
switch (get_class($input)) {
case Radio::class:
case Checkbox::class:
$input->setTemplate('<p class="form-check">{{ input }} {{ label }}</p>');
$input->setAttribute('class', 'form-check-input');
break;
default:
$input->setTemplate('<p class="formElements">{{ label }} {{ input }}</p>');
$input->setAttribute('class', 'form-control');
}
$this->formElements[] = $input;
}
/**
* @return bool
*/
public function hasFormElements(): bool
{
return (bool) count($this->formElements);
}
/**
* @return array
*/
public function getFormElements(): array
{
return $this->formElements;
}
} }

View File

@ -36,13 +36,12 @@ class Csv implements RendererInterface
$csv = $this->getCsv(); $csv = $this->getCsv();
$csv->insertOne( $fieldNames ); $csv->insertOne( $fieldNames );
$csv->insertAll( $rows ); $csv->insertAll( $rows );
return method_exists($csv, 'getContent') ? $csv->getContent() : (string) $csv;
} catch (Exception $e) { } catch (Exception $e) {
/** @var RenderException $newException */ /** @var RenderException $newException */
$newException = oxNew(RenderException::class, $e->getMessage(), $e->getCode(), $e ); $newException = oxNew(RenderException::class, $e->getMessage(), $e->getCode(), $e );
throw $newException; throw $newException;
} }
return $csv->getContent();
} }
public function getFileExtension(): string public function getFileExtension(): string
@ -74,4 +73,12 @@ class Csv implements RendererInterface
return $csv; return $csv;
} }
/**
* @return string
*/
public function getTitleTranslationId(): string
{
return 'D3_DATAWIZARD_EXPORT_FORMAT_CSV';
}
} }

View File

@ -0,0 +1,51 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\ExportRenderer;
use D3\DataWizard\Application\Model\Exceptions\RenderException;
class Json implements RendererInterface
{
/**
* @param $rows
* @param $fieldNames
*
* @return string
* @throws RenderException
*/
public function getContent($rows, $fieldNames): string
{
$flags = JSON_PRETTY_PRINT;
$json = json_encode( $rows, $flags );
if ( $json === false ) {
throw oxNew( RenderException::class, json_last_error_msg(), json_last_error());
}
return $json;
}
public function getFileExtension(): string
{
return 'json';
}
/**
* @return string
*/
public function getTitleTranslationId(): string
{
return "D3_DATAWIZARD_EXPORT_FORMAT_JSON";
}
}

View File

@ -38,4 +38,12 @@ class Pretty implements RendererInterface
{ {
return 'txt'; return 'txt';
} }
/**
* @return string
*/
public function getTitleTranslationId(): string
{
return "D3_DATAWIZARD_EXPORT_FORMAT_PRETTY";
}
} }

View File

@ -0,0 +1,74 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\ExportRenderer;
use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException;
class RendererBridge
{
const FORMAT_CSV = 'CSV';
const FORMAT_PRETTY = 'Pretty';
const FORMAT_JSON = 'JSON';
/**
* @return array
*/
public function getRendererList(): array
{
return [
self::FORMAT_CSV => oxNew(Csv::class),
self::FORMAT_PRETTY => oxNew(Pretty::class),
self::FORMAT_JSON => oxNew(Json::class)
];
}
public function getTranslatedRendererIdList()
{
$rendererList = $this->getRendererList();
array_walk($rendererList, [$this, 'translateRendererId']);
return $rendererList;
}
/**
* @param RendererInterface $instance
*/
protected function translateRendererId(RendererInterface &$instance)
{
$instance = $instance->getTitleTranslationId();
}
/**
* @param string $format
*
* @return RendererInterface
* @throws NoSuitableRendererException
*/
public function getRenderer(string $format = self::FORMAT_CSV): RendererInterface
{
$format = strtolower($format);
$rendererList = array_change_key_case($this->getRendererList(), CASE_LOWER);
$rendererListTypes = array_keys(array_change_key_case($rendererList, CASE_LOWER));
if (in_array($format, $rendererListTypes, true)) {
return $rendererList[$format];
}
/** @var NoSuitableRendererException $e */
$e = oxNew(NoSuitableRendererException::class, $format);
throw $e;
}
}

View File

@ -29,4 +29,9 @@ interface RendererInterface
* @return string * @return string
*/ */
public function getFileExtension() : string; public function getFileExtension() : string;
/**
* @return string
*/
public function getTitleTranslationId() : string;
} }

View File

@ -15,16 +15,20 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model; namespace D3\DataWizard\Application\Model;
use FormManager\Inputs\Input;
interface QueryBase interface QueryBase
{ {
public function run(); public function run();
/** /**
* Ensure that the translations are equally available in the frontend and the backend
* @return string * @return string
*/ */
public function getTitle() : string; public function getTitle() : string;
/** /**
* Ensure that the translations are equally available in the frontend and the backend
* @return string * @return string
*/ */
public function getDescription() : string; public function getDescription() : string;
@ -38,4 +42,19 @@ interface QueryBase
* @return array [string $query, array $parameters] * @return array [string $query, array $parameters]
*/ */
public function getQuery() : array; public function getQuery() : array;
/**
* @param Input $input
*/
public function registerFormElement(Input $input);
/**
* @return bool
*/
public function hasFormElements(): bool;
/**
* @return array
*/
public function getFormElements(): array;
} }

View File

@ -27,18 +27,19 @@ $aLang = array(
'SHOP_MODULE_GROUP_d3datawizard_general' => 'Grundeinstellungen', 'SHOP_MODULE_GROUP_d3datawizard_general' => 'Grundeinstellungen',
'SHOP_MODULE_d3datawizard_debug' => 'zeigt Abfragen anstatt diese auszufĂĽhren', 'SHOP_MODULE_d3datawizard_debug' => 'zeigt Abfragen anstatt diese auszufĂĽhren',
'SHOP_MODULE_d3datawizard_hideexamples' => 'Beispielexporte ausblenden',
'D3_DATAWIZARD_GROUP_ARTICLES' => 'Artikel', 'D3_DATAWIZARD_GROUP_ARTICLES' => 'Artikel',
'D3_DATAWIZARD_GROUP_CATEGORIES' => 'Kategorien', 'D3_DATAWIZARD_GROUP_CATEGORIES' => 'Kategorien',
'D3_DATAWIZARD_GROUP_ORDERS' => 'Bestellungen', 'D3_DATAWIZARD_GROUP_ORDERS' => 'Bestellungen',
'D3_DATAWIZARD_GROUP_REMARKS' => 'Bewertungen', 'D3_DATAWIZARD_GROUP_REMARKS' => 'Bewertungen',
'D3_DATAWIZARD_GROUP_SHOP' => 'Shop', 'D3_DATAWIZARD_GROUP_SHOP' => 'Shop',
'D3_DATAWIZARD_GROUP_CMS' => 'CMS-Texte',
'D3_DATAWIZARD_GROUP_USERS' => 'Benutzer', 'D3_DATAWIZARD_GROUP_USERS' => 'Benutzer',
'D3_DATAWIZARD_EXPORT_SUBMIT' => 'Export starten', 'D3_DATAWIZARD_EXPORT_SUBMIT' => 'Export starten',
'D3_DATAWIZARD_EXPORT_FORMAT_CSV' => 'CSV-Format', 'D3_DATAWIZARD_EXPORT_FORMAT_CSV' => 'CSV-Format',
'D3_DATAWIZARD_EXPORT_FORMAT_PRETTY' => 'Pretty-Format', 'D3_DATAWIZARD_EXPORT_FORMAT_PRETTY' => 'Pretty-Format',
'D3_DATAWIZARD_EXPORT_FORMAT_JSON' => 'JSON-Format',
'D3_DATAWIZARD_ACTION_SUBMIT' => 'Aktion starten', 'D3_DATAWIZARD_ACTION_SUBMIT' => 'Aktion starten',
@ -48,20 +49,10 @@ $aLang = array(
'D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED' => 'Es sind keine Exporte installiert oder aktiviert.', 'D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED' => 'Es sind keine Exporte installiert oder aktiviert.',
'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export ist leer, kein Inhalt zum Download verfĂĽgbar', 'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export ist leer, kein Inhalt zum Download verfĂĽgbar',
'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'kein Renderer fĂĽr Format "%1$s" registriert', 'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'kein Renderer fĂĽr Format "%1$s" registriert',
'D3_DATAWIZARD_ERR_EXPORTFILEERROR' => 'Exportdatei "%1$s" kann nicht angelegt werden',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikel',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE' => 'Baum',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE' => 'Titel',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT' => 'Anzahl',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES' => 'Bestellungskennzahlen nach Monat',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'Bestellungen pro Monat',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE' => 'Warenkorbhöhe',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH' => 'Monat',
'D3_DATAWIZARD_ERR_ACTIONSELECT' => 'Aktion kann nicht ausgeführt werden. Aktionen können keine SELECTs exportieren.', 'D3_DATAWIZARD_ERR_ACTIONSELECT' => 'Aktion kann nicht ausgeführt werden. Aktionen können keine SELECTs exportieren.',
'D3_DATAWIZARD_ERR_NOACTION_INSTALLED' => 'Es sind keine Aktionen installiert oder aktiviert.', 'D3_DATAWIZARD_ERR_NOACTION_INSTALLED' => 'Es sind keine Aktionen installiert oder aktiviert.',
'D3_DATAWIZARD_ERR_ACTIONRESULT' => '%1$s Eintrag verändert', 'D3_DATAWIZARD_ERR_ACTIONRESULT' => '%1$s Eintrag verändert',
'D3_DATAWIZARD_ERR_ACTIONRESULTS' => '%1$s Einträge verändert', 'D3_DATAWIZARD_ERR_ACTIONRESULTS' => '%1$s Einträge verändert',
'D3_DATAWIZARD_ACTIONS_FIXARTEXTENDSITEMS' => 'fehlende oxartextends-Einträge nachtragen',
); );

View File

@ -0,0 +1,58 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
$sLangName = "English";
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
//Navigation
'charset' => 'UTF-8',
'd3mxDataWizard' => '<i class="fas fa-fw fa-hat-wizard"></i> Data Wizard',
'd3mxDataWizard_Export' => 'exports',
'd3mxDataWizard_Action' => 'actions',
'SHOP_MODULE_GROUP_d3datawizard_general' => 'basic settings',
'SHOP_MODULE_d3datawizard_debug' => 'shows queries instead of executing them',
'D3_DATAWIZARD_GROUP_ARTICLES' => 'articles',
'D3_DATAWIZARD_GROUP_CATEGORIES' => 'categories',
'D3_DATAWIZARD_GROUP_ORDERS' => 'orders',
'D3_DATAWIZARD_GROUP_REMARKS' => 'remarks',
'D3_DATAWIZARD_GROUP_SHOP' => 'shop',
'D3_DATAWIZARD_GROUP_CMS' => 'CMS items',
'D3_DATAWIZARD_GROUP_USERS' => 'users',
'D3_DATAWIZARD_EXPORT_SUBMIT' => 'generate export',
'D3_DATAWIZARD_EXPORT_FORMAT_CSV' => 'CSV format',
'D3_DATAWIZARD_EXPORT_FORMAT_PRETTY' => 'Pretty format',
'D3_DATAWIZARD_EXPORT_FORMAT_JSON' => 'JSON format',
'D3_DATAWIZARD_ACTION_SUBMIT' => 'run action',
'D3_DATAWIZARD_DEBUG' => 'Debug: %1$s',
'D3_DATAWIZARD_ERR_NOEXPORTSELECT' => 'Export cannot be executed. Exports require SELECT Query.',
'D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED' => 'No exports are installed or activated.',
'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export is empty, no content available for download',
'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'No renderer registered for format "%1$s"',
'D3_DATAWIZARD_ERR_EXPORTFILEERROR' => 'Export file "%1$s" cannot be created',
'D3_DATAWIZARD_ERR_ACTIONSELECT' => 'Action cannot be executed. Actions cannot export SELECTs.',
'D3_DATAWIZARD_ERR_NOACTION_INSTALLED' => 'No actions are installed or activated.',
'D3_DATAWIZARD_ERR_ACTIONRESULT' => '%1$s entry changed',
'D3_DATAWIZARD_ERR_ACTIONRESULTS' => '%1$s entries changed',
);

View File

@ -0,0 +1,4 @@
[{capture assign="d3dw_backgroundimage"}]linear-gradient(22.5deg, rgba(66, 66, 66, 0.02) 0%, rgba(66, 66, 66, 0.02) 11%,rgba(135, 135, 135, 0.02) 11%, rgba(135, 135, 135, 0.02) 24%,rgba(29, 29, 29, 0.02) 24%, rgba(29, 29, 29, 0.02) 38%,rgba(15, 15, 15, 0.02) 38%, rgba(15, 15, 15, 0.02) 50%,rgba(180, 180, 180, 0.02) 50%, rgba(180, 180, 180, 0.02) 77%,rgba(205, 205, 205, 0.02) 77%, rgba(205, 205, 205, 0.02) 100%),linear-gradient(67.5deg, rgba(10, 10, 10, 0.02) 0%, rgba(10, 10, 10, 0.02) 22%,rgba(52, 52, 52, 0.02) 22%, rgba(52, 52, 52, 0.02) 29%,rgba(203, 203, 203, 0.02) 29%, rgba(203, 203, 203, 0.02) 30%,rgba(69, 69, 69, 0.02) 30%, rgba(69, 69, 69, 0.02) 75%,rgba(231, 231, 231, 0.02) 75%, rgba(231, 231, 231, 0.02) 95%,rgba(138, 138, 138, 0.02) 95%, rgba(138, 138, 138, 0.02) 100%),linear-gradient(112.5deg, rgba(221, 221, 221, 0.02) 0%, rgba(221, 221, 221, 0.02) 17%,rgba(190, 190, 190, 0.02) 17%, rgba(190, 190, 190, 0.02) 39%,rgba(186, 186, 186, 0.02) 39%, rgba(186, 186, 186, 0.02) 66%,rgba(191, 191, 191, 0.02) 66%, rgba(191, 191, 191, 0.02) 68%,rgba(16, 16, 16, 0.02) 68%, rgba(16, 16, 16, 0.02) 70%,rgba(94, 94, 94, 0.02) 70%, rgba(94, 94, 94, 0.02) 100%),linear-gradient(90deg, #ffffff,#ffffff)[{/capture}]
[{capture assign="d3dw_noitemmessageid"}]D3_DATAWIZARD_ERR_NOACTION_INSTALLED[{/capture}]
[{include file="d3Wizards.tpl" submit="d3ActionSubmit.tpl"}]

View File

@ -0,0 +1,4 @@
[{capture assign="d3dw_backgroundimage"}]linear-gradient(339deg, rgba(47, 47, 47,0.02) 0%, rgba(47, 47, 47,0.02) 42%,transparent 42%, transparent 99%,rgba(17, 17, 17,0.02) 99%, rgba(17, 17, 17,0.02) 100%),linear-gradient(257deg, rgba(65, 65, 65,0.02) 0%, rgba(65, 65, 65,0.02) 11%,transparent 11%, transparent 92%,rgba(53, 53, 53,0.02) 92%, rgba(53, 53, 53,0.02) 100%),linear-gradient(191deg, rgba(5, 5, 5,0.02) 0%, rgba(5, 5, 5,0.02) 1%,transparent 1%, transparent 45%,rgba(19, 19, 19,0.02) 45%, rgba(19, 19, 19,0.02) 100%),linear-gradient(29deg, rgba(28, 28, 28,0.02) 0%, rgba(28, 28, 28,0.02) 33%,transparent 33%, transparent 40%,rgba(220, 220, 220,0.02) 40%, rgba(220, 220, 220,0.02) 100%),linear-gradient(90deg, rgb(255,255,255),rgb(255,255,255))[{/capture}]
[{capture assign="d3dw_noitemmessageid"}]D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED[{/capture}]
[{include file="d3Wizards.tpl" submit="d3ExportSubmit.tpl"}]

View File

@ -15,7 +15,7 @@
} }
/* Image courtesy of gradientmagic.com */ /* Image courtesy of gradientmagic.com */
body { body {
background-image: linear-gradient(22.5deg, rgba(66, 66, 66, 0.02) 0%, rgba(66, 66, 66, 0.02) 11%,rgba(135, 135, 135, 0.02) 11%, rgba(135, 135, 135, 0.02) 24%,rgba(29, 29, 29, 0.02) 24%, rgba(29, 29, 29, 0.02) 38%,rgba(15, 15, 15, 0.02) 38%, rgba(15, 15, 15, 0.02) 50%,rgba(180, 180, 180, 0.02) 50%, rgba(180, 180, 180, 0.02) 77%,rgba(205, 205, 205, 0.02) 77%, rgba(205, 205, 205, 0.02) 100%),linear-gradient(67.5deg, rgba(10, 10, 10, 0.02) 0%, rgba(10, 10, 10, 0.02) 22%,rgba(52, 52, 52, 0.02) 22%, rgba(52, 52, 52, 0.02) 29%,rgba(203, 203, 203, 0.02) 29%, rgba(203, 203, 203, 0.02) 30%,rgba(69, 69, 69, 0.02) 30%, rgba(69, 69, 69, 0.02) 75%,rgba(231, 231, 231, 0.02) 75%, rgba(231, 231, 231, 0.02) 95%,rgba(138, 138, 138, 0.02) 95%, rgba(138, 138, 138, 0.02) 100%),linear-gradient(112.5deg, rgba(221, 221, 221, 0.02) 0%, rgba(221, 221, 221, 0.02) 17%,rgba(190, 190, 190, 0.02) 17%, rgba(190, 190, 190, 0.02) 39%,rgba(186, 186, 186, 0.02) 39%, rgba(186, 186, 186, 0.02) 66%,rgba(191, 191, 191, 0.02) 66%, rgba(191, 191, 191, 0.02) 68%,rgba(16, 16, 16, 0.02) 68%, rgba(16, 16, 16, 0.02) 70%,rgba(94, 94, 94, 0.02) 70%, rgba(94, 94, 94, 0.02) 100%),linear-gradient(90deg, #ffffff,#ffffff); background-image: [{$d3dw_backgroundimage}];
} }
h4 .btn { h4 .btn {
font-size: 1.3rem; font-size: 1.3rem;
@ -23,10 +23,14 @@
h5.card-header { h5.card-header {
font-size: 1.1rem; font-size: 1.1rem;
} }
.formElements label {
display: inline-block;
margin: .5rem 0;
}
</style> </style>
[{capture name="d3script"}][{strip}] [{capture name="d3script"}][{strip}]
function startAction(id) { function startTask(id, format = '') {
let elements = document.getElementsByClassName('errorbox'); let elements = document.getElementsByClassName('errorbox');
for (var i = 0; i < elements.length; i++){ for (var i = 0; i < elements.length; i++){
elements[i].style.display = 'none'; elements[i].style.display = 'none';
@ -37,7 +41,8 @@
}, 3000); }, 3000);
document.getElementById('mask').className='on'; document.getElementById('mask').className='on';
document.getElementById('popup2').className='d3loader-2 on'; document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('actionid').value = id; document.getElementById('taskid').value = id;
document.getElementById('format').value = format;
document.getElementById('myedit').submit(); document.getElementById('myedit').submit();
} }
[{/strip}][{/capture}] [{/strip}][{/capture}]
@ -46,8 +51,9 @@
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;"> <form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;">
[{$oViewConf->getHiddenSid()}] [{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]"> <input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="doAction"> <input type="hidden" name="fnc" value="runTask">
<input type="hidden" name="actionid" id="actionid" value=""> <input type="hidden" name="taskid" id="taskid" value="">
<input type="hidden" name="format" id="format" value="CSV">
[{assign var="groups" value=$oView->getGroups()}] [{assign var="groups" value=$oView->getGroups()}]
[{if $groups|@count}] [{if $groups|@count}]
@ -65,24 +71,39 @@
<div id="collapse[{$group}]" class="collapse" aria-labelledby="heading[{$group}]" data-parent="#accordion"> <div id="collapse[{$group}]" class="collapse" aria-labelledby="heading[{$group}]" data-parent="#accordion">
<div class="card-body pb-0"> <div class="card-body pb-0">
<div class="row"> <div class="row">
[{foreach from=$oView->getGroupActions($group) key="id" item="action"}] [{foreach from=$oView->getGroupTasks($group) key="id" item="item"}]
<div class="col-sm-6 col-md-4 col-lg-3 pb-4"> <div class="col-sm-6 col-md-4 col-lg-3 pb-4">
<div class="card"> <div class="card">
<h5 class="card-header"> <h5 class="card-header">
[{$action->getTitle()}] [{$item->getTitle()}]
</h5> </h5>
<div class="card-body"> <div class="card-body">
<p class="card-text"> [{if $item->getDescription()}]
[{$action->getDescription()}] [{assign var="description" value=$item->getDescription()}]
</p> [{assign var="sectionlength" value="100"}]
<div class="btn-group"> [{if $description|count_characters:true <= $sectionlength}]
<button type="button" class="btn btn-primary" onclick="startAction('[{$id}]')"> <p class="card-text">[{$description}]</p>
<i class="fas fa-magic"></i> [{else}]
[{oxmultilang ident=$action->getButtonText()}] [{assign var="shorttext" value=$description|truncate:$sectionlength:''}]
</button> <p class="card-text" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample" style="cursor: pointer">
</div> [{$shorttext}]...
</p>
<p class="card-text collapse" id="collapseExample">
...[{$description|replace:$shorttext:''}]
</p>
[{/if}]
[{/if}]
[{if $item->hasFormElements()}]
[{foreach from=$item->getFormElements() item="formElement"}]
[{$formElement}]
[{/foreach}]
[{/if}]
[{block name="exportSubmit"}]
[{include file=$submit}]
[{/block}]
</div> </div>
</div> </div>
</div> </div>
@ -98,7 +119,7 @@
</div> </div>
[{else}] [{else}]
<div class="alert alert-primary" role="alert"> <div class="alert alert-primary" role="alert">
[{oxmultilang ident="D3_DATAWIZARD_ERR_NOACTION_INSTALLED"}] [{oxmultilang ident=$d3dw_noitemmessageid}]
</div> </div>
[{/if}] [{/if}]
</form> </form>

View File

@ -0,0 +1,8 @@
[{block name="submitElements"}]
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="startTask('[{$id}]')">
<i class="fas fa-fw fa-magic"></i>
[{oxmultilang ident=$item->getButtonText()}]
</button>
</div>
[{/block}]

View File

@ -0,0 +1,24 @@
[{block name="submitElements"}]
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="startTask('[{$id}]', 'CSV')">
<i class="fas fa-fw fa-magic"></i>
[{oxmultilang ident=$item->getButtonText()}]
</button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">
<i class="fas fa-fw fa-magic"></i>
[{oxmultilang ident=$item->getButtonText()}]
</span>
</button>
<div class="dropdown-menu">
[{block name="dataWizardFormat"}]
[{assign var="rendererBridge" value=$item->getRendererBridge()}]
[{foreach from=$rendererBridge->getTranslatedRendererIdList() key="key" item="translationId"}]
<button class="dropdown-item" onclick="startTask('[{$id}]', '[{$key}]')">
[{oxmultilang ident=$translationId}]
</button>
[{/foreach}]
[{/block}]
</div>
</div>
[{/block}]

View File

@ -1,5 +1,46 @@
# Changelog # Changelog
## 1.4.0.0 (2021-11-11)
#### Added
- add JSON export renderer
- add tpl block for easier extension
- enable controller based exception handling
#### Changed
- change deprecated CSV export code
- show registered export renderers in admin submit without required tpl block extension
- force get translations from admin
---
## 1.3.1.0 (2021-09-10)
- installable in OXID 6.3.1
---
## 1.3.0.0 (2021-07-29)
- can handle long task description text
- has more generic admin controller templates
---
## 1.2.0.0 (2021-07-27)
- adjustments for CLI extension
- fix OXID 6.1 incompatibilities
---
## 1.1.0.0 (2021-06-25)
- implement form builder
- fix key figures export
---
## 1.0.0.0 (2021-06-22) ## 1.0.0.0 (2021-06-22)
- initial implementation - initial implementation

View File

@ -1,4 +1,5 @@
> [deutsche Version](README.md) [![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md)
[![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md)
# DÂł Data Wizard for OXID eShop # DÂł Data Wizard for OXID eShop
@ -6,11 +7,11 @@ The module `DataWizard` offers a framework for the simple integration of exports
The exports are defined via database queries or ready-made data lists. Various export formats are available. The generation is possible at any time and always recurring (within the system limits). These are offered as downloads in the browser. The exports are defined via database queries or ready-made data lists. Various export formats are available. The generation is possible at any time and always recurring (within the system limits). These are offered as downloads in the browser.
All exports are grouped together for better clarity. All exports and tasks are grouped together for better clarity.
Sample exports are included in the scope of delivery. These are intended to serve as an implementation reference for individual exports. The display of the sample exports can be deactivated in the basic module settings. Sample exports are included in the package d3/datawizardtasks. These are intended to serve as an implementation reference for individual exports.
Translated with www.DeepL.com/Translator (free version) ![administration area](assets/administration_exports.jpg "administration area")
## Installation ## Installation
@ -20,51 +21,30 @@ In the console in the shop root (above source and vendor), execute the following
php composer require d3/datawizard php composer require d3/datawizard
``` ```
Activate in the admin area of the shop under "Extensions -> Modules". Activate the module in the admin area of the shop in "Extensions -> Modules".
# Extensibility ## Extensibility
The module represents the technical basic framework of the exports and does not claim to be complete. In order to adapt the scope to individual requirements, the following extensions are prepared: The module represents the technical basic framework of the exports and does not claim to be complete. In order to adapt the scope to individual requirements, the following extensions are prepared:
- Add exports - Add exports or tasks
- Use existing and new groups - Use existing and new groups
- Add export formats - Add export formats
Independently of this, all extension options are available that the OXID Shop provides for modules. Independently of this, all extension options are available that the OXID Shop provides for modules.
## Add exports ## Extension packages
### Define export - `d3/datawizardtasks` - provides sample exports and their implementation reference
- `d3/datawizardcli` - provides the execution of exports or tasks via the command prompt (e.g. as cronjobs)
Each export is defined in a separate class. This export class must extend the class `D3\DataWizard\Application\Model\ExportBase`. All necessary functions are predefined in it. The following methods are available: - `d3/datawizardlink` - provides URLs to generate exports from third party systems
#### mandatory method calls:
- getTitle() - defines the title in the admin area and the base of the later export file name.
- getQuery() - contains the query as a prepared statement that defines the data to be exported
#### optional method calls:
- getDescription() - contains a short additional description of the export, this will be shown in the admin area
- getButtonText() - defines the text of the submit button in the admin area
- getExportFilenameBase() - defines the base of the later export filename
- executeQuery() - returns the compiled export data
- further methods, the adaptation of which, however, can lead to changed module behaviour and should therefore only be changed with caution
### Register exports
In order to be able to use the created export in the module, it must be registered. For this purpose there is the class `D3\DataWizard\Application\Model\Configuration`. This is to be overloaded with the possibilities of the OXID shop and the method `configure()` contained therein is to be supplemented. The following call is available for registering an export:
```
$this->registerExport(self::GROUP_CATEGORY, oxNew(myCustomExport::class));
```
The first parameter contains the language identifier for the export group. Typical identifiers are already prepared in constants of the configuration class. The instance of the export class is expected as the 2nd parameter.
## Changelog ## Changelog
See [CHANGELOG](CHANGELOG.md) for further informations. See [CHANGELOG](CHANGELOG.md) for further informations.
## Licence of this software (d3/datawizard) ## Licence of this software (d3/datawizard)
(status: 06.05.2021) (status: 2021-05-06)
``` ```
Copyright (c) D3 Data Development (Inh. Thomas Dartsch) Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
@ -92,7 +72,7 @@ Gradients available on the site are free to use on personal and commercial proje
The following software packages are not part of this module. However, they are required for use. The linked packages are under the following licences: The following software packages are not part of this module. However, they are required for use. The linked packages are under the following licences:
### league/csv [MIT] ### league/csv [MIT]
(https://github.com/thephpleague/csv - status: 06.05.2021) (https://github.com/thephpleague/csv - status: 2021-05-06)
``` ```
Copyright (c) 2013-2017 ignace nyamagana butera Copyright (c) 2013-2017 ignace nyamagana butera
@ -116,7 +96,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
``` ```
### mathieuviossat/arraytotexttable [MIT] ### mathieuviossat/arraytotexttable [MIT]
(https://github.com/viossat/arraytotexttable - status: 06.05.2021) (https://github.com/viossat/arraytotexttable - status: 2021-05-06)
``` ```
Copyright (c) 2015 Mathieu Viossat Copyright (c) 2015 Mathieu Viossat

View File

@ -1,14 +1,17 @@
> [english version](README.en.md) [![deutsche Version](https://logos.oxidmodule.com/de2_xs.svg)](README.md)
[![english version](https://logos.oxidmodule.com/en2_xs.svg)](README.en.md)
# DÂł Data Wizard fĂĽr OXID eShop # DÂł Data Wizard fĂĽr OXID eShop
Das Modul `DataWizard` bietet ein Framework zur einfachen Integration von Exporten ĂĽber den Adminbereich des OXID Shops. Das Modul `DataWizard` bietet ein Framework zur einfachen Integration von Exporten und ausfĂĽhrbaren Tasks ĂĽber den Adminbereich des OXID Shops.
Die Exporte werden über Datenbankabfragen oder fertige Datenlisten definiert. Es stehen verschiedene Exportformate zur Verfügung. Die Generierung ist jederzeit und immer wiederkehrend möglich (im Rahmen der Systemgrenzen). Diese werden im Browser als Download angeboten. Die Exporte werden über Datenbankabfragen oder fertige Datenlisten definiert. Es stehen verschiedene Exportformate zur Verfügung. Die Generierung ist jederzeit und immer wiederkehrend möglich (im Rahmen der Systemgrenzen). Diese werden im Browser als Download angeboten.
Alle Exporte sind fĂĽr eine bessere Ăśbersichtlichkeit in Gruppen zusammengefasst. Alle Exporte bzw. Tasks sind fĂĽr eine bessere Ăśbersichtlichkeit in Gruppen zusammengefasst.
Im Lieferumfang sind Beispielexporte enthalten. Diese sollen als Implementierungsreferenz fĂĽr individuelle Exporte dienen. Die Anzeige der Beispielexporte kann in den Modulgrundeinstellungen deaktiviert werden. Im Paket d3/datawizardtasks sind Beispielexporte enthalten. Diese sollen als Implementierungsreferenz fĂĽr individuelle Exporte dienen.
![Adminbereich](assets/administration_exports.jpg "Adminbereich")
## Schnellinstallation ## Schnellinstallation
@ -18,42 +21,23 @@ Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl au
php composer require d3/datawizard php composer require d3/datawizard
``` ```
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
## Erweiterbarkeit ## Erweiterbarkeit
Das Modul stellt das technische Grundgerüst der Exporte dar und erhebt keinen Anspruch auf Vollständigkeit. Um den Umfang an die individuellen Anforderungen anzupassen, sind folgende Erweiterungen vorbereitet: Das Modul stellt das technische Grundgerüst der Exporte dar und erhebt keinen Anspruch auf Vollständigkeit. Um den Umfang an die individuellen Anforderungen anzupassen, sind folgende Erweiterungen vorbereitet:
- Exporte hinzufĂĽgen - Exporte oder Tasks hinzufĂĽgen
- Verwendung bestehender und neuer Gruppen - Verwendung bestehender und neuer Gruppen
- Exportformate ergänzen - Exportformate ergänzen
Unabhängig dessen stehen alle Erweiterungsmöglichkeiten zur Verfügung, die der OXID Shop für Module bereitstellt. Unabhängig dessen stehen alle Erweiterungsmöglichkeiten zur Verfügung, die der OXID Shop für Module bereitstellt.
### Exporte hinzufĂĽgen ## Erweiterungspakete
#### Export definieren - `d3/datawizardtasks` - liefert Beispielexporte und deren Implementierungsreferenz
- `d3/datawizardcli` - ermöglicht die Ausführung der Exporte oder Tasks über die Eingabeaufforderung (z.B. als Cronjobs)
Jeder Export wird in einer separaten Klasse definiert. Diese Exportklasse muss die Klasse `D3\DataWizard\Application\Model\ExportBase` erweitern. Darin sind alle nötigen Funktionen vordefiniert. Folgende Methoden stehen hierbei zur Verfügung: - `d3/datawizardlink` - stellt URLs zur Verfügung, um Exporte von Drittsystemen generieren zu lassen
##### verpflichtende Methodenaufrufe:
- getTitle() - definiert den Titel im Adminbereich und die Basis des späteren Exportdateinamens
- getQuery() - enthält den Abfragequery als prepared statement, der die zu exportierenden Daten definiert
##### optionale Methodenaufrufe:
- getDescription() - enthält eine kurze zusätzliche Beschreibung des Exports, dieser wird im Adminbereich gezeigt
- getButtonText() - definiert den Text des Absenden-Buttons im Adminbereich
- getExportFilenameBase() - definiert die Basis des späteren Exportdateinamens
- executeQuery() - liefert die zusammengestellten Exportdaten
- weitere Methoden, deren Anpassung jedoch zum geänderten Modulverhalten führen können und daher nur mit Vorsicht zu verändern sind
#### Exporte registrieren
Um den erstellten Export auch im Modul verwenden zu können, muss dieser noch registriert werden. Hierzu gibt des die Klasse `D3\DataWizard\Application\Model\Configuration`. Diese ist mit den Möglichkeiten des OXID Shops zu überladen und die darin enthaltene Methode `configure()` zu ergänzen. Für die Registrierung eines Exportes steht Ihnen dazu folgender Aufruf zur Verfügung:
```
$this->registerExport(self::GROUP_CATEGORY, oxNew(myCustomExport::class));
```
Der erste Parameter enthält den Sprachident für die Exportgruppe. In Konstanten der configuration-Klasse sind schon typische Idents vorbereitet. Als 2. Parameter wird die Instanz der Exportklasse erwartet.
## Changelog ## Changelog

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -26,16 +26,25 @@
], ],
"require": { "require": {
"php": ">=7.1", "php": ">=7.1",
"oxid-esales/oxideshop-ce": "6.3 - 6.8", "oxid-esales/oxideshop-ce": "6.3 - 6.9",
"league/csv": "^9.0", "league/csv": "^9.0",
"mathieuviossat/arraytotexttable": "^1.0" "mathieuviossat/arraytotexttable": "^1.0",
"form-manager/form-manager": "^5.1 || ^6.1"
}, },
"extra": { "extra": {
"oxideshop": { "oxideshop": {
"source-directory": "/src", "blacklist-filter": [
"*.md",
"composer.json"
],
"target-directory": "d3/datawizard" "target-directory": "d3/datawizard"
} }
}, },
"suggest": {
"d3/datawizardtasks": "useful example tasks for Data Wizard",
"d3/datawizardcli": "command line implementation for fully automated Data Wizard tasks",
"d3/datawizardlink": "remote http link for Data Wizard module exports"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"D3\\DataWizard\\": "../../../source/modules/d3/datawizard" "D3\\DataWizard\\": "../../../source/modules/d3/datawizard"

View File

@ -32,7 +32,7 @@ $aModule = [
'en' => '', 'en' => '',
], ],
'thumbnail' => '', 'thumbnail' => '',
'version' => '0.1', 'version' => '1.4.0.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)', 'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',
@ -45,6 +45,9 @@ $aModule = [
'templates' => [ 'templates' => [
'd3ExportWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ExportWizard.tpl', 'd3ExportWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ExportWizard.tpl',
'd3ActionWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ActionWizard.tpl', 'd3ActionWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ActionWizard.tpl',
'd3Wizards.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/Wizards.tpl',
'd3ExportSubmit.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/exportSubmit.tpl',
'd3ActionSubmit.tpl' => 'd3/datawizard/Application/views/admin/tpl/inc/actionSubmit.tpl',
], ],
'settings' => [ 'settings' => [
[ [
@ -52,13 +55,7 @@ $aModule = [
'name' => $sModuleId.'_debug', 'name' => $sModuleId.'_debug',
'type' => 'bool', 'type' => 'bool',
'value' => false 'value' => false
], ]
[
'group' => $sModuleId.'_general',
'name' => $sModuleId.'_hideexamples',
'type' => 'bool',
'value' => false
],
], ],
'blocks' => [] 'blocks' => []
]; ];

View File

@ -1,89 +0,0 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\Actions;
use D3\DataWizard\Application\Model\ActionBase;
use OxidEsales\Eshop\Core\Model\BaseModel;
use OxidEsales\Eshop\Core\Model\MultiLanguageModel;
use OxidEsales\Eshop\Core\Registry;
class FixArtextendsItems extends ActionBase
{
/**
* fehlende oxartextends-Eintr<74>ge nachtragen
*/
/**
* @return string
*/
public function getTitle() : string
{
return Registry::getLang()->translateString('D3_DATAWIZARD_ACTIONS_FIXARTEXTENDSITEMS');
}
/**
* @return array
*/
public function getQuery() : array
{
$aDefaultValueFields = array(
'oxtimestamp' => "''",
);
$aNonArtExtendsFields = array(
'oxid' => 'oxarticles.oxid',
);
$aArtExtendsFields = array_fill_keys($this->getArtExtendsFields(), "''");
$aMergedFields = array_merge($aNonArtExtendsFields, $aArtExtendsFields);
$aQueryFields = array_diff_key($aMergedFields, $aDefaultValueFields);
$sArtExtendsFields = implode(', ', array_keys($aQueryFields));
$select = "SELECT ".implode(', ', $aQueryFields).
" FROM oxarticles".
" LEFT JOIN oxartextends AS arx ON oxarticles.oxid = arx.oxid".
" WHERE arx.oxid IS NULL";
$query = "INSERT INTO oxartextends ($sArtExtendsFields) ".
$select;
return [$query, []];
}
/**
* @return array
*/
public function getArtExtendsFields(): array
{
/** @var $oArtExtends MultiLanguageModel */
$oArtExtends = oxNew(BaseModel::class);
$oArtExtends->init('oxartextends', false);
$aFieldNames = $oArtExtends->getFieldNames();
if (false == $aFieldNames) {
$oArtExtends->disableLazyLoading();
$aFieldNames = $oArtExtends->getFieldNames();
}
unset($aFieldNames[array_search('oxid', $aFieldNames)]);
return $aFieldNames;
}
}

View File

@ -1,44 +0,0 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\DataWizard\Application\Model\ExportRenderer;
use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException;
class RendererBridge
{
const FORMAT_CSV = 'CSV';
const FORMAT_PRETTY = 'Pretty';
/**
* @param string $format
*
* @throws NoSuitableRendererException
* @return RendererInterface
*/
public function getRenderer($format = self::FORMAT_CSV): RendererInterface
{
switch ($format) {
case self::FORMAT_CSV:
return oxNew(Csv::class);
case self::FORMAT_PRETTY:
return oxNew(Pretty::class);
}
/** @var NoSuitableRendererException $e */
$e = oxNew(NoSuitableRendererException::class, $format);
throw $e;
}
}

View File

@ -1,77 +0,0 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\DataWizard\Application\Model\Exports;
use D3\DataWizard\Application\Model\ExportBase;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\Category;
use OxidEsales\Eshop\Application\Model\Object2Category;
use OxidEsales\Eshop\Core\Registry;
class InactiveCategories extends ExportBase
{
/**
* Kategorien -deaktiviert, mit aktiven Artikel
*/
/**
* @return string
*/
public function getTitle() : string
{
return Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES');
}
/**
* @return array
*/
public function getQuery() : array
{
$categoryTableName = oxNew(Category::class)->getCoreTableName();
$object2categoryTableName = oxNew(Object2Category::class)->getCoreTableName();
$articleTableName = oxNew(Article::class)->getCoreTableName();
$treeTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE');
$titleTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE');
$countTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT');
return [
"SELECT
oc.OXID,
oc.OXSHOPID,
oc.oxtitle as :titleTitle,
(
SELECT GROUP_CONCAT(oxtitle ORDER BY oxleft ASC SEPARATOR ' > ')
from ".$categoryTableName."
WHERE OXLEFT < oc.oxleft AND OXRIGHT > oc.oxright AND OXROOTID = oc.OXROOTID AND OXSHOPID = oc.OXSHOPID
) as :treeTitle,
COUNT(oa.oxid) as :countTitle
FROM ".$categoryTableName." oc
LEFT JOIN ".$object2categoryTableName." o2c ON oc.OXID = o2c.OXCATNID
LEFT JOIN ".$articleTableName." oa ON o2c.OXOBJECTID = oa.OXID
WHERE oc.OXACTIVE = :categoryActive AND oa.OXACTIVE = :articleActive
GROUP BY oc.oxid
ORDER BY oc.oxleft ASC",
[
'categoryActive' => 0,
'articleActive' => 1,
'titleTitle' => $titleTitle,
'treeTitle' => $treeTitle,
'countTitle' => $countTitle
]
];
}
}

View File

@ -1,62 +0,0 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\DataWizard\Application\Model\Exports;
use D3\DataWizard\Application\Model\ExportBase;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\Registry;
class KeyFigures extends ExportBase
{
/**
* Shopkennzahlen
*/
/**
* @return string
*/
public function getTitle() : string
{
return Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES');
}
/**
* @return array
*/
public function getQuery() : array
{
$orderTable = oxNew(Order::class)->getCoreTableName();
$ordersTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_ORDERSPERMONTH');
$basketsTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE');
$monthTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH');
return [
'SELECT
DATE_FORMAT(oo.oxorderdate, "%Y-%m") as :monthTitle,
FORMAT(COUNT(oo.oxid), 0) AS :ordersTitle,
FORMAT(SUM(oo.OXTOTALBRUTSUM / oo.oxcurrate) / COUNT(oo.oxid), 2) as :basketsTitle
FROM '.$orderTable.' AS oo
GROUP BY :monthTitle
ORDER BY :monthTitle DESC
LIMIT 30',
[
'monthTitle' => $monthTitle,
'ordersTitle' => $ordersTitle,
'basketsTitle' => $basketsTitle
]
];
}
}

View File

@ -1,133 +0,0 @@
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
[{oxstyle include="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"}]
[{oxscript include="https://code.jquery.com/jquery-3.2.1.slim.min.js"}]
[{oxscript include="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"}]
[{oxscript include="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"}]
[{oxstyle include="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/solid.min.css"}]
<style>
button {
margin: 1em 1em 1em 5em;
}
html {
font-size: 0.8em;
}
/* Image courtesy of gradientmagic.com */
body {
background-image: linear-gradient(339deg, rgba(47, 47, 47,0.02) 0%, rgba(47, 47, 47,0.02) 42%,transparent 42%, transparent 99%,rgba(17, 17, 17,0.02) 99%, rgba(17, 17, 17,0.02) 100%),linear-gradient(257deg, rgba(65, 65, 65,0.02) 0%, rgba(65, 65, 65,0.02) 11%,transparent 11%, transparent 92%,rgba(53, 53, 53,0.02) 92%, rgba(53, 53, 53,0.02) 100%),linear-gradient(191deg, rgba(5, 5, 5,0.02) 0%, rgba(5, 5, 5,0.02) 1%,transparent 1%, transparent 45%,rgba(19, 19, 19,0.02) 45%, rgba(19, 19, 19,0.02) 100%),linear-gradient(29deg, rgba(28, 28, 28,0.02) 0%, rgba(28, 28, 28,0.02) 33%,transparent 33%, transparent 40%,rgba(220, 220, 220,0.02) 40%, rgba(220, 220, 220,0.02) 100%),linear-gradient(90deg, rgb(255,255,255),rgb(255,255,255));
}
h4 .btn {
font-size: 1.3rem;
}
h5.card-header {
font-size: 1.1rem;
}
</style>
[{capture name="d3script"}][{strip}]
function startExport(id, format) {
let elements = document.getElementsByClassName('errorbox');
for (var i = 0; i < elements.length; i++){
elements[i].style.display = 'none';
}
setTimeout(function(){
document.getElementById('mask').className='';
document.getElementById('popup2').className='d3loader-2';
}, 3000);
document.getElementById('mask').className='on';
document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('exportid').value = id;
document.getElementById('exportformat').value = format;
document.getElementById('myedit').submit();
}
[{/strip}][{/capture}]
[{oxscript add=$smarty.capture.d3script}]
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="fnc" value="doExport">
<input type="hidden" name="exportid" id="exportid" value="">
<input type="hidden" name="exportformat" id="exportformat" value="CSV">
[{assign var="groups" value=$oView->getGroups()}]
[{if $groups|@count}]
<div id="accordion">
[{foreach from=$oView->getGroups() item="group"}]
<div class="card mb-2">
<div class="card-header p-1" id="heading[{$group}]">
<h4 class="mb-0">
<span class="btn p-1" data-toggle="collapse" data-target="#collapse[{$group}]" aria-expanded="false" aria-controls="collapse[{$group}]">
[{oxmultilang ident=$group}]
</span>
</h4>
</div>
<div id="collapse[{$group}]" class="collapse" aria-labelledby="heading[{$group}]" data-parent="#accordion">
<div class="card-body pb-0">
<div class="row">
[{foreach from=$oView->getGroupExports($group) key="id" item="export"}]
<div class="col-sm-6 col-md-4 col-lg-3 pb-4">
<div class="card">
<h5 class="card-header">
[{$export->getTitle()}]
</h5>
<div class="card-body">
<p class="card-text">
[{$export->getDescription()}]
</p>
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="startExport('[{$id}]', 'CSV')">
<i class="fas fa-magic"></i>
[{oxmultilang ident=$export->getButtonText()}]
</button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">
<i class="fas fa-magic"></i>
[{oxmultilang ident=$export->getButtonText()}]
</span>
</button>
<div class="dropdown-menu">
[{block name="dataWizardExportFormat"}]
<button class="dropdown-item" onclick="startExport('[{$id}]', 'CSV')">
[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_CSV"}]
</button>
<button class="dropdown-item" onclick="startExport('[{$id}]', 'Pretty')">
[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_PRETTY"}]
</button>
[{/block}]
</div>
</div>
</div>
</div>
</div>
[{/foreach}]
</div>
<div class="clear"></div>
</div>
</div>
</div>
[{/foreach}]
</div>
[{else}]
<div class="alert alert-primary" role="alert">
[{oxmultilang ident="D3_DATAWIZARD_ERR_NOEXPORT_INSTALLED"}]
</div>
[{/if}]
</form>
<div id="mask" class=""></div>
<div id="popup2" class="d3loader-2">
<div class="d3loader-spinner">
<div class="d3loader-circle-1"></div>
<div class="d3loader-circle-2"></div>
<div class="d3loader-circle-3"></div>
</div>
</div>
[{include file="d3_cfg_mod_inc.tpl"}]