This commit is contained in:
Dennis Eichhorn 2015-11-29 21:57:18 +01:00
commit d9badeada7
24 changed files with 1889 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Admin\Install;
/**
* 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($dbPool)
{
$navData = json_decode(file_get_contents(__DIR__ . '/nav.install.json'), true);
$class = '\\Modules\\Navigation\\Admin\\Installer';
$class::installExternal($dbPool, $navData);
}
}

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": []
}
]
}
]
}
]

227
Admin/Installer.php Normal file
View File

@ -0,0 +1,227 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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\Pool;
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(Pool $dbPool, array $info)
{
parent::install($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_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();
/* 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) NOT NULL,
`account_email` varchar(70) NOT NULL,
`account_tries` tinyint(2) NOT NULL DEFAULT 0,
`account_lactive` datetime NOT NULL,
`account_created` datetime NOT NULL,
PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->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;
}
}
}

326
Controller.php Normal file
View File

@ -0,0 +1,326 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin;
use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\GroupMapper;
use Modules\Navigation\Models\Navigation;
use Modules\Navigation\Views\NavigationView;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\RequestDestination;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface;
use phpOMS\Views\View;
use phpOMS\Views\ViewLayout;
/**
* 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 name.
*
* @var \string
* @since 1.0.0
*/
protected static $module = 'Admin';
/**
* Localization files.
*
* @var \string
* @since 1.0.0
*/
protected static $localization = [
RequestDestination::BACKEND => ['backend'],
];
/**
* Providing.
*
* @var \string
* @since 1.0.0
*/
protected static $providing = [
'Content',
];
/**
* Dependencies.
*
* @var \string
* @since 1.0.0
*/
protected static $dependencies = [];
/**
* Routing elements.
*
* @var array
* @since 1.0.0
*/
protected static $routes = [
'^.*/backend/admin/settings/general.*$' => [['dest' => '\Modules\Admin\Controller:viewSettingsGeneral', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/account/list.*$' => [['dest' => '\Modules\Admin\Controller:viewAccountList', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/account/settings.*$' => [['dest' => '\Modules\Admin\Controller:viewAccountSettings', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/account/create.*$' => [['dest' => '\Modules\Admin\Controller:viewAccountCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/group/list.*$' => [['dest' => '\Modules\Admin\Controller:viewGroupList', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/group/settings.*$' => [['dest' => '\Modules\Admin\Controller:viewGroupSettings', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/group/create.*$' => [['dest' => '\Modules\Admin\Controller:viewGroupCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/module/list.*$' => [['dest' => '\Modules\Admin\Controller:viewModuleList', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/admin/module/settings.*$' => [['dest' => '\Modules\Admin\Controller:viewModuleProfile', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
];
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewSettingsGeneral(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$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->createNavigation(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 RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/accounts-list');
$view->addData('nav', $this->createNavigation(1000104001, $request, $response));
$accountMapper = new AccountMapper($this->app->dbPool->get());
$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 RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/accounts-single');
$view->addData('nav', $this->createNavigation(1000104001, $request, $response));
$accountMapper = new AccountMapper($this->app->dbPool->get());
$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 RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewAccountCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/accounts-create');
$view->addData('nav', $this->createNavigation(1000104001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/groups-list');
$view->addData('nav', $this->createNavigation(1000103001, $request, $response));
$groupMapper = new GroupMapper($this->app->dbPool->get());
$view->setData('list:elements', $groupMapper->getAll());
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/groups-single');
$view->addData('nav', $this->createNavigation(1000103001, $request, $response));
$groupMapper = new GroupMapper($this->app->dbPool->get());
$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 RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewGroupCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/groups-create');
$view->addData('nav', $this->createNavigation(1000103001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewModuleList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$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 RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewModuleProfile(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Admin/Theme/backend/modules-single');
return $view;
}
/**
* @param int $pageId Page/parent Id for navigation
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private function createNavigation(\int $pageId, RequestAbstract $request, ResponseAbstract $response)
{
$nav = Navigation::getInstance($request, $this->app->dbPool);
$navView = new NavigationView($this->app, $request, $response);
$navView->setTemplate('/Modules/Navigation/Theme/backend/mid');
$navView->setNav($nav->getNav());
$navView->setLanguage($request->getL11n()->language);
$navView->setParent($pageId);
return $navView;
}
}

26
Models/Account.php Normal file
View File

@ -0,0 +1,26 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Admin\Models;
class Account extends \phpOMS\Account\Account
{
protected $createdAt = null;
public function getCreatedAt() : \DateTime
{
return $this->createdAt ?? new \DateTime('NOW');
}
}

68
Models/AccountMapper.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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;
class AccountMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, 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' => ['name' => 'account_created', 'type' => 'int', 'internal' => 'created'],
];
/**
* 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';
}

26
Models/Group.php Normal file
View File

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

59
Models/GroupMapper.php Normal file
View File

@ -0,0 +1,59 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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;
class GroupMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, 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_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';
}

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,80 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
echo $this->getData('nav')->render(); ?>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Account'] ?></h1>
<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="iType"><?= $this->l11n->lang['Admin']['Type'] ?></label>
<tr><td><select id="iType" name="type">
<option><?= $this->l11n->lang['Admin']['Person'] ?>
<option><?= $this->l11n->lang['Admin']['Organization'] ?>
</select>
<tr><td><label for="iStatus"><?= $this->l11n->lang['Admin']['Status'] ?></label>
<tr><td><select id="iStatus" name="status">
<option><?= $this->l11n->lang['Admin']['Active'] ?>
<option><?= $this->l11n->lang['Admin']['Inactive'] ?>
<option><?= $this->l11n->lang['Admin']['Timeout'] ?>
<option><?= $this->l11n->lang['Admin']['Banned'] ?>
</select>
<tr><td><label for="iUsername"><?= $this->l11n->lang['Admin']['Username'] ?></label>
<tr><td><input id="iUsername" name="name" type="text" placeholder="&#xf007; Fred">
<tr><td><label for="iName1"><?= $this->l11n->lang['Admin']['Name1'] ?></label>
<tr><td><input id="iName1" name="name1" type="text" placeholder="&#xf007; Donald" required>
<tr><td><label for="iName2"><?= $this->l11n->lang['Admin']['Name2'] ?></label>
<tr><td><input id="iName2" name="name2" type="text" placeholder="&#xf007; Fauntleroy">
<tr><td><label for="iName3"><?= $this->l11n->lang['Admin']['Name3'] ?></label>
<tr><td><input id="iName3" name="name3" type="text" placeholder="&#xf007; Duck">
<tr><td><label for="iEmail"><?= $this->l11n->lang['Admin']['Email'] ?></label>
<tr><td><input id="iEmail" name="email" type="email" placeholder="&#xf0e0; d.duck@duckburg.com">
<tr><td><label for="iPassword"><?= $this->l11n->lang['Admin']['Name3'] ?></label>
<tr><td><input id="iPassword" name="password" type="text" placeholder="&#xf023; Pa55ssw0rd?">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Create'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Groups'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Permissions'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf084; news_create">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>

View File

@ -0,0 +1,57 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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();
?>
<section class="box w-100">
<table class="table">
<caption><?= $this->l11n->lang['Admin']['Groups']; ?></caption>
<thead>
<tr>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td><?= $this->l11n->lang['Admin']['Status']; ?>
<td class="wf-100"><?= $this->l11n->lang['Admin']['Name']; ?>
<td><?= $this->l11n->lang['Admin']['Activity']; ?>
<td><?= $this->l11n->lang['Admin']['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->getStatus(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></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->l11n->lang[0]['Empty']; ?>
<?php endif; ?>
</table>
</section>

View File

@ -0,0 +1,87 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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(); ?>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Account'] ?></h1>
<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->l11n->lang[0]['ID'] ?></label>
<tr><td><input id="iId" name="id" type="text" value="<?= $account->getId(); ?>" disabled>
<tr><td><label for="iType"><?= $this->l11n->lang['Admin']['Type'] ?></label>
<tr><td><select id="iType" name="type">
<option value="<?= \phpOMS\Account\AccountType::USER; ?>"<?= $account->getType() === \phpOMS\Account\AccountType::USER ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Person'] ?>
<option value="<?= \phpOMS\Account\AccountType::GROUP; ?>"<?= $account->getType() === \phpOMS\Account\AccountType::GROUP ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Organization'] ?>
</select>
<tr><td><label for="iStatus"><?= $this->l11n->lang['Admin']['Status'] ?></label>
<tr><td><select id="iStatus" name="status">
<option value="<?= \phpOMS\Account\AccountStatus::ACTIVE; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::ACTIVE ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Active'] ?>
<option value="<?= \phpOMS\Account\AccountStatus::INACTIVE; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::INACTIVE ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Inactive'] ?>
<option value="<?= \phpOMS\Account\AccountStatus::TIMEOUT; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::TIMEOUT ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Timeout'] ?>
<option value="<?= \phpOMS\Account\AccountStatus::BANNED; ?>"<?= $account->getStatus() === \phpOMS\Account\AccountStatus::BANNED ? ' selected' : ''; ?>><?= $this->l11n->lang['Admin']['Banned'] ?>
</select>
<tr><td><label for="iUsername"><?= $this->l11n->lang['Admin']['Username'] ?></label>
<tr><td><input id="iUsername" name="name" type="text" placeholder="&#xf007; Fred" value="<?= $account->getEmail(); ?>" disabled>
<tr><td><label for="iName1"><?= $this->l11n->lang['Admin']['Name1'] ?></label>
<tr><td><input id="iName1" name="name1" type="text" placeholder="&#xf007; Donald" value="<?= $account->getName1(); ?>" required>
<tr><td><label for="iName2"><?= $this->l11n->lang['Admin']['Name2'] ?></label>
<tr><td><input id="iName2" name="name2" type="text" placeholder="&#xf007; Fauntleroy" value="<?= $account->getName2(); ?>">
<tr><td><label for="iName3"><?= $this->l11n->lang['Admin']['Name3'] ?></label>
<tr><td><input id="iName3" name="name3" type="text" placeholder="&#xf007; Duck" value="<?= $account->getName3(); ?>">
<tr><td><label for="iEmail"><?= $this->l11n->lang['Admin']['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->l11n->lang['Admin']['Name3'] ?></label>
<tr><td><input id="iPassword" name="password" type="text" placeholder="&#xf023; Pa55ssw0rd?">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Create'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Groups'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Permissions'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="&#xf084; news_create">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>

View File

@ -0,0 +1,64 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/*
* UI Logic
*/
echo $this->getData('nav')->render(); ?>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Group'] ?></h1>
<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="iGname"><?= $this->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGname" name="gname" type="text" placeholder="&#xf0c0; Guest" required>
<tr><td><label for="iGroupDescription"><?= $this->l11n->lang['Admin']['Description'] ?></label>
<tr><td><textarea id="iGroupDescription" name="description" placeholder="&#xf040;"></textarea>
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Create'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Parent'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-66 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Permissions'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>

View File

@ -0,0 +1,55 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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(); ?>
<section class="box w-100">
<table class="table">
<caption><?= $this->l11n->lang['Admin']['Groups']; ?></caption>
<thead>
<tr>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td class="wf-100"><?= $this->l11n->lang['Admin']['Name']; ?>
<td><?= $this->l11n->lang['Admin']['Parents']; ?>
<td><?= $this->l11n->lang['Admin']['Children']; ?>
<td><?= $this->l11n->lang['Admin']['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->l11n->lang[0]['Empty']; ?>
<?php endif; ?>
</table>
</section>

View File

@ -0,0 +1,84 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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(); ?>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Group'] ?></h1>
<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->l11n->lang[0]['ID'] ?></label>
<tr><td><input id="iGid" name="gid" type="text" value="<?= $group->getId(); ?>" disabled>
<tr><td><label for="iGname"><?= $this->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGname" name="gname" type="text" placeholder="&#xf0c0; Guest" value="<?= $group->getName(); ?>">
<tr><td><label for="iGroupDescription"><?= $this->l11n->lang['Admin']['Description'] ?></label>
<tr><td><textarea id="iGroupDescription" name="description" placeholder="&#xf040;"><?= $group->getDescription(); ?></textarea>
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Create'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Parent'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf0c0; Guest">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Permissions'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iPermissionName" name="permissionname" type="text" placeholder="&#xf084; Admin">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Accounts'] ?></h1>
<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->l11n->lang['Admin']['Name'] ?></label>
<tr><td><input id="iGParentName" name="parentname" type="text" placeholder="&#xf234; Donald Duck">
<tr><td><input type="submit" value="<?= $this->l11n->lang[0]['Add'] ?>">
</table>
</form>
</div>
</section>

View File

@ -0,0 +1,62 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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));
?>
<section class="box w-100">
<table class="table">
<caption><?= $this->l11n->lang['Admin']['Modules']; ?></caption>
<thead>
<tr>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td class="wf-100"><?= $this->l11n->lang['Admin']['Name']; ?>
<td><?= $this->l11n->lang['Admin']['Version']; ?>
<td><?= $this->l11n->lang['Admin']['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->l11n->lang['Admin']['Active']);
elseif (in_array($module['name']['internal'], $installed))
echo strtolower($this->l11n->lang['Admin']['Inactive']);
else
echo strtolower($this->l11n->lang['Admin']['Available']); ?></a>
<?php endforeach; ?>
<?php if($count === 0) : ?>
<tr><td colspan="4" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
<?php endif; ?>
</table>
</section>

View File

View File

@ -0,0 +1,86 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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;
?>
<section class="box w-33 floatLeft">
<h1><?= $modules[$id]['name']['external'] ?></h1>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr>
<td><?= $this->l11n->lang['Admin']['Name'] ?>
<td><?= $modules[$id]['name']['external']; ?>
<tr>
<td><?= $this->l11n->lang['Admin']['Version'] ?>
<td><?= $modules[$id]['version'] ?>
<tr>
<td><?= $this->l11n->lang['Admin']['CreatedBy'] ?>
<td><?= $modules[$id]['creator']['name'] ?>
<tr>
<td><?= $this->l11n->lang['Admin']['Website'] ?>
<td><?= $modules[$id]['creator']['website'] ?>
<tr>
<td><?= $this->l11n->lang['Admin']['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/deactivate?id=' . $id); ?>"><?= $this->l11n->lang['Admin']['Deactivate'] ?></button>
<?php elseif (in_array($id, $installed)) : ?>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('POST:/{/lang}/backend/admin/module/deactivate?id=' . $id); ?>"><?= $this->l11n->lang['Admin']['Uninstall'] ?></button>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('POST:/{/lang}/backend/admin/module/deactivate?id=' . $id); ?>"><?= $this->l11n->lang['Admin']['Activate'] ?></button>
<?php elseif (isset($modules[$id])) : ?>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('PUT:/{/lang}/backend/admin/module/install?id=' . $id); ?>"><?= $this->l11n->lang['Admin']['Install'] ?></button>
<button data-reload="<?= \phpOMS\Uri\UriFactory::build('DELETE:/{/lang}/backend/admin/module/delete?id=' . $id); ?>"><?= $this->l11n->lang['Admin']['Delete'] ?></button>
<?php endif; ?>
</table>
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Settings'] ?></h1>
<div class="inner">
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Groups'] ?></h1>
<div class="inner">
</div>
</section>
<section class="box w-33 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Permissions'] ?></h1>
<div class="inner">
</div>
</section>

View File

@ -0,0 +1,98 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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\ISO3166EnumArray::getConstants();
$timezones = \phpOMS\Localization\TimeZoneEnumArray::getConstants();
$timeformats = \phpOMS\Localization\ISO8601EnumArray::getConstants();
$languages = \phpOMS\Localization\ISO639EnumArray::getConstants();
$currencies = \phpOMS\Localization\ISO4217EnumArray::getConstants();
?>
<section class="box w-50 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Settings'] ?></h1>
<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->l11n->lang['Admin']['OrganizationName'] ?></label>
<tr><td><input id="iOname" name="oname" type="text" value="<?= $_oname; ?>" placeholder="&#xf12e; Money Bin" required>
<tr><td><label for="iPassword"><?= $this->l11n->lang['Admin']['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->l11n->lang[0]['Save'] ?>">
</table>
</form>
</div>
</section>
<section class="box w-50 floatLeft">
<h1><?= $this->l11n->lang['Admin']['Localization'] ?></h1>
<div class="inner">
<form 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->l11n->lang['Admin']['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->l11n->lang['Admin']['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->l11n->lang['Admin']['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->l11n->lang['Admin']['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="iCurrencies"><?= $this->l11n->lang['Admin']['Currency'] ?></label>
<tr><td colspan="2"><select id="iCurrencies" name="currency">
<?php foreach($currencies as $code => $currency) : ?>
<option value="<?= $code; ?>"<?= strtolower($code) == strtolower($_currency) ? ' selected' : ''; ?>><?= $currency[0]; ?>
<?php endforeach; ?>
</select>
<tr><td colspan="2"><h2><?= $this->l11n->lang['Admin']['Numberformat'] ?></h2>
<tr><td><label for="iDecimalPoint"><?= $this->l11n->lang['Admin']['DecimalPoint'] ?></label>
<td><label for="iThousandSep"><?= $this->l11n->lang['Admin']['ThousandsSeparator'] ?></label>
<tr><td><input id="iDecimalPoint" name="decimalpoint" type="text" value="<?= $_decimal_point; ?>" placeholder="." required>
<td><input id="iThousandSep" name="thousandsep" type="text" value="<?= $_thousands_sep; ?>" placeholder="," required>
<tr><td colspan="2"><input type="submit" value="<?= $this->l11n->lang[0]['Save'] ?>">
</table>
</form>
</div>
</section>

View File

@ -0,0 +1,18 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 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,104 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG['Admin'] = [
'Account' => 'Account',
'Accounts' => 'Accounts',
'Active' => 'Active',
'Activate' => 'Activate',
'Activity' => 'Activity',
'Available' => 'Available',
'All' => 'All',
'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',
'Features' => 'Features',
'File' => 'File',
'Group' => 'Group',
'Groups' => 'Groups',
'Inactive' => 'Inactive',
'Install' => 'Install',
'Installed' => 'Installed',
'LAddress' => 'Local Address',
'Language' => 'Language',
'Localization' => 'Localization',
'Loginname' => 'Login Name',
'Lowercase' => 'Lowercase',
'Maintenance' => 'Maintenance',
'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',
'Settings' => 'Settings',
'SettingsGeneral' => 'Settings - General',
'Single' => 'Single',
'Specialchar' => 'Special character',
'Status' => 'Status',
'Total' => 'Total',
'Release' => 'Release',
'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',
'Warnings' => 'Warnings',
'Website' => 'Website',
'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,27 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG['Navigation'] = [
'Admin' => 'Admin',
'Create' => 'Create',
'Front' => 'Front',
'General' => 'General',
'Groups' => 'Groups',
'List' => 'List',
'Members' => 'Members',
'Modules' => 'Modules',
'Account' => 'Account',
'Accounts' => 'Accounts',
];

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": "nav.backend"
},
{
"pid": [
"1854402adfd24425fd13776a2d3787151609b360"
],
"type": 5,
"for": "Content",
"file": "backend",
"from": "Admin"
}
]
}