initial
This commit is contained in:
commit
ff4d316698
41
composer.json
Normal file
41
composer.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "d3/datawizard",
|
||||
"description": "das magische Datenwerkzeug",
|
||||
"type": "oxideshop-module",
|
||||
"keywords": [
|
||||
"oxid",
|
||||
"modules",
|
||||
"eShop",
|
||||
"d3",
|
||||
"export"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
||||
"email": "info@shopmodule.com",
|
||||
"homepage": "https://www.d3data.de",
|
||||
"role": "Owner"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"email": "support@shopmodule.com"
|
||||
},
|
||||
"homepage": "https://www.oxidmodule.com/",
|
||||
"license": [
|
||||
"proprietary"
|
||||
],
|
||||
"require": {
|
||||
"oxid-esales/oxideshop-ce": "~6.3"
|
||||
},
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"source-directory": "/src",
|
||||
"target-directory": "d3/datawizard"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\DataWizard\\": "../../../source/modules/d3/datawizard"
|
||||
}
|
||||
}
|
||||
}
|
9
readme.md
Normal file
9
readme.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Beschreibung
|
||||
|
||||
## Schnellinstallation
|
||||
|
||||
Auf der Konsole im Shoproot (oberhalb von source und vendor) folgenden Befehl ausführen:
|
||||
|
||||
```bash
|
||||
php composer require d3/datawizard:"dev-rel_1.x"
|
||||
```
|
133
src/Application/Controller/Admin/d3ExportWizard.php
Normal file
133
src/Application/Controller/Admin/d3ExportWizard.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?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\Controller\Admin;
|
||||
|
||||
use D3\DataWizard\Application\Model\Configuration;
|
||||
use D3\DataWizard\Application\Model\Exports\activeArticlesInactiveCategory;
|
||||
use D3\DataWizard\Application\Model\Exports\articlesWithoutManufacturers;
|
||||
use D3\DataWizard\Application\Model\Exports\emptyCategories;
|
||||
use D3\DataWizard\Application\Model\Exports\gappedArticleImages;
|
||||
use D3\DataWizard\Application\Model\Exports\inactiveCategories;
|
||||
use D3\DataWizard\Application\Model\Exports\inactiveParentCategory;
|
||||
use D3\DataWizard\Application\Model\Exports\noArticleTextSet;
|
||||
use D3\DataWizard\Application\Model\Exports\unreleasedRatings;
|
||||
use D3\DataWizard\Application\Model\Exports\wrongArticlePrice;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3ExportWizard extends AdminDetailsController
|
||||
{
|
||||
protected $_sThisTemplate = 'd3ExportWizard.tpl';
|
||||
|
||||
/** @var Configuration */
|
||||
protected $configuration;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->configuration = oxNew(Configuration::class);
|
||||
}
|
||||
|
||||
public function getGroups()
|
||||
{
|
||||
return $this->configuration->getGroups();
|
||||
}
|
||||
|
||||
public function getGroupExports($group)
|
||||
{
|
||||
return $this->configuration->getExportsByGroup($group);
|
||||
}
|
||||
|
||||
public function doExport()
|
||||
{
|
||||
$id = Registry::getRequest()->getRequestEscapedParameter('exportid');
|
||||
$this->configuration->getExportById($id)->run();
|
||||
}
|
||||
|
||||
public function getUserMessages()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getHelpURL()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function exportEmptyCategories()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\emptyCategories $export */
|
||||
$export = oxNew(emptyCategories::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportInactiveCategories()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\inactiveCategories $export */
|
||||
$export = oxNew(inactiveCategories::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportGappedArticleImages()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\gappedArticleImages $export */
|
||||
$export = oxNew(gappedArticleImages::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportNoArticleTextsSet()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\noArticleTextSet $export */
|
||||
$export = oxNew(noArticleTextSet::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportWrongArticlePrice()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\wrongArticlePrice $export */
|
||||
$export = oxNew(wrongArticlePrice::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportArticlesWithoutManufacturers()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\articlesWithoutManufacturers $export */
|
||||
$export = oxNew(articlesWithoutManufacturers::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportUnreleasedRatings()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\unreleasedRatings $export */
|
||||
$export = oxNew(unreleasedRatings::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportInactiveParentCategory()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\inactiveParentCategory $export */
|
||||
$export = oxNew(inactiveParentCategory::class);
|
||||
$export->run();
|
||||
}
|
||||
|
||||
public function exportActiveArticlesInactiveCategory()
|
||||
{
|
||||
/** @var \D3\DataWizard\Application\Model\Exports\activeArticlesInactiveCategory $export */
|
||||
$export = oxNew(activeArticlesInactiveCategory::class);
|
||||
$export->run();
|
||||
}
|
||||
}
|
97
src/Application/Model/Configuration.php
Normal file
97
src/Application/Model/Configuration.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?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;
|
||||
|
||||
use D3\DataWizard\Application\Model\Exports\activeArticlesInactiveCategory;
|
||||
use D3\DataWizard\Application\Model\Exports\articlesWithoutManufacturers;
|
||||
use D3\DataWizard\Application\Model\Exports\emptyCategories;
|
||||
use D3\DataWizard\Application\Model\Exports\gappedArticleImages;
|
||||
use D3\DataWizard\Application\Model\Exports\inactiveCategories;
|
||||
use D3\DataWizard\Application\Model\Exports\inactiveParentCategory;
|
||||
use D3\DataWizard\Application\Model\Exports\noArticleTextSet;
|
||||
use D3\DataWizard\Application\Model\Exports\unreleasedRatings;
|
||||
use D3\DataWizard\Application\Model\Exports\wrongArticlePrice;
|
||||
|
||||
class Configuration
|
||||
{
|
||||
const GROUP_CATEGORY = 'D3_DATAWIZARD_GROUP_CATEGORIES';
|
||||
const GROUP_ARTICLES = 'D3_DATAWIZARD_GROUP_ARTICLES';
|
||||
const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS';
|
||||
|
||||
protected $exports = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->configure();
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->registerExport( self::GROUP_ARTICLES, oxNew( activeArticlesInactiveCategory::class));
|
||||
$this->registerExport( self::GROUP_ARTICLES, oxNew( articlesWithoutManufacturers::class));
|
||||
$this->registerExport( self::GROUP_ARTICLES, oxNew( gappedArticleImages::class));
|
||||
$this->registerExport( self::GROUP_ARTICLES, oxNew( noArticleTextSet::class));
|
||||
$this->registerExport( self::GROUP_ARTICLES, oxNew( wrongArticlePrice::class));
|
||||
$this->registerExport( self::GROUP_CATEGORY, oxNew( emptyCategories::class));
|
||||
$this->registerExport( self::GROUP_CATEGORY, oxNew( inactiveCategories::class));
|
||||
$this->registerExport( self::GROUP_CATEGORY, oxNew( inactiveParentCategory::class));
|
||||
$this->registerExport( self::GROUP_REMARKS, oxNew( unreleasedRatings::class));
|
||||
}
|
||||
|
||||
public function registerExport($group, ExportBase $export)
|
||||
{
|
||||
$this->exports[$group][md5(serialize($export))] = $export;
|
||||
}
|
||||
|
||||
public function getGroupedExports()
|
||||
{
|
||||
return $this->exports;
|
||||
}
|
||||
|
||||
public function getGroups()
|
||||
{
|
||||
return array_keys($this->exports);
|
||||
}
|
||||
|
||||
public function getExportsByGroup($group)
|
||||
{
|
||||
return $this->exports[$group];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getAllExports() : array
|
||||
{
|
||||
$all = [];
|
||||
|
||||
foreach ($this->getGroups() as $group) {
|
||||
$all = array_merge($all, $this->getExportsByGroup($group));
|
||||
}
|
||||
|
||||
return $all;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
*
|
||||
* @return ExportBase
|
||||
*/
|
||||
public function getExportById($id) : ExportBase
|
||||
{
|
||||
return $this->getAllExports()[$id];
|
||||
}
|
||||
}
|
31
src/Application/Model/ExportBase.php
Normal file
31
src/Application/Model/ExportBase.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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;
|
||||
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
|
||||
abstract class ExportBase implements QueryBase
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
d3database::getInstance()->downloadExportCsvByQuery($this->getExportFilename(), $this->getQuery());
|
||||
}
|
||||
|
||||
public function getButtonText() : string
|
||||
{
|
||||
return "D3_DATAWIZARD_EXPORT_SUBMIT";
|
||||
}
|
||||
}
|
46
src/Application/Model/QueryBase.php
Normal file
46
src/Application/Model/QueryBase.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
|
||||
interface QueryBase
|
||||
{
|
||||
public function run();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExportFilename() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getButtonText() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getQuery() : string;
|
||||
}
|
37
src/Application/views/admin/de/d3DataWizard_lang.php
Normal file
37
src/Application/views/admin/de/d3DataWizard_lang.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
$sLangName = "Deutsch";
|
||||
// -------------------------------
|
||||
// RESOURCE IDENTITFIER = STRING
|
||||
// -------------------------------
|
||||
$aLang = array(
|
||||
|
||||
//Navigation
|
||||
'charset' => 'UTF-8',
|
||||
'd3mxDataWizard' => '<i class="fa fa-fw fas-hat-wizard"></i> Data Wizard',
|
||||
|
||||
'D3_DATAWIZARD_GROUP_ARTICLES' => 'Artikel',
|
||||
'D3_DATAWIZARD_GROUP_CATEGORIES' => 'Kategorien',
|
||||
'D3_DATAWIZARD_GROUP_REMARKS' => 'Bewertungen',
|
||||
|
||||
'D3_DATAWIZARD_EXPORT_SUBMIT' => 'Export starten'
|
||||
|
||||
// Abracadata
|
||||
// Harry Potter
|
||||
// Magic
|
||||
);
|
84
src/Application/views/admin/tpl/d3ExportWizard.tpl
Normal file
84
src/Application/views/admin/tpl/d3ExportWizard.tpl
Normal file
@ -0,0 +1,84 @@
|
||||
[{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 type="text/css">
|
||||
button {
|
||||
margin: 1em;
|
||||
margin-left: 5em;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
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>
|
||||
|
||||
<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="">
|
||||
|
||||
[{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-3 pb-4">
|
||||
<div class="card">
|
||||
<h5 class="card-header">
|
||||
[{$export->getTitle()}]
|
||||
</h5>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
[{$export->getDescription()}]
|
||||
</p>
|
||||
<button class="btn btn-primary" onclick="document.getElementById('exportid').value = '[{$id}]'; document.getElementById('myedit').submit();">
|
||||
<i class="fas fa-magic"></i>
|
||||
[{oxmultilang ident=$export->getButtonText()}]
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
[{/foreach}]
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[{/foreach}]
|
||||
</div>
|
||||
[{else}]
|
||||
keine Exporte definiert
|
||||
[{/if}]
|
||||
</form>
|
||||
|
||||
[{include file="d3_cfg_mod_inc.tpl"}]
|
8
src/menu.xml
Normal file
8
src/menu.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OX>
|
||||
<OXMENU id="NAVIGATION_ESHOPADMIN">
|
||||
<MAINMENU id="mxservice">
|
||||
<SUBMENU id="d3mxDataWizard" cl="d3ExportWizard" disableForDemoShop="1" />
|
||||
</MAINMENU>
|
||||
</OXMENU>
|
||||
</OX>
|
44
src/metadata.php
Normal file
44
src/metadata.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?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 <ds@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Metadata version
|
||||
*/
|
||||
$sMetadataVersion = '2.1';
|
||||
|
||||
/**
|
||||
* Module information
|
||||
*/
|
||||
$aModule = [
|
||||
'id' => 'd3datawizard',
|
||||
'title' => '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em"> Data Wizard query framework',
|
||||
'description' => [
|
||||
'de' => '',
|
||||
'en' => '',
|
||||
],
|
||||
'thumbnail' => '',
|
||||
'version' => '0.1',
|
||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'controllers' => [
|
||||
'd3ExportWizard' => D3\DataWizard\Application\Controller\Admin\d3ExportWizard::class
|
||||
],
|
||||
'extend' => [],
|
||||
'events' => [],
|
||||
'templates' => [
|
||||
'd3ExportWizard.tpl' => 'd3/datawizard/Application/views/admin/tpl/d3ExportWizard.tpl',
|
||||
],
|
||||
'blocks' => []
|
||||
];
|
Loading…
Reference in New Issue
Block a user