2021-04-16 14:04:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2021-04-20 11:20:34 +02:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
2021-04-16 14:04:30 +02:00
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2021-04-20 11:20:34 +02:00
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
2021-04-16 14:04:30 +02:00
|
|
|
*/
|
|
|
|
|
2021-04-20 09:57:44 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-04-16 14:04:30 +02:00
|
|
|
namespace D3\DataWizard\Application\Model;
|
|
|
|
|
|
|
|
class Configuration
|
|
|
|
{
|
|
|
|
const GROUP_CATEGORY = 'D3_DATAWIZARD_GROUP_CATEGORIES';
|
|
|
|
const GROUP_ARTICLES = 'D3_DATAWIZARD_GROUP_ARTICLES';
|
2021-04-16 23:19:28 +02:00
|
|
|
const GROUP_USERS = 'D3_DATAWIZARD_GROUP_USERS';
|
|
|
|
const GROUP_ORDERS = 'D3_DATAWIZARD_GROUP_ORDERS';
|
2021-04-16 14:04:30 +02:00
|
|
|
const GROUP_REMARKS = 'D3_DATAWIZARD_GROUP_REMARKS';
|
|
|
|
|
|
|
|
protected $exports = [];
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->configure();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function configure()
|
|
|
|
{
|
2021-04-16 14:20:57 +02:00
|
|
|
|
2021-04-16 14:04:30 +02:00
|
|
|
}
|
|
|
|
|
2021-04-20 09:50:49 +02:00
|
|
|
/**
|
|
|
|
* @param $group
|
|
|
|
* @param ExportBase $export
|
|
|
|
*/
|
2021-04-16 14:04:30 +02:00
|
|
|
public function registerExport($group, ExportBase $export)
|
|
|
|
{
|
|
|
|
$this->exports[$group][md5(serialize($export))] = $export;
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:50:49 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getGroupedExports(): array
|
2021-04-16 14:04:30 +02:00
|
|
|
{
|
|
|
|
return $this->exports;
|
|
|
|
}
|
|
|
|
|
2021-04-20 09:50:49 +02:00
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getGroups(): array
|
2021-04-16 14:04:30 +02:00
|
|
|
{
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
}
|