Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
f2935209ed
|
|||
a7e6c91042
|
|||
9e9a0fdd4c
|
|||
eef594d970
|
|||
759e8a377d
|
|||
f42c42cbe4
|
|||
baf30ef196
|
|||
8b354993ca
|
|||
4c91b0d699
|
|||
34b2b0b061
|
|||
9e9bab88f0
|
|||
466e751a5c
|
|||
5367dfdb5a
|
@ -15,6 +15,10 @@ declare(strict_types=1);
|
||||
|
||||
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\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
@ -22,6 +26,8 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
abstract class ActionBase implements QueryBase
|
||||
{
|
||||
protected $formElements = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -36,6 +42,15 @@ abstract class ActionBase implements QueryBase
|
||||
*/
|
||||
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() );
|
||||
}
|
||||
|
||||
@ -81,4 +96,38 @@ abstract class ActionBase implements QueryBase
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
class FixArtextendsItems extends ActionBase
|
||||
{
|
||||
/**
|
||||
* fehlende oxartextends-Einträge nachtragen
|
||||
* fehlende oxartextends-Einträge nachtragen
|
||||
*/
|
||||
|
||||
/**
|
@ -16,6 +16,7 @@ declare(strict_types=1);
|
||||
namespace D3\DataWizard\Application\Model;
|
||||
|
||||
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\KeyFigures;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
@ -53,7 +54,7 @@ class Configuration
|
||||
*/
|
||||
public function registerAction($group, ActionBase $action)
|
||||
{
|
||||
$this->actions[$group][md5(serialize($action))] = $action;
|
||||
$this->actions[$group][md5(get_class($action))] = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +63,7 @@ class Configuration
|
||||
*/
|
||||
public function registerExport($group, ExportBase $export)
|
||||
{
|
||||
$this->exports[$group][md5(serialize($export))] = $export;
|
||||
$this->exports[$group][md5(get_class($export))] = $export;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,6 +163,12 @@ class Configuration
|
||||
*/
|
||||
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];
|
||||
}
|
||||
}
|
@ -17,6 +17,6 @@ namespace D3\DataWizard\Application\Model\Exceptions;
|
||||
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class RenderException extends StandardException implements DataWizardException
|
||||
class DataWizardException extends StandardException
|
||||
{
|
||||
}
|
@ -16,10 +16,9 @@ declare(strict_types=1);
|
||||
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
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 )
|
||||
{
|
32
Application/Model/Exceptions/ExportFileException.php
Normal file
32
Application/Model/Exceptions/ExportFileException.php
Normal 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 );
|
||||
}
|
||||
}
|
53
Application/Model/Exceptions/InputUnvalidException.php
Normal file
53
Application/Model/Exceptions/InputUnvalidException.php
Normal 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;
|
||||
}
|
||||
}
|
@ -16,10 +16,9 @@ declare(strict_types=1);
|
||||
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
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 )
|
||||
{
|
@ -15,6 +15,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\DataWizard\Application\Model\Exceptions;
|
||||
|
||||
interface DataWizardException
|
||||
class RenderException extends DataWizardException
|
||||
{
|
||||
}
|
@ -17,9 +17,8 @@ namespace D3\DataWizard\Application\Model\Exceptions;
|
||||
|
||||
use D3\DataWizard\Application\Model\QueryBase;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class TaskException extends StandardException implements DataWizardException
|
||||
class TaskException extends DataWizardException
|
||||
{
|
||||
/** @var QueryBase */
|
||||
public $task;
|
@ -15,11 +15,16 @@ declare(strict_types=1);
|
||||
|
||||
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\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
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\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
@ -28,6 +33,8 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
abstract class ExportBase implements QueryBase
|
||||
{
|
||||
protected $formElements = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -38,6 +45,7 @@ abstract class ExportBase implements QueryBase
|
||||
|
||||
/**
|
||||
* @param string $format
|
||||
* @param $path
|
||||
*
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
@ -47,19 +55,36 @@ abstract class ExportBase implements QueryBase
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @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() );
|
||||
|
||||
$content = $this->renderContent($rows, $fieldNames, $format);
|
||||
|
||||
/** @var $oFS d3filesystem */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
$oFS->startDirectDownload(
|
||||
$oFS->filterFilename($this->getExportFileName($format)),
|
||||
$content
|
||||
);
|
||||
$oFS = oxNew( d3filesystem::class );
|
||||
if (is_null($path)) {
|
||||
$oFS->startDirectDownload( $oFS->filterFilename( $this->getExportFileName( $format ) ), $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 '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,4 +185,38 @@ abstract class ExportBase implements QueryBase
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -22,19 +22,32 @@ class RendererBridge
|
||||
const FORMAT_CSV = 'CSV';
|
||||
const FORMAT_PRETTY = 'Pretty';
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRendererList(): array
|
||||
{
|
||||
return [
|
||||
self::FORMAT_CSV => oxNew(Csv::class),
|
||||
self::FORMAT_PRETTY => oxNew(Pretty::class)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $format
|
||||
*
|
||||
* @throws NoSuitableRendererException
|
||||
* @return RendererInterface
|
||||
* @throws NoSuitableRendererException
|
||||
*/
|
||||
public function getRenderer($format = self::FORMAT_CSV): RendererInterface
|
||||
public function getRenderer(string $format = self::FORMAT_CSV): RendererInterface
|
||||
{
|
||||
switch ($format) {
|
||||
case self::FORMAT_CSV:
|
||||
return oxNew(Csv::class);
|
||||
case self::FORMAT_PRETTY:
|
||||
return oxNew(Pretty::class);
|
||||
$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 */
|
@ -24,7 +24,7 @@ use OxidEsales\Eshop\Core\Registry;
|
||||
class InactiveCategories extends ExportBase
|
||||
{
|
||||
/**
|
||||
* Kategorien -deaktiviert, mit aktiven Artikel
|
||||
* Kategorien -deaktiviert, mit aktiven Artikeln
|
||||
*/
|
||||
|
||||
/**
|
@ -16,15 +16,45 @@
|
||||
namespace D3\DataWizard\Application\Model\Exports;
|
||||
|
||||
use D3\DataWizard\Application\Model\ExportBase;
|
||||
use FormManager\Inputs\Date;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use FormManager\Factory as FormFactory;
|
||||
|
||||
class KeyFigures extends ExportBase
|
||||
{
|
||||
const STARTDATE_NAME = 'startdate';
|
||||
const ENDDATE_NAME = 'enddate';
|
||||
|
||||
/**
|
||||
* Shopkennzahlen
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/** @var Date $startDate */
|
||||
$startDateValue = Registry::getRequest()->getRequestEscapedParameter(self::STARTDATE_NAME);
|
||||
$startDate = FormFactory::date(
|
||||
Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_FIELD_STARTDATE'),
|
||||
[
|
||||
'name' => self::STARTDATE_NAME,
|
||||
'value' => $startDateValue
|
||||
]
|
||||
);
|
||||
$this->registerFormElement($startDate);
|
||||
|
||||
/** @var Date $endDate */
|
||||
$endDateValue = Registry::getRequest()->getRequestEscapedParameter(self::ENDDATE_NAME);
|
||||
$endDate = FormFactory::date(
|
||||
Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_FIELD_ENDDATE'),
|
||||
[
|
||||
'name' => self::ENDDATE_NAME,
|
||||
'value' => $endDateValue
|
||||
]
|
||||
);
|
||||
$this->registerFormElement($endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -43,19 +73,25 @@ class KeyFigures extends ExportBase
|
||||
$basketsTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE');
|
||||
$monthTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH');
|
||||
|
||||
$startDateValue = Registry::getRequest()->getRequestEscapedParameter(self::STARTDATE_NAME) ?: '1970-01-01';
|
||||
$endDateValue = Registry::getRequest()->getRequestEscapedParameter(self::ENDDATE_NAME) ?: date('Y-m-d');
|
||||
|
||||
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
|
||||
WHERE oo.oxorderdate >= :startDate AND oo.oxorderdate <= :endDate
|
||||
GROUP BY DATE_FORMAT(oo.oxorderdate, "%Y-%m")
|
||||
ORDER BY DATE_FORMAT(oo.oxorderdate, "%Y-%m") DESC
|
||||
LIMIT 30',
|
||||
[
|
||||
'monthTitle' => $monthTitle,
|
||||
'ordersTitle' => $ordersTitle,
|
||||
'basketsTitle' => $basketsTitle
|
||||
'startDate' => $startDateValue,
|
||||
'endDate' => $endDateValue,
|
||||
'monthTitle' => $monthTitle,
|
||||
'ordersTitle' => $ordersTitle,
|
||||
'basketsTitle' => $basketsTitle
|
||||
]
|
||||
];
|
||||
}
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace D3\DataWizard\Application\Model;
|
||||
|
||||
use FormManager\Inputs\Input;
|
||||
|
||||
interface QueryBase
|
||||
{
|
||||
public function run();
|
||||
@ -38,4 +40,19 @@ interface QueryBase
|
||||
* @return array [string $query, array $parameters]
|
||||
*/
|
||||
public function getQuery() : array;
|
||||
|
||||
/**
|
||||
* @param Input $input
|
||||
*/
|
||||
public function registerFormElement(Input $input);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasFormElements(): bool;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFormElements(): array;
|
||||
}
|
@ -48,13 +48,16 @@ $aLang = array(
|
||||
'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_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' => 'deaktivierte Kategorien, mit aktiven Artikeln',
|
||||
'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_FIELD_STARTDATE'=> 'Startdatum (optional)',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_FIELD_ENDDATE' => 'Enddatum (optional)',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'Bestellungen pro Monat',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE' => 'Warenkorbhöhe',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH' => 'Monat',
|
70
Application/views/admin/en/d3DataWizard_lang.php
Normal file
70
Application/views/admin/en/d3DataWizard_lang.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?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',
|
||||
'SHOP_MODULE_d3datawizard_hideexamples' => 'hide sample exports',
|
||||
|
||||
'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_USERS' => 'users',
|
||||
|
||||
'D3_DATAWIZARD_EXPORT_SUBMIT' => 'generate export',
|
||||
'D3_DATAWIZARD_EXPORT_FORMAT_CSV' => 'CSV format',
|
||||
'D3_DATAWIZARD_EXPORT_FORMAT_PRETTY' => 'Pretty 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_EXPORTS_INACTIVECATEGORIES' => 'deactivated categories, with active articles',
|
||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE' => 'tree',
|
||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE' => 'title',
|
||||
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT' => 'count',
|
||||
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES' => 'Order key figures by month',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_FIELD_STARTDATE'=> 'start date (optional)',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_FIELD_ENDDATE' => 'end date (optional)',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'orders per month',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE' => 'shopping cart value',
|
||||
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH' => 'month',
|
||||
|
||||
'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',
|
||||
'D3_DATAWIZARD_ACTIONS_FIXARTEXTENDSITEMS' => 'add missing oxartextends entries',
|
||||
);
|
@ -23,6 +23,10 @@
|
||||
h5.card-header {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.formElements label {
|
||||
display: inline-block;
|
||||
margin: .5rem 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
[{capture name="d3script"}][{strip}]
|
||||
@ -72,9 +76,17 @@
|
||||
[{$action->getTitle()}]
|
||||
</h5>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
[{$action->getDescription()}]
|
||||
</p>
|
||||
[{if $action->getDescription()}]
|
||||
<p class="card-text">
|
||||
[{$action->getDescription()}]
|
||||
</p>
|
||||
[{/if}]
|
||||
|
||||
[{if $action->hasFormElements()}]
|
||||
[{foreach from=$action->getFormElements() item="formElement"}]
|
||||
[{$formElement}]
|
||||
[{/foreach}]
|
||||
[{/if}]
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" onclick="startAction('[{$id}]')">
|
@ -23,6 +23,10 @@
|
||||
h5.card-header {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.formElements label {
|
||||
display: inline-block;
|
||||
margin: .5rem 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
[{capture name="d3script"}][{strip}]
|
||||
@ -74,9 +78,17 @@
|
||||
[{$export->getTitle()}]
|
||||
</h5>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
[{$export->getDescription()}]
|
||||
</p>
|
||||
[{if $export->getDescription()}]
|
||||
<p class="card-text">
|
||||
[{$export->getDescription()}]
|
||||
</p>
|
||||
[{/if}]
|
||||
|
||||
[{if $export->hasFormElements()}]
|
||||
[{foreach from=$export->getFormElements() item="formElement"}]
|
||||
[{$formElement}]
|
||||
[{/foreach}]
|
||||
[{/if}]
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" onclick="startExport('[{$id}]', 'CSV')">
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## 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)
|
||||
|
||||
- initial implementation
|
22
README.en.md
22
README.en.md
@ -10,8 +10,6 @@ All exports 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.
|
||||
|
||||
Translated with www.DeepL.com/Translator (free version)
|
||||
|
||||
## Installation
|
||||
|
||||
In the console in the shop root (above source and vendor), execute the following command:
|
||||
@ -20,9 +18,9 @@ In the console in the shop root (above source and vendor), execute the following
|
||||
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:
|
||||
|
||||
@ -32,24 +30,24 @@ The module represents the technical basic framework of the exports and does not
|
||||
|
||||
Independently of this, all extension options are available that the OXID Shop provides for modules.
|
||||
|
||||
## Add exports
|
||||
### Add exports
|
||||
|
||||
### Define export
|
||||
#### Define export
|
||||
|
||||
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:
|
||||
|
||||
#### mandatory method calls:
|
||||
##### 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:
|
||||
##### 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
|
||||
#### 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:
|
||||
|
||||
@ -64,7 +62,7 @@ The first parameter contains the language identifier for the export group. Typic
|
||||
See [CHANGELOG](CHANGELOG.md) for further informations.
|
||||
|
||||
## Licence of this software (d3/datawizard)
|
||||
(status: 06.05.2021)
|
||||
(status: 2021-05-06)
|
||||
|
||||
```
|
||||
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
@ -92,7 +90,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:
|
||||
|
||||
### 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
|
||||
@ -116,7 +114,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
|
||||
### 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
|
||||
|
@ -18,6 +18,8 @@ Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl au
|
||||
php composer require d3/datawizard
|
||||
```
|
||||
|
||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
||||
## 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:
|
||||
|
@ -28,11 +28,15 @@
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "6.3 - 6.8",
|
||||
"league/csv": "^9.0",
|
||||
"mathieuviossat/arraytotexttable": "^1.0"
|
||||
"mathieuviossat/arraytotexttable": "^1.0",
|
||||
"form-manager/form-manager": "^5.1 || ^6.1"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"source-directory": "/src",
|
||||
"blacklist-filter": [
|
||||
"*.md",
|
||||
"composer.json"
|
||||
],
|
||||
"target-directory": "d3/datawizard"
|
||||
}
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ $aModule = [
|
||||
'en' => '',
|
||||
],
|
||||
'thumbnail' => '',
|
||||
'version' => '0.1',
|
||||
'version' => '1.2.0.0',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
Reference in New Issue
Block a user