Bulkl path fix reverse

This commit is contained in:
Dennis Eichhorn 2017-02-12 21:43:10 +01:00
parent 939da45d2b
commit ed67a7bd4f
34 changed files with 2823 additions and 0 deletions

44
Admin/Activate.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\ActivateAbstract;
use phpOMS\Module\InfoManager;
/**
* Navigation class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Activate extends ActivateAbstract
{
/**
* {@inheritdoc}
*/
public static function activate(DatabasePool $dbPool, InfoManager $info)
{
parent::activate($dbPool, $info);
}
}

44
Admin/Deactivate.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\DeactivateAbstract;
use phpOMS\Module\InfoManager;
/**
* Navigation class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Deactivate extends DeactivateAbstract
{
/**
* {@inheritdoc}
*/
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
{
parent::deactivate($dbPool, $info);
}
}

View File

@ -0,0 +1,233 @@
[
{
"id": 1000101001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 0,
"name": "Admin",
"uri": null,
"target": "self",
"icon": "fa fa-lock",
"order": 1,
"from": "Admin",
"permission": null,
"parent": 0,
"children": [
{
"id": 1000102001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "General",
"uri": "/{/lang}/backend/admin/settings/general?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Admin",
"permission": null,
"parent": 1000101001,
"children": []
},
{
"id": 1000103001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "Groups",
"uri": "/{/lang}/backend/admin/group/list?{?}",
"target": "self",
"icon": null,
"order": 2,
"from": "Admin",
"permission": null,
"parent": 1000101001,
"children": [
{
"id": 1000103103,
"pid": "a82970f4c32b56731c03b912cd0ebc161272d088",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "/{/lang}/backend/admin/group/list?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Admin",
"permission": null,
"parent": 1000103001,
"children": []
},
{
"id": 1000103104,
"pid": "a82970f4c32b56731c03b912cd0ebc161272d088",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "/{/lang}/backend/admin/group/create?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "Admin",
"permission": null,
"parent": 1000103001,
"children": []
},
{
"id": 1000103201,
"pid": "faf868d821cd23e7e3981cf4270c3880da584027",
"type": 0,
"subtype": 1,
"name": "Front",
"uri": "/{/lang}/backend/admin/group/single/front?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Admin",
"permission": null,
"parent": 1000103001,
"children": [
{
"id": 1000103211,
"pid": "faf868d821cd23e7e3981cf4270c3880da584027",
"type": 3,
"subtype": 1,
"name": "Front",
"uri": "/{/lang}/backend/admin/group/single/front?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Admin",
"permission": null,
"parent": 1000103201,
"children": []
},
{
"id": 1000103212,
"pid": "faf868d821cd23e7e3981cf4270c3880da584027",
"type": 3,
"subtype": 1,
"name": "Members",
"uri": "/{/lang}/backend/admin/group/single/members?{?}",
"target": "self",
"icon": null,
"order": 2,
"from": "Admin",
"permission": null,
"parent": 1000103201,
"children": []
}
]
}
]
},
{
"id": 1000104001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "Accounts",
"uri": "/{/lang}/backend/admin/account/list?{?}",
"target": "self",
"icon": null,
"order": 3,
"from": "Admin",
"permission": null,
"parent": 1000101001,
"children": [
{
"id": 1000104101,
"pid": "06c40f113551672720d8251eeff5c3a2dbc168c2",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "/{/lang}/backend/admin/account/list?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Admin",
"permission": null,
"parent": 1000104001,
"children": []
},
{
"id": 1000104202,
"pid": "06c40f113551672720d8251eeff5c3a2dbc168c2",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "/{/lang}/backend/admin/account/create?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "Admin",
"permission": null,
"parent": 1000104001,
"children": []
},
{
"id": 1000104300,
"pid": "f277f11a122129a52d36f788f42e5c09766cf4ae",
"type": 0,
"subtype": 0,
"name": "Front",
"uri": "/{/lang}/backend/admin/account/single/front?{?}",
"target": "self",
"icon": null,
"order": 3,
"from": "Admin",
"permission": null,
"parent": 1000104001,
"children": [
{
"id": 1000104301,
"pid": "f277f11a122129a52d36f788f42e5c09766cf4ae",
"type": 3,
"subtype": 1,
"name": "Front",
"uri": "/{/lang}/backend/admin/account/single/front?{?}",
"target": "self",
"icon": null,
"order": 3,
"from": "Admin",
"permission": null,
"parent": 1000104300,
"children": []
}
]
}
]
},
{
"id": 1000105001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "Modules",
"uri": "/{/lang}/backend/admin/module/list?{?}",
"target": "self",
"icon": null,
"order": 4,
"from": "Admin",
"permission": null,
"parent": 1000101001,
"children": [
{
"id": 1000105101,
"pid": "6f43051bccfc2ded5ab2baf8b1b7cff2c0f2b2aa",
"type": 3,
"subtype": 1,
"name": "Settings",
"uri": "/{/lang}/backend/admin/module/setting?{?}",
"target": "self",
"icon": null,
"order": 4,
"from": "Admin",
"permission": null,
"parent": 1000105001,
"children": []
}
]
}
]
}
]

View File

@ -0,0 +1,40 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin\Install;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* Navigation class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Navigation
{
public static function install(string $path, DatabasePool $dbPool)
{
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
$class = '\\Modules\\Navigation\\Admin\\Installer';
/** @var $class \Modules\Navigation\Admin\Installer */
$class::installExternal($dbPool, $navData);
}
}

280
Admin/Installer.php Normal file
View File

