diff --git a/Admin/Installer.php b/Admin/Installer.php
index 4e71ad6..a9044e3 100644
--- a/Admin/Installer.php
+++ b/Admin/Installer.php
@@ -4,7 +4,7 @@
*
* PHP Version 7.2
*
- * @package TBD
+ * @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@@ -18,15 +18,58 @@ use phpOMS\DataStorage\Database\DatabaseType;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\InfoManager;
+use phpOMS\System\File\Local\Directory;
+
+use Modules\Exchange\Models\InterfaceManager;
+use Modules\Exchange\Models\InterfaceManagerMapper;
/**
* Exchange install class.
*
- * @package Modules
+ * @package Modules\Exchange
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Installer extends InstallerAbstract
{
+ /**
+ * {@inheritdoc}
+ */
+ public static function install(DatabasePool $dbPool, InfoManager $info) : void
+ {
+ parent::install($dbPool, $info);
+
+ switch ($dbPool->get()->getType()) {
+ case DatabaseType::MYSQL:
+ $dbPool->get()->con->beginTransaction();
+
+ $dbPool->get()->con->prepare(
+ 'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'exchange` (
+ `exchange_id` int(11) NOT NULL AUTO_INCREMENT,
+ `exchange_title` varchar(255) DEFAULT NULL,
+ `exchange_path` text NOT NULL,
+ `exchange_import` tinyint(1) NOT NULL,
+ `exchange_export` tinyint(1) NOT NULL,
+ `exchange_version` varchar(255) NOT NULL,
+ `exchange_website` varchar(255) NOT NULL,
+ `exchange_created_by` int(11) DEFAULT NULL,
+ `exchange_created_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`exchange_id`)
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
+ )->execute();
+
+ $dbPool->get()->con->commit();
+ break;
+ }
+
+ $interfaces = Directory::list(__DIR__ . '/../Interfaces', '.*interface\.json');
+
+ foreach ($interfaces as $interface) {
+ $exchange = new InterfaceManager(__DIR__ . '/../Interfaces/' . $interface);
+ $exchange->load();
+
+ InterfaceManagerMapper::create($exchange);
+ }
+ }
}
diff --git a/Admin/Status.php b/Admin/Status.php
index ead3bcf..b772116 100644
--- a/Admin/Status.php
+++ b/Admin/Status.php
@@ -4,7 +4,7 @@
*
* PHP Version 7.2
*
- * @package TBD
+ * @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@@ -21,7 +21,7 @@ use phpOMS\Module\InfoManager;
/**
* Navigation class.
*
- * @package Modules
+ * @package Modules\Exchange
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
diff --git a/Admin/Uninstaller.php b/Admin/Uninstaller.php
index aabe3a3..6b77b15 100644
--- a/Admin/Uninstaller.php
+++ b/Admin/Uninstaller.php
@@ -4,7 +4,7 @@
*
* PHP Version 7.2
*
- * @package TBD
+ * @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@@ -19,9 +19,9 @@ use phpOMS\Module\UninstallerAbstract;
use phpOMS\Module\InfoManager;
/**
- * Navigation class.
+ * Uninstaller class.
*
- * @package Modules
+ * @package Modules\Exchange
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
diff --git a/Admin/Updater.php b/Admin/Updater.php
index 79b35f2..ef26434 100644
--- a/Admin/Updater.php
+++ b/Admin/Updater.php
@@ -4,7 +4,7 @@
*
* PHP Version 7.2
*
- * @package TBD
+ * @package Modules\Exchange
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@@ -22,7 +22,7 @@ use phpOMS\Module\InfoManager;
/**
* Updater class.
*
- * @package Modules
+ * @package Modules\Exchange
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
diff --git a/Interfaces/GSD/interface.json b/Interfaces/GSD/interface.json
new file mode 100644
index 0000000..ab5ad3f
--- /dev/null
+++ b/Interfaces/GSD/interface.json
@@ -0,0 +1,8 @@
+{
+ "name": "GSD",
+ "version": "1.0.0",
+ "website": "",
+ "path": "GSD",
+ "export": true,
+ "import": false
+}
\ No newline at end of file
diff --git a/Interfaces/Intrexx/interface.json b/Interfaces/Intrexx/interface.json
new file mode 100644
index 0000000..6c51a96
--- /dev/null
+++ b/Interfaces/Intrexx/interface.json
@@ -0,0 +1,8 @@
+{
+ "name": "Intrexx",
+ "version": "1.0.0",
+ "website": "",
+ "path": "Intrexx",
+ "export": true,
+ "import": false
+}
\ No newline at end of file
diff --git a/Models/InterfaceManager.php b/Models/InterfaceManager.php
new file mode 100644
index 0000000..d5b9014
--- /dev/null
+++ b/Models/InterfaceManager.php
@@ -0,0 +1,145 @@
+path = $path;
+ }
+
+ /**
+ * Get info path
+ *
+ * @return string
+ *
+ * @since 1.0.0
+ */
+ public function getPath() : string
+ {
+ return $this->path;
+ }
+
+ /**
+ * Load info data from path.
+ *
+ * @return void
+ *
+ * @throws PathException This exception is thrown in case the info file path doesn't exist.
+ *
+ * @since 1.0.0
+ */
+ public function load() : void
+ {
+ if (!file_exists($this->path)) {
+ throw new PathException($this->path);
+ }
+
+ $this->info = json_decode(file_get_contents($this->path), true);
+ }
+
+ /**
+ * Update info file
+ *
+ * @return void
+ *
+ * @since 1.0.0
+ */
+ public function update() : void
+ {
+ if (!file_exists($this->path)) {
+ throw new PathException($this->path);
+ }
+
+ file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT));
+ }
+
+ /**
+ * Set data
+ *
+ * @param string $path Value path
+ * @param mixed $data Scalar or array of data to set
+ * @param string $delim Delimiter of path
+ *
+ * @return void
+ *
+ * @since 1.0.0
+ */
+ public function set(string $path, $data, string $delim = '/') : void
+ {
+ if (!is_scalar($data) && !is_array($data) && !($data instanceof \JsonSerializable)) {
+ throw new \InvalidArgumentException('Type of $data "' . gettype($data) . '" is not supported.');
+ }
+
+ ArrayUtils::setArray($path, $this->info, $data, $delim, true);
+ }
+
+ /**
+ * Get info data.
+ *
+ * @return array
+ *
+ * @since 1.0.0
+ */
+ public function get() : array
+ {
+ return $this->info;
+ }
+}
diff --git a/Models/InterfaceManagerMapper.php b/Models/InterfaceManagerMapper.php
new file mode 100644
index 0000000..1030e65
--- /dev/null
+++ b/Models/InterfaceManagerMapper.php
@@ -0,0 +1,72 @@
+ ['name' => 'exchange_id', 'type' => 'int', 'internal' => 'id'],
+ 'exchange_title' => ['name' => 'exchange_title', 'type' => 'string', 'internal' => 'info/title'],
+ 'exchange_path' => ['name' => 'exchange_path', 'type' => 'string', 'internal' => 'info/path'],
+ 'exchange_version' => ['name' => 'exchange_version', 'type' => 'string', 'internal' => 'info/version'],
+ 'exchange_export' => ['name' => 'exchange_export', 'type' => 'bool', 'internal' => 'info/export'],
+ 'exchange_import' => ['name' => 'exchange_import', 'type' => 'bool', 'internal' => 'info/import'],
+ 'exchange_website' => ['name' => 'exchange_website', 'type' => 'string', 'internal' => 'info/website'],
+ ];
+
+ /**
+ * Primary table.
+ *
+ * @var string
+ * @since 1.0.0
+ */
+ protected static $table = 'exchange';
+
+ /**
+ * Created at.
+ *
+ * @var string
+ * @since 1.0.0
+ */
+ protected static $createdAt = 'exchange_created_at';
+
+ /**
+ * Primary field name.
+ *
+ * @var string
+ * @since 1.0.0
+ */
+ protected static $primaryField = 'exchange_id';
+}
diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php
index 7360d0d..624fe6a 100644
--- a/Theme/Backend/Lang/en.lang.php
+++ b/Theme/Backend/Lang/en.lang.php
@@ -12,4 +12,8 @@
*/
return ['Exchange' => [
'Exchange' => 'Exchange',
+ 'Exports' => 'Exports',
+ 'Imports' => 'Imports',
+ 'Title' => 'Title',
+ 'Website' => 'Website',
]];
diff --git a/Theme/Backend/exchange-export-list.tpl.php b/Theme/Backend/exchange-export-list.tpl.php
index 012ddfa..e6f7c37 100644
--- a/Theme/Backend/exchange-export-list.tpl.php
+++ b/Theme/Backend/exchange-export-list.tpl.php
@@ -15,3 +15,29 @@
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>
+
diff --git a/Theme/Backend/exchange-import-list.tpl.php b/Theme/Backend/exchange-import-list.tpl.php
index 012ddfa..1398e04 100644
--- a/Theme/Backend/exchange-import-list.tpl.php
+++ b/Theme/Backend/exchange-import-list.tpl.php
@@ -15,3 +15,29 @@
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>
+