@ -0,0 +1,280 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\DatabaseType;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\InfoManager;
use phpOMS\Module\InstallerAbstract;
/**
* Admin install class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Installer extends InstallerAbstract
{
/**
* {@inheritdoc}
*/
public static function install(string $path, DatabasePool $dbPool, InfoManager $info)
{
parent::install($path, $dbPool, $info);
switch ($dbPool->get('core')->getType()) {
case DatabaseType::MYSQL:
$dbPool->get('core')->con->beginTransaction();
/* Create group table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'group` (
`group_id` int(11) NOT NULL AUTO_INCREMENT,
`group_name` varchar(50) NOT NULL,
`group_status` int(11) NOT NULL,
`group_desc` varchar(100) DEFAULT NULL,
`group_created` datetime DEFAULT NULL,
PRIMARY KEY (`group_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
/* Create group relations table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'group_relations` (
`group_relations_id` int(11) NOT NULL AUTO_INCREMENT,
`group_relations_group` int(11) DEFAULT NULL,
`group_relations_parent` int(11) DEFAULT NULL,
PRIMARY KEY (`group_relations_id`),
KEY `group_relations_group` (`group_relations_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'group_relations`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'group_relations_ibfk_1` FOREIGN KEY (`group_relations_group`) REFERENCES `' . $dbPool->get('core')->prefix . 'group` (`group_id`);'
)->execute();
/* Create group permission table */
/*
* idx = module specific element id (since one module can have multiple things that need permissions)
* e.g.
* id1 = report_template (since it could also be a permission for a report)
* id2 = report_template_id
*/
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'group_permission` (
`group_permission_id` int(11) NOT NULL AUTO_INCREMENT,
`group_permission_group` int(11) NOT NULL,
`group_permission_from` varchar(50) DEFAULT NULL,
`group_permission_for` varchar(50) DEFAULT NULL,
`group_permission_id1` int(11) DEFAULT NULL,
`group_permission_id2` int(11) DEFAULT NULL,
`group_permission_id3` int(11) DEFAULT NULL,
`group_permission_r` int(1) DEFAULT NULL,
`group_permission_w` int(1) DEFAULT NULL,
`group_permission_m` int(1) DEFAULT NULL,
`group_permission_d` int(1) DEFAULT NULL,
`group_permission_p` int(1) DEFAULT NULL,
PRIMARY KEY (`group_permission_id`),
KEY `group_permission_group` (`group_permission_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'group_permission`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'group_permission_ibfk_1` FOREIGN KEY (`group_permission_group`) REFERENCES `' . $dbPool->get('core')->prefix . 'group` (`group_id`);'
)->execute();
/* Create ips table
This gets used in order to prevent unauthorized access for user group. */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'ips` (
`ips_id` int(11) NOT NULL AUTO_INCREMENT,
`ips_begin` bigint(20) NOT NULL,
`ips_end` bigint(20) NOT NULL,
`ips_group` int(11) DEFAULT NULL,
PRIMARY KEY (`ips_id`),
KEY `ips_group` (`ips_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'ips`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'ips_ibfk_1` FOREIGN KEY (`ips_group`) REFERENCES `' . $dbPool->get('core')->prefix . 'group` (`group_id`);'
)->execute();
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'l11n` (
`l11n_id` int(11) NOT NULL AUTO_INCREMENT,
`l11n_country` varchar(20) NOT NULL,
`l11n_language` varchar(20) NOT NULL,
`l11n_currency` varchar(20) NOT NULL,
`l11n_number_thousand` varchar(20) NOT NULL,
`l11n_number_decimal` varchar(20) NOT NULL,
`l11n_angle` varchar(20) NOT NULL,
`l11n_temperature` varchar(20) NOT NULL,
`l11n_weight_very_light` varchar(20) NOT NULL,
`l11n_weight_light` varchar(20) NOT NULL,
`l11n_weight_medium` varchar(20) NOT NULL,
`l11n_weight_heavy` varchar(20) NOT NULL,
`l11n_weight_very_heavy` varchar(20) NOT NULL,
`l11n_speed_very_slow` varchar(20) NOT NULL,
`l11n_speed_slow` varchar(20) NOT NULL,
`l11n_speed_medium` varchar(20) NOT NULL,
`l11n_speed_fast` varchar(20) NOT NULL,
`l11n_speed_very_fast` varchar(20) NOT NULL,
`l11n_speed_sea` varchar(20) NOT NULL,
`l11n_length_very_short` varchar(20) NOT NULL,
`l11n_length_short` varchar(20) NOT NULL,
`l11n_length_medium` varchar(20) NOT NULL,
`l11n_length_long` varchar(20) NOT NULL,
`l11n_length_very_long` varchar(20) NOT NULL,
`l11n_length_sea` varchar(20) NOT NULL,
`l11n_area_very_small` varchar(20) NOT NULL,
`l11n_area_small` varchar(20) NOT NULL,
`l11n_area_medium` varchar(20) NOT NULL,
`l11n_area_large` varchar(20) NOT NULL,
`l11n_area_very_large` varchar(20) NOT NULL,
`l11n_volume_very_small` varchar(20) NOT NULL,
`l11n_volume_small` varchar(20) NOT NULL,
`l11n_volume_medium` varchar(20) NOT NULL,
`l11n_volume_large` varchar(20) NOT NULL,
`l11n_volume_very_large` varchar(20) NOT NULL,
`l11n_volume_teaspoon` varchar(20) NOT NULL,
`l11n_volume_tablespoon` varchar(20) NOT NULL,
`l11n_volume_glass` varchar(20) NOT NULL,
PRIMARY KEY (`l11n_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
/* Create account table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'account` (
`account_id` int(11) NOT NULL AUTO_INCREMENT,
`account_status` tinyint(2) NOT NULL,
`account_type` tinyint(2) NOT NULL,
`account_login` varchar(30) NOT NULL,
`account_name1` varchar(50) NOT NULL,
`account_name2` varchar(50) NOT NULL,
`account_name3` varchar(50) NOT NULL,
`account_password` varchar(64) DEFAULT NULL,
`account_email` varchar(70) NOT NULL,
`account_tries` tinyint(2) NOT NULL DEFAULT 0,
`account_lactive` datetime DEFAULT NULL,
`account_localization` int(11) DEFAULT NULL,
`account_created_at` datetime NOT NULL,
PRIMARY KEY (`account_id`),
KEY `account_localization` (`account_localization`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'account`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'account_ibfk_1` FOREIGN KEY (`account_localization`) REFERENCES `' . $dbPool->get('core')->prefix . 'l11n` (`l11n_id`);'
)->execute();
/* Create account group table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'account_group` (
`account_group_id` bigint(20) NOT NULL AUTO_INCREMENT,
`account_group_group` int(11) NOT NULL,
`account_group_account` int(11) NOT NULL,
PRIMARY KEY (`account_group_id`),
KEY `account_group_group` (`account_group_group`),
KEY `account_group_account` (`account_group_account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'account_group`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'account_group_ibfk_1` FOREIGN KEY (`account_group_group`) REFERENCES `' . $dbPool->get('core')->prefix . 'group` (`group_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'account_group_ibfk_2` FOREIGN KEY (`account_group_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
/* Create account permission table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'account_permission` (
`account_permission_id` int(11) NOT NULL AUTO_INCREMENT,
`account_permission_account` int(11) NOT NULL,
`account_permission_from` varchar(50) DEFAULT NULL,
`account_permission_for` varchar(50) DEFAULT NULL,
`account_permission_id1` int(11) DEFAULT NULL,
`account_permission_id2` int(11) DEFAULT NULL,
`account_permission_id3` int(11) DEFAULT NULL,
`account_permission_r` int(1) DEFAULT NULL,
`account_permission_w` int(1) DEFAULT NULL,
`account_permission_m` int(1) DEFAULT NULL,
`account_permission_d` int(1) DEFAULT NULL,
`account_permission_p` int(1) DEFAULT NULL,
PRIMARY KEY (`account_permission_id`),
KEY `account_permission_account` (`account_permission_account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'account_permission`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'account_permission_ibfk_1` FOREIGN KEY (`account_permission_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
/* Create account settings table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'account_settings` (
`account_settings_id` int(11) NOT NULL AUTO_INCREMENT,
`account_settings_name` varchar(30) NOT NULL,
`account_settings_content` varchar(250) NOT NULL,
`account_settings_account` int(11) NOT NULL,
PRIMARY KEY (`account_settings_id`),
UNIQUE KEY `account_settings_name` (`account_settings_name`),
KEY `account_settings_account` (`account_settings_account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'account_settings`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'account_settings_ibfk_1` FOREIGN KEY (`account_settings_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();
/* Create settings table */
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'settings` (
`settings_id` int(11) NOT NULL AUTO_INCREMENT,
`settings_module` varchar(255) DEFAULT NULL,
`settings_name` varchar(100) NOT NULL,
`settings_content` varchar(255) NOT NULL,
`settings_group` int(11) DEFAULT NULL,
PRIMARY KEY (`settings_id`),
KEY `settings_module` (`settings_module`),
KEY `settings_group` (`settings_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'settings`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'settings_ibfk_1` FOREIGN KEY (`settings_module`) REFERENCES `' . $dbPool->get('core')->prefix . 'module` (`module_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'settings_ibfk_2` FOREIGN KEY (`settings_group`) REFERENCES `' . $dbPool->get('core')->prefix . 'group` (`group_id`);'
)->execute();
$dbPool->get('core')->con->commit();
break;
}
}
}

62
Admin/Routes/Web/Api.php Normal file
View File

@ -0,0 +1,62 @@
<?php
use phpOMS\Router\RouteVerb;
return [
'^.*/api/admin/settings.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiSettingsSet',
'verb' => RouteVerb::SET,
],
[
'dest' => '\Modules\Admin\Controller:apiSettingsGet',
'verb' => RouteVerb::GET,
],
],
'^.*/api/admin/group.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiGroupCreate',
'verb' => RouteVerb::PUT,
],
[
'dest' => '\Modules\Admin\Controller:apiGroupUpdate',
'verb' => RouteVerb::SET,
],
[
'dest' => '\Modules\Admin\Controller:apiGroupDelete',
'verb' => RouteVerb::DELETE,
],
[
'dest' => '\Modules\Admin\Controller:apiGroupGet',
'verb' => RouteVerb::GET,
],
],
'^.*/api/admin/account.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiAccountCreate',
'verb' => RouteVerb::PUT,
],
[
'dest' => '\Modules\Admin\Controller:apiAccountUpdate',
'verb' => RouteVerb::SET,
],
[
'dest' => '\Modules\Admin\Controller:apiAccountDelete',
'verb' => RouteVerb::DELETE,
],
[
'dest' => '\Modules\Admin\Controller:apiAccountGet',
'verb' => RouteVerb::GET,
],
],
'^.*/api/admin/module/status.*$' => [
[
'dest' => '\Modules\Admin\Controller:apiModuleStatusUpdate',
'verb' => RouteVerb::SET,
],
],
];

View File

@ -0,0 +1,60 @@
<?php
use phpOMS\Router\RouteVerb;
return [
'^.*/backend/admin/settings/general.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewSettingsGeneral',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/account/list.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewAccountList',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/account/settings.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewAccountSettings',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/account/create.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewAccountCreate',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/group/list.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewGroupList',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/group/settings.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewGroupSettings',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/group/create.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewGroupCreate',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/module/list.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewModuleList',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/module/settings.*$' => [
[
'dest' => '\Modules\Admin\Controller:viewModuleProfile',
'verb' => RouteVerb::GET,
],
],
];

3
Admin/Routes/console.php Normal file
View File

@ -0,0 +1,3 @@
<?php
$moduleRoutes = [];

3
Admin/Routes/socket.php Normal file
View File

@ -0,0 +1,3 @@
<?php
$moduleRoutes = [];

43
Admin/Uninstall.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\UninstallAbstract;
/**
* Navigation class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Uninstall extends UninstallAbstract
{
/**
* {@inheritdoc}
*/
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
{
parent::uninstall($dbPool, $info);
}
}

46
Admin/Update.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Module\UpdateAbstract;
use phpOMS\System\File\Directory;
/**
* Navigation class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Update extends UpdateAbstract
{
/**
* {@inheritdoc}
*/
public static function update(DatabasePool $dbPool, array $info)
{
Directory::deletePath(__DIR__ . '/Update');
mkdir('Update');
parent::update($dbPool, $info);
}
}

446
Controller.php Normal file
View File

@ -0,0 +1,446 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin;
use Model\Message\FormValidation;
use Modules\Admin\Models\Account;
use phpOMS\Account\AccountStatus;
use phpOMS\Account\AccountType;
use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\Group;
use Modules\Admin\Models\GroupMapper;
use phpOMS\Account\GroupStatus;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface;
use phpOMS\System\MimeType;
use phpOMS\Views\View;
/**
* Admin controller class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Controller extends ModuleAbstract implements WebInterface
{
/**
* Module path.
*
* @var string
* @since 1.0.0
*/
/* public */ const MODULE_PATH = __DIR__;
/**
* Module version.
*
* @var string
* @since 1.0.0
*/
/* public */ const MODULE_VERSION = '1.0.0';
/**
* Module name.
*
* @var string
* @since 1.0.0
*/
/* public */ const MODULE_NAME = 'Admin';
/**
* Providing.
*
* @var string
* @since 1.0.0
*/
protected static $providing = [];
/**
* Dependencies.
*
* @var string
* @since 1.0.0
*/
protected static $dependencies = [];
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewSettingsGeneral(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$settings = $this->app->appSettings->get([
1000000009,
1000000019,
1000000020,
1000000021,
1000000022,
1000000023,
1000000027,
1000000028,
]);
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/settings-general');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
$view->setData('oname', $settings[1000000009]);
$view->setData('country', $settings[1000000019]);
$view->setData('timezone', $settings[1000000021]);
$view->setData('timeformat', $settings[1000000022]);
$view->setData('language', $settings[1000000020]);
$view->setData('currency', $settings[1000000023]);
$view->setData('decimal_point', $settings[1000000027]);
$view->setData('thousands_sep', $settings[1000000028]);
$view->setData('countries', $settings[1000000028]);
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
$view->setData('list:elements', AccountMapper::getAll());
$view->setData('list:count', 1);
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
$view->addData('account', AccountMapper::get((int) $request->getData('id')));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/accounts-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000104001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
$view->setData('list:elements', GroupMapper::getAll());
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
$view->addData('group', GroupMapper::get((int) $request->getData('id')));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/groups-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000103001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewModuleList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/modules-list');
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return \Serializable
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewModuleProfile(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/Backend/modules-single');
return $view;
}
public function apiSettingsGet(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$response->set('settings', $this->app->appSettings->get($request->getData('id')));
}
public function apiSettingsSet(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$success = $this->app->appSettings->set((array) $request->getData('settings'), true);
$response->set('settings', $success);
}
public function apiGroupGet(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$response->set('group', GroupMapper::getByRequest($request));
}
private function validateGroupCreate(RequestAbstract $request) : array
{
$val = [];
if (
($val['name'] = empty($request->getData('name')))
|| ($val['status'] = (
$request->getData('status') === null
|| !GroupStatus::isValidValue((int) $request->getData('status'))
))
) {
return $val;
}
return [];
}
public function apiGroupCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
if (!empty($val = $this->validateGroupCreate($request))) {
$response->set('group_create', new FormValidation($val));
return;
}
$group = new Group();
$group->setName($request->getData('name') ?? '');
$group->setStatus((int) $request->getData('status'));
$group->setDescription($request->getData('description') ?? '');
GroupMapper::create($group);
$response->set('group', $group->__toString());
}
public function apiGroupDelete(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$status = GroupMapper::delete($request->getData('id'));
$response->set('group', $status);
}
public function apiGroupUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$group = GroupMapper::get($request->getData('id'));
$group->setName($request->getData('name'));
$group->setDescription($request->getData('desc'));
$status = GroupMapper::update($group);
$response->set('group', ['status' => $status, 'group' => $group->__toString()]);
}
public function apiAccountGet(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$response->getHeader()->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$response->set('account', AccountMapper::getByRequest($request));
}
private function validateAccountCreate(RequestAbstract $request) : array
{
$val = [];
if (
($val['name'] = empty($request->getData('name')))
|| ($val['name1'] = empty($request->getData('name1')))
|| ($val['type'] = !AccountType::isValidValue((int) $request->getData('type')))
|| ($val['status'] = !AccountStatus::isValidValue((int) $request->getData('status')))
) {
return $val;
}
return [];
}
public function apiAccountCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
if (!empty($val = $this->validateAccountCreate($request))) {
$response->set('account_create', new FormValidation($val));
return;
}
$account = new Account();
$account->setStatus($request->getData('status'));
$account->setType($request->getData('type'));
$account->setName($request->getData('name'));
$account->setName1($request->getData('name1'));
$account->setName2($request->getData('name2'));
$account->setName3($request->getData('name3'));
$account->setEmail($request->getData('email'));
$account->generatePassword($request->getData('password'));
AccountMapper::create($account);
$response->set('account', $account->jsonSerialize());
}
public function apiAccountDelete(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$status = AccountMapper::delete($request->getData('id'));
$response->set('account', $status);
}
public function apiAccountUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$account = AccountMapper::get($request->getData('id'));
$account->setName($request->getData('name'));
$account->setDescription($request->getData('desc'));
$status = AccountMapper::update($account);
$response->set('account', ['status' => $status, 'account' => $account->jsonSerialize()]);
}
public function apiModuleStatusUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
$module = $request->getData('module');
$status = $request->getData('status');
if (!$module || !$status) {
// todo: create failure response
}
switch ($status) {
case 'activate':
$done = $this->app->moduleManager->activate($module);
break;
case 'deactivate':
$done = $this->app->moduleManager->deactivate($module);
break;
case 'install':
$done = $this->app->moduleManager->install($module);
break;
case 'uninstall':
//$done = $this->app->moduleManager->uninstall($module);
$done = true;
break;
default:
$done = false;
}
$response->set('module', [$status => $done, 'module' => $module]);
}
}

31
Models/Account.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
/**
* Account class.
*
* @category Modules
* @package Modules\Admin
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Account extends \phpOMS\Account\Account
{
}

131
Models/AccountMapper.php Normal file
View File

@ -0,0 +1,131 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column;
use phpOMS\DataStorage\Database\RelationType;
class AccountMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'account_id' => ['name' => 'account_id', 'type' => 'int', 'internal' => 'id'],
'account_status' => ['name' => 'account_status', 'type' => 'int', 'internal' => 'status'],
'account_type' => ['name' => 'account_type', 'type' => 'int', 'internal' => 'type'],
'account_login' => ['name' => 'account_login', 'type' => 'string', 'internal' => 'login'],
'account_name1' => ['name' => 'account_name1', 'type' => 'string', 'internal' => 'name1'],
'account_name2' => ['name' => 'account_name2', 'type' => 'string', 'internal' => 'name2'],
'account_name3' => ['name' => 'account_name3', 'type' => 'string', 'internal' => 'name3'],
'account_password' => ['name' => 'account_password', 'type' => 'string', 'internal' => 'password'],
'account_email' => ['name' => 'account_email', 'type' => 'string', 'internal' => 'email'],
//'account_tries' => ['name' => 'account_tries', 'type' => 'int', 'internal' => 'tries'],
'account_lactive' => ['name' => 'account_lactive', 'type' => 'DateTime',
'internal' => 'lastActive'],
'account_created_at' => ['name' => 'account_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'account';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'account_id';
/**
* Created at column
*
* @var string
* @since 1.0.0
*/
protected static $createdAt = 'account_created_at';
/**
* Create object.
*
* @param mixed $obj Object
* @param int $relations Behavior for relations creation
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj, int $relations = RelationType::ALL)
{
try {
$objId = parent::create($obj, $relations);
$query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix())
->insert(
'account_permission_account',
'account_permission_from',
'account_permission_for',
'account_permission_id1',
'account_permission_id2',
'account_permission_r',
'account_permission_w',
'account_permission_m',
'account_permission_d',
'account_permission_p'
)
->into('account_permission')
->values(1, 'account', 'account', 1, $objId, 1, 1, 1, 1, 1);
self::$db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e->getMessage());
return false;
}
return $objId;
}
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Account
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

72
Models/Group.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
/**
* Account group class.
*
* @category Framework
* @package phpOMS\Account
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Group extends \phpOMS\Account\Group
{
/**
* Created at.
*
* @var \DateTime
* @since 1.0.0
*/
protected $createdAt = null;
/**
* Created by.
*
* @var int
* @since 1.0.0
*/
protected $createdBy = 0;
/**
* Get created at.
*
* @return \DateTime
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getCreatedAt() : \DateTime
{
return $this->createdAt ?? new \DateTime('NOW');
}
/**
* Get created by.
*
* @return int
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getCreatedBy() : int
{
return $this->createdBy;
}
}

78
Models/GroupMapper.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\RelationType;
class GroupMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array
* @since 1.0.0
*/
protected static $columns = [
'group_id' => ['name' => 'group_id', 'type' => 'int', 'internal' => 'id'],
'group_name' => ['name' => 'group_name', 'type' => 'string', 'internal' => 'name'],
'group_status' => ['name' => 'group_status', 'type' => 'int', 'internal' => 'status'],
'group_desc' => ['name' => 'group_desc', 'type' => 'string', 'internal' => 'description'],
'group_created' => ['name' => 'group_created', 'type' => 'DateTime', 'internal' => 'createdAt'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static $table = 'group';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static $primaryField = 'group_id';
/**
* Created at column
*
* @var string
* @since 1.0.0
*/
protected static $createdAt = 'group_created';
/**
* Get object.
*
* @param mixed $primaryKey Key
* @param int $relations Load relations
* @param mixed $fill Object to fill
*
* @return Group
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey, int $relations = RelationType::ALL, $fill = null)
{
return parent::get((int) $primaryKey, $relations, $fill);
}
}

20
Models/NullAccount.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
class NullAccount extends Account
{
}

20
Models/NullGroup.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
class NullGroup extends Group
{
}

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Admin #
The Admin module is part of the core modules for OMS. This module is managing for modules, accounts, groups, permissions and monitoring.
## Modules ##
## Accounts ##
## Groups ##
## Permissions ##
## Monitoring ##

View File

@ -0,0 +1,27 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
return ['Navigation' => [
'Admin' => 'Admin',
'Create' => 'Create',
'Front' => 'Front',
'General' => 'General',
'Groups' => 'Groups',
'List' => 'List',
'Members' => 'Members',
'Modules' => 'Modules',
'Account' => 'Account',
'Accounts' => 'Accounts',
]];

View File

@ -0,0 +1,18 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG[1] = [
'i:ModuleInstalled' => 'Installation of the module {$1} was successful.',
];

View File

@ -0,0 +1,132 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
return ['Admin' => [
'Account' => 'Account',
'Accounts' => 'Accounts',
'Active' => 'Active',
'Activate' => 'Activate',
'Activity' => 'Activity',
'Available' => 'Available',
'All' => 'All',
'Area' => 'Area',
'Banned' => 'Banned',
'Cache' => 'Cache',
'Children' => 'Children',
'Country' => 'Country',
'Created' => 'Created',
'CreatedBy' => 'Created By',
'Currency' => 'Currency',
'DecimalPoint' => 'Decimal Point',
'Description' => 'Description',
'Delete' => 'Delete',
'Deactivate' => 'Deactivate',
'Email' => 'Email',
'EmailAdmin' => 'Email Admin',
'Fast' => 'Fast',
'Features' => 'Features',
'File' => 'File',
'General' => 'General',
'Glass' => 'Glass',
'Group' => 'Group',
'Groups' => 'Groups',
'Heavy' => 'Heavy',
'Inactive' => 'Inactive',
'Install' => 'Install',
'Installed' => 'Installed',
'LAddress' => 'Local Address',
'Language' => 'Language',
'Large' => 'Large',
'Length' => 'Length',
'Light' => 'Light',
'Localization' => 'Localization',
'Long' => 'Long',
'Loginname' => 'Login Name',
'Lowercase' => 'Lowercase',
'Maintenance' => 'Maintenance',
'Medium' => 'Medium',
'Member' => 'Member',
'Members' => 'Members',
'Memcache' => 'Memcache',
'MemoryLimit' => 'Memory Limit',
'Message' => 'Message',
'Module' => 'Module',
'Modules' => 'Modules',
'Name' => 'Name',
'Name1' => 'Name 1',
'Name2' => 'Name 2',
'Name3' => 'Name 3',
'None' => 'None',
'Numberformat' => 'Numberformat',
'Numeric' => 'Numeric',
'Organization' => 'Organization',
'OrganizationName' => 'Organization Name',
'Page' => 'Page',
'Parent' => 'Parent',
'Parents' => 'Parents',
'Password' => 'Password',
'PasswordRegex' => 'Password Regex',
'Permissions' => 'Permissions',
'Person' => 'Person',
'Profile' => 'Profile',
'RAddress' => 'Remote Address',
'ReCache' => 'Re-Cache',
'Running' => 'Running',
'Short' => 'Short',
'Sea' => 'Sea',
'Settings' => 'Settings',
'SettingsGeneral' => 'Settings - General',
'Single' => 'Single',
'Slow' => 'Slow',
'Small' => 'Small',
'Speed' => 'Speed',
'Specialchar' => 'Special character',
'Status' => 'Status',
'Total' => 'Total',
'Release' => 'Release',
'Tablespoon' => 'Tablespoon',
'Teaspoon' => 'Teaspoon',
'Temperature' => 'Temperature',
'Theme' => 'Theme',
'ThousandsSeparator' => 'Thousands Separator',
'Time' => 'Time',
'Timestamp' => 'Timestamp',
'Timeformat' => 'Timeformat',
'Timeout' => 'Timeout',
'Timezone' => 'Timezone',
'Type' => 'Type',
'Uninstall' => 'Uninstall',
'Uppercase' => 'Uppercase',
'Username' => 'Username',
'Version' => 'Version',
'VeryFast' => 'Very Fast',
'VeryHeavy' => 'Very Heavy',
'VeryLarge' => 'Very Large',
'VeryLight' => 'Very Light',
'VeryLong' => 'Very Long',
'VerySlow' => 'Very Slow',
'VeryShort' => 'Very Short',
'VerySmall' => 'Very Small',
'Volume' => 'Volume',
'Warnings' => 'Warnings',
'Website' => 'Website',
'Weight' => 'Weight',
'i:loc' => 'IP address or URL for remote access.',
'i:mail' => 'Email address.',
'i:oname' => 'Organization name.',
'i:rem' => 'IP address or URL for remote access.',
'i:rc' => 'Forcing re-cache for every user.',
'i:timef' => 'Time format.',
]];

View File

@ -0,0 +1,88 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Account') ?></h1></header>
<div class="inner">
<form id="fAccount" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account'); ?>" method="put">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iType"><?= $this->getText('Type') ?></label>
<tr><td><select id="iType" name="type">
<option value="<?= \phpOMS\Account\AccountType::USER; ?>"><?= $this->getText('Person') ?>
<option value="<?= \phpOMS\Account\AccountType::GROUP; ?>"><?= $this->getText('Organization') ?>
</select>
<tr><td><label for="iStatus"><?= $this->getText('Status') ?></label>
<tr><td><select id="iStatus" name="status">
<option value="<?= \phpOMS\Account\AccountStatus::ACTIVE; ?>"><?= $this->getText('Active') ?>
<option value="<?= \phpOMS\Account\AccountStatus::INACTIVE; ?>"><?= $this->getText('Inactive') ?>
<option value="<?= \phpOMS\Account\AccountStatus::TIMEOUT; ?>"><?= $this->getText('Timeout') ?>
<option value="<?= \phpOMS\Account\AccountStatus::BANNED; ?>"><?= $this->getText('Banned') ?>
</select>
<tr><td><label for="iUsername"><?= $this->getText('Username') ?></label>
<tr><td><input id="iUsername" name="name" type="text" placeholder="&#xf007; Fred">
<tr><td><label for="iName1"><?= $this->getText('Name1') ?></label>
<tr><td><input id="iName1" name="name1" type="text" placeholder="&#xf007; Donald" required>
<tr><td><label for="iName2"><?= $this->getText('Name2') ?></label>
<tr><td><input id="iName2" name="name2" type="text" placeholder="&#xf007; Fauntleroy">
<tr><td><label for="iName3"><?= $this->getText('Name3') ?></label>
<tr><td><input id="iName3" name="name3" type="text" placeholder="&#xf007; Duck">
<tr><td><label for="iEmail"><?= $this->getText('Email') ?></label>
<tr><td><input id="iEmail" name="email" type="email" placeholder="&#xf0e0; d.duck@duckburg.com">
<tr><td><label for="iPassword"><?= $this->getText('Name3') ?></label>
<tr><td><input id="iPassword" name="password" type="password" placeholder="&#xf023; Pa55ssw0rd?">
<tr><td><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Groups') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getText('Name') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iGroup" name="group" type="text" placeholder="&#xf0c0; Guest" required></span>
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Permissions') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getText('Name') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iGroup" name="group" type="text" placeholder="&#xf084; news_create" required></span>
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,61 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages($this->getData('list:count') / 25);
$footerView->setPage(1);
$footerView->setResults($this->getData('list:count'));
echo $this->getData('nav')->render();
?>
<div class="row">
<div class="col-xs-12">
<div class="box wf-100">
<table class="table">
<caption><?= $this->getText('Groups'); ?></caption>
<thead>
<tr>
<td><?= $this->getText('ID', 0, 0); ?>
<td><?= $this->getText('Status'); ?>
<td class="wf-100"><?= $this->getText('Name'); ?>
<td><?= $this->getText('Activity'); ?>
<td><?= $this->getText('Created'); ?>
<tfoot>
<tr><td colspan="5"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ($this->getData('list:elements') as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/account/settings?{?}&id=' . $value->getId()); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getStatus(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getName1(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getLastActive()->format('Y-m-d H:i:s'); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getCreatedAt()->format('Y-m-d H:i:s'); ?></a>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getText('Empty', 0, 0); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,95 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/*
* UI Logic
*/
$account = $this->getData('account');
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Account') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/account'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iId"><?= $this->getText('ID', 0, 0) ?></label>
<tr><td><input id="iId" name="id" type="text" value="<?= $account->getId(); ?>" disabled>
<tr><td><label for="iType"><?= $this->getText('Type') ?></label>
<tr><td><select id="iType" name="type">
<option value="<?= \phpOMS\Account\AccountType::USER; ?>"<?= $account->getType() === \phpOMS\Account\AccountType::USER ? ' selected' : ''; ?>><?= $this->getText('Person') ?>
<option value="<?= \phpOMS\Account\AccountType::GROUP; ?>"<?= $account->getType() === \phpOMS\Account\AccountType::GROUP ? ' selected' : ''; ?>><?= $this->getText('Organization') ?>
</select>
<tr><td><label for="iStatus"><?= $this->getText('Status') ?></label>
<tr><td><select id="iStatus" name="status">
<option value="<?= \phpOMS\Account\AccountStatus::ACTIVE; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::ACTIVE ? ' selected' : ''; ?>><?= $this->getText('Active') ?>
<option value="<?= \phpOMS\Account\AccountStatus::INACTIVE; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::INACTIVE ? ' selected' : ''; ?>><?= $this->getText('Inactive') ?>
<option value="<?= \phpOMS\Account\AccountStatus::TIMEOUT; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::TIMEOUT ? ' selected' : ''; ?>><?= $this->getText('Timeout') ?>
<option value="<?= \phpOMS\Account\AccountStatus::BANNED; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::BANNED ? ' selected' : ''; ?>><?= $this->getText('Banned') ?>
</select>
<tr><td><label for="iUsername"><?= $this->getText('Username') ?></label>
<tr><td><input id="iUsername" name="name" type="text" placeholder="&#xf007; Fred" value="<?= $account->getName(); ?>" disabled>
<tr><td><label for="iName1"><?= $this->getText('Name1') ?></label>
<tr><td><input id="iName1" name="name1" type="text" placeholder="&#xf007; Donald" value="<?= $account->getName1(); ?>" required>
<tr><td><label for="iName2"><?= $this->getText('Name2') ?></label>
<tr><td><input id="iName2" name="name2" type="text" placeholder="&#xf007; Fauntleroy" value="<?= $account->getName2(); ?>">
<tr><td><label for="iName3"><?= $this->getText('Name3') ?></label>
<tr><td><input id="iName3" name="name3" type="text" placeholder="&#xf007; Duck" value="<?= $account->getName3(); ?>">
<tr><td><label for="iEmail"><?= $this->getText('Email') ?></label>
<tr><td><input id="iEmail" name="email" type="email" placeholder="&#xf0e0; d.duck@duckburg.com" value="<?= $account->getEmail(); ?>">
<tr><td><label for="iPassword"><?= $this->getText('Name3') ?></label>
<tr><td><input id="iPassword" name="password" type="text" placeholder="&#xf023; Pa55ssw0rd?">
<tr><td><input type="submit" value="<?= $this->getText('Save', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Groups') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Permissions') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGroup"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf084; news_create">
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,76 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/*
* UI Logic
*/
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getText('Group') ?></h1></header>
<div class="inner">
<form id="group-create" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="<?= \phpOMS\Message\Http\RequestMethod::PUT; ?>">
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iStatus"><?= $this->getText('Status') ?></label>
<tr><td colspan="2"><select id="iStatus" name="status">
<option value="<?= \phpOMS\Account\GroupStatus::ACTIVE; ?>" selected><?= $this->getText('Active') ?>
<option value="<?= \phpOMS\Account\GroupStatus::INACTIVE; ?>"><?= $this->getText('Inactive') ?>
<tr><td><label for="iGname"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGname" name="name" type="text" placeholder="&#xf0c0; Guest" required>
<tr><td><label for="iGroupDescription"><?= $this->getText('Description') ?></label>
<tr><td><textarea id="iGroupDescription" name="description" placeholder="&#xf040;"></textarea>
<tr><td><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getText('Parent') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getText('Name') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iGParentName" name="parentname" type="text" placeholder="&#xf0c0; Guest" required></span>
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getText('Permissions') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermissionName"><?= $this->getText('Name') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin" required></span>
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,57 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages($this->getData('list:count') ?? 0 / 25);
$footerView->setPage(1);
$footerView->setResults($this->getData('list:count') ?? 1);
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<table class="box table">
<caption><?= $this->getText('Groups'); ?></caption>
<thead>
<tr>
<td><?= $this->getText('ID', 0, 0); ?>
<td class="wf-100"><?= $this->getText('Name'); ?>
<td><?= $this->getText('Parents'); ?>
<td><?= $this->getText('Children'); ?>
<td><?= $this->getText('Members'); ?>
<tfoot>
<tr><td colspan="5"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ($this->getData('list:elements') as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
<td>
<td>
<td>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getText('Empty', 0, 0); ?>
<?php endif; ?>
</table>
</div>
</div>

View File

@ -0,0 +1,92 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/*
* UI Logic
*/
$group = $this->getData('group');
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Group') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGid"><?= $this->getText('ID', 0, 0) ?></label>
<tr><td><input id="iGid" name="gid" type="text" value="<?= $group->getId(); ?>" disabled>
<tr><td><label for="iGname"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGname" name="gname" type="text" placeholder="&#xf0c0; Guest" value="<?= $group->getName(); ?>">
<tr><td><label for="iGroupDescription"><?= $this->getText('Description') ?></label>
<tr><td><textarea id="iGroupDescription" name="description" placeholder="&#xf040;"><?= $group->getDescription(); ?></textarea>
<tr><td><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Parent') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Permissions') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPermissionName"><?= $this->getText('Name') ?></label>
<tr><td><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin">
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Accounts') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/group'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iGParentName"><?= $this->getText('Name') ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf234; Donald Duck">
<tr><td><input type="submit" value="<?= $this->getText('Add', 0, 0) ?>">
</table>
</form>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,66 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$modules = $this->app->moduleManager->getAllModules();
$active = $this->app->moduleManager->getActiveModules();
$installed = $this->app->moduleManager->getInstalledModules();
$footerView->setPages(count($modules) / 25);
$footerView->setPage(1);
$footerView->setResults(count($modules));
?>
<div class="row">
<div class="col-xs-12">
<div class="box w-100">
<table class="table">
<caption><?= $this->getText('Modules'); ?></caption>
<thead>
<tr>
<td><?= $this->getText('ID', 0, 0); ?>
<td class="wf-100"><?= $this->getText('Name'); ?>
<td><?= $this->getText('Version'); ?>
<td><?= $this->getText('Status'); ?>
<tfoot>
<tr>
<td colspan="4"><?= $footerView->render(); ?>
<tbody>
<?php $count = 0; foreach ($modules as $key => $module) : $count++;
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/module/settings?{?}&id=' . $module['name']['internal']); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $module['name']['internal']; ?></a>
<td><a href="<?= $url; ?>"><?= $module['name']['external']; ?></a>
<td><a href="<?= $url; ?>"><?= $module['version']; ?></a>
<td><a href="<?= $url; ?>"><?php if (in_array($module['name']['internal'], $active))
echo strtolower($this->getText('Active'));
elseif (in_array($module['name']['internal'], $installed))
echo strtolower($this->getText('Inactive'));
else
echo strtolower($this->getText('Available')); ?></a>
<?php endforeach; ?>
<?php if($count === 0) : ?>
<tr><td colspan="4" class="empty"><?= $this->getText('Empty', 0, 0); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>

View File

View File

@ -0,0 +1,96 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$modules = $this->app->moduleManager->getAllModules();
$active = $this->app->moduleManager->getActiveModules();
$installed = $this->app->moduleManager->getInstalledModules();
$id = $this->request->getData('id') ?? 1;
?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $modules[$id]['name']['external'] ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr>
<td><?= $this->getText('Name') ?>
<td><?= $modules[$id]['name']['external']; ?>
<tr>
<td><?= $this->getText('Version') ?>
<td><?= $modules[$id]['version'] ?>
<tr>
<td><?= $this->getText('CreatedBy') ?>
<td><?= $modules[$id]['creator']['name'] ?>
<tr>
<td><?= $this->getText('Website') ?>
<td><?= $modules[$id]['creator']['website'] ?>
<tr>
<td><?= $this->getText('Description') ?>
<td><?= $modules[$id]['description'] ?>
<tr>
<td colspan="2">
<?php if (in_array($id, $active)) : ?>
<button
data-reload="<?= \phpOMS\Uri\UriFactory::build('POST:/{/lang}/backend/admin/module/status?{?}&status=deactivate&module=' . $id); ?>"><?= $this->getText('Deactivate') ?></button>
<?php elseif (in_array($id, $installed)) : ?>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('POST:/{/lang}/backend/admin/module/deactivate?{?}&id=' . $id); ?>"><?= $this->getText('Uninstall') ?></button>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('POST:/{/lang}/backend/admin/module/deactivate?{?}&id=' . $id); ?>"><?= $this->getText('Activate') ?></button>
<?php elseif (isset($modules[$id])) : ?>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('PUT:/{/lang}/backend/admin/module/install?{?}&id=' . $id); ?>"><?= $this->getText('Install') ?></button>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('DELETE:/{/lang}/backend/admin/module/delete?{?}&id=' . $id); ?>"><?= $this->getText('Delete', 0) ?></button>
<?php endif; ?>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Settings') ?></h1></header>
<div class="inner">
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Groups') ?></h1></header>
<div class="inner">
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Permissions') ?></h1></header>
<div class="inner">
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,295 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/*
* UI Logic
*/
$_oname = $this->getData('oname') ?? '';
$_timezone = $this->getData('timezone') ?? '';
$_timeformat = $this->getData('timeformat') ?? '';
$_language = $this->getData('language') ?? '';
$_currency = $this->getData('currency') ?? '';
$_decimal_point = $this->getData('decimal_point') ?? '';
$_thousands_sep = $this->getData('thousands_sep') ?? '';
$_password = $this->getData('password') ?? '';
$_country = $this->getData('country') ?? '';
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
$timezones = \phpOMS\Localization\TimeZoneEnumArray::getConstants();
$timeformats = \phpOMS\Localization\ISO8601EnumArray::getConstants();
$languages = \phpOMS\Localization\ISO639Enum::getConstants();
$currencies = \phpOMS\Localization\ISO4217Enum::getConstants();
?>
<div class="tabular-2">
<div class="box wf-100">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getText('General') ?></label></li>
<li><label for="c-tab-2"><?= $this->getText('Localization') ?></label></li>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getText('Settings') ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/settings/general'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iOname"><?= $this->getText('OrganizationName') ?></label>
<tr><td><input id="iOname" name="oname" type="text" value="<?= $_oname; ?>" placeholder="&#xf12e; Money Bin" required>
<tr><td><label for="iPassword"><?= $this->getText('PasswordRegex') ?></label>
<tr><td><input id="iPassword" name="passpattern" type="text" value="<?= $_password; ?>" placeholder="&#xf023; ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&;:\(\)\[\]=\{\}\+\-])[A-Za-z\d$@$!%*?&;:\(\)\[\]=\{\}\+\-]{8,}">
<tr><td><input type="submit" value="<?= $this->getText('Save', 0) ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Localization') ?></h1></header>
<div class="inner">
<form id="fLocalization" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/admin/settings/localization'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iCountries"><?= $this->getText('Country') ?></label>
<tr><td colspan="2"><select id="iCountries" name="country">
<?php foreach($countries as $code => $country) : ?>
<option value="<?= $code; ?>"<?= strtolower($code) == strtolower($_country) ? ' selected' : ''; ?>><?= $country; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><label for="iTimezones"><?= $this->getText('Timezone') ?></label>
<tr><td colspan="2"><select id="iTimezones" name="timezone">
<?php foreach($timezones as $code => $timezone) : ?>
<option value="<?= $code; ?>"<?= $timezone == $_timezone ? ' selected' : ''; ?>><?= $timezone; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><label for="iTimeformats"><?= $this->getText('Timeformat') ?></label>
<tr><td colspan="2"><select id="iTimeformats" name="timeformat">
<?php foreach($timeformats as $code => $timeformat) : ?>
<option value="<?= $code; ?>"<?= strtolower($timeformat) == strtolower($_timeformat) ? ' selected' : ''; ?>><?= $timeformat; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><label for="iLanguages"><?= $this->getText('Language') ?></label>
<tr><td colspan="2"><select id="iLanguages" name="language">
<?php foreach($languages as $code => $language) : ?>
<option value="<?= $code; ?>"<?= strtolower($code) == strtolower($_language) ? ' selected' : ''; ?>><?= $language; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><label for="iTemperature"><?= $this->getText('Temperature') ?></label>
<tr><td colspan="2"><select id="iTemperature" name="temperature">
</select>
<tr><td colspan="2"><input type="submit" value="<?= $this->getText('Save', 0) ?>">
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Numeric') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td colspan="2"><label for="iCurrencies"><?= $this->getText('Currency') ?></label>
<tr><td colspan="2"><select form="fLocalization" id="iCurrencies" name="currency">
<?php foreach($currencies as $code => $currency) : ?>
<option value="<?= $code; ?>"<?= strtolower($code) == strtolower($_currency) ? ' selected' : ''; ?>><?= $currency; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><h2><?= $this->getText('Numberformat') ?></h2>
<tr><td><label for="iDecimalPoint"><?= $this->getText('DecimalPoint') ?></label>
<td><label for="iThousandSep"><?= $this->getText('ThousandsSeparator') ?></label>
<tr><td><input form="fLocalization" id="iDecimalPoint" name="decimalpoint" type="text" value="<?= $_decimal_point; ?>" placeholder="." required>
<td><input form="fLocalization" id="iThousandSep" name="thousandsep" type="text" value="<?= $_thousands_sep; ?>" placeholder="," required>
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Weight') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tbody>
<tr><label for="iVeryLight"><?= $this->getText('VeryLight') ?></label>
<tr><select form="fLocalization" id="iVeryLight" name="very_light">
</select>
<tr><label for="iLight"><?= $this->getText('Light') ?></label>
<tr><select form="fLocalization" id="iLight" name="light">
</select>
<tr><label for="iMedium"><?= $this->getText('Medium') ?></label>
<tr><select form="fLocalization" id="iMedium" name="medium">
</select>
<tr><label for="iHeavy"><?= $this->getText('Heavy') ?></label>
<tr><select form="fLocalization" id="iHeavy" name="heavy">
</select>
<tr><label for="iVeryHeavy"><?= $this->getText('VeryHeavy') ?></label>
<tr><select form="fLocalization" id="iVeryHeavy" name="very_heavy">
</select>
</table>
</form>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Speed') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tbody>
<tr><label for="iVerySlow"><?= $this->getText('VerySlow') ?></label>
<tr><select form="fLocalization" id="iVerySlow" name="very_slow">
</select>
<tr><label for="iSlow"><?= $this->getText('Slow') ?></label>
<tr><select form="fLocalization" id="iSlow" name="slow">
</select>
<tr><label for="iMedium"><?= $this->getText('Medium') ?></label>
<tr><select form="fLocalization" id="iMedium" name="medium">
</select>
<tr><label for="iFast"><?= $this->getText('Fast') ?></label>
<tr><select form="fLocalization" id="iFast" name="fast">
</select>
<tr><label for="iVeryFast"><?= $this->getText('VeryFast') ?></label>
<tr><select form="fLocalization" id="iVeryFast" name="very_fast">
</select>
<tr><label for="iSeaSpeed"><?= $this->getText('Sea') ?></label>
<tr><select form="fLocalization" id="iSeaSpeed" name="sea_speed">
</select>
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Length') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tbody>
<tr><label for="iVeryShort"><?= $this->getText('VeryShort') ?></label>
<tr><select form="fLocalization" id="iVeryShort" name="very_short">
</select>
<tr><label for="iShort"><?= $this->getText('Short') ?></label>
<tr><select form="fLocalization" id="iShort" name="short">
</select>
<tr><label for="iMedium"><?= $this->getText('Medium') ?></label>
<tr><select form="fLocalization" id="iMedium" name="medium">
</select>
<tr><label for="iLong"><?= $this->getText('Long') ?></label>
<tr><select form="fLocalization" id="iLong" name="long">
</select>
<tr><label for="iVeryLong"><?= $this->getText('VeryLong') ?></label>
<tr><select form="fLocalization" id="iVeryLong" name="very_long">
</select>
<tr><label for="iSeaLength"><?= $this->getText('Sea') ?></label>
<tr><select form="fLocalization" id="iSeaLength" name="sea_length">
</select>
</table>
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Area') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tbody>
<tr><label for="iVerySmall"><?= $this->getText('VerySmall') ?></label>
<tr><select form="fLocalization" id="iVerySmall" name="very_small">
</select>
<tr><label for="iSmall"><?= $this->getText('Small') ?></label>
<tr><select form="fLocalization" id="iSmall" name="small">
</select>
<tr><label for="iMedium"><?= $this->getText('Medium') ?></label>
<tr><select form="fLocalization" id="iMedium" name="medium">
</select>
<tr><label for="iLarge"><?= $this->getText('Large') ?></label>
<tr><select form="fLocalization" id="iLarge" name="large">
</select>
<tr><label for="iVeryLarge"><?= $this->getText('VeryLarge') ?></label>
<tr><select form="fLocalization" id="iVeryLarge" name="very_large">
</select>
</table>
</form>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Volume') ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tbody>
<tr><label for="iVerySmall"><?= $this->getText('VerySmall') ?></label>
<tr><select form="fLocalization" id="iVerySmall" name="very_small">
</select>
<tr><label for="iSmall"><?= $this->getText('Small') ?></label>
<tr><select form="fLocalization" id="iSmall" name="small">
</select>
<tr><label for="iMedium"><?= $this->getText('Medium') ?></label>
<tr><select form="fLocalization" id="iMedium" name="medium">
</select>
<tr><label for="iLarge"><?= $this->getText('Large') ?></label>
<tr><select form="fLocalization" id="iLarge" name="large">
</select>
<tr><label for="iVeryLarge"><?= $this->getText('VeryLarge') ?></label>
<tr><select form="fLocalization" id="iVeryLarge" name="very_large">
</select>
<tr><label for="iTeaspoon"><?= $this->getText('Teaspoon') ?></label>
<tr><select form="fLocalization" id="iTeaspoon" name="teaspoon">
</select>
<tr><label for="iTablespoon"><?= $this->getText('Tablespoon') ?></label>
<tr><select form="fLocalization" id="iTablespoon" name="tablespoon">
</select>
<tr><label for="iGlass"><?= $this->getText('Glass') ?></label>
<tr><select form="fLocalization" id="iGlass" name="glass">
</select>
</table>
</form>
</div>
</section>
</div>
</div>
</div>
</div>
</div>

BIN
img/module_teaser_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

51
info.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": {
"id": 1000100000,
"internal": "Admin",
"external": "OMS Admin"
},
"version": "1.0.0",
"requirements": {
"phpOMS": "1.0.0",
"phpOMS-db": "1.0.0"
},
"creator": {
"name": "Orange Management",
"website": "www.spl1nes.com"
},
"description": "The administration module.",
"directory": "Admin",
"dependencies": {},
"providing": {
"Navigation": "*"
},
"load": [
{
"pid": [
"1854402adfd24425fd13776a2d3787151609b360"
],
"type": 4,
"for": "Content",
"file": "Admin",
"from": "Admin"
},
{
"pid": [
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd"
],
"type": 5,
"from": "Admin",
"for": "Navigation",
"file": "Navigation"
},
{
"pid": [
"1854402adfd24425fd13776a2d3787151609b360"
],
"type": 5,
"for": "Content",
"file": "",
"from": "Admin"
}
]
}