mirror of
https://github.com/Karaka-Management/oms-OnlineResourceWatcher.git
synced 2026-01-11 16:08:41 +00:00
update drafting
This commit is contained in:
parent
422093589e
commit
692d8fdcc7
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.2)
|
|||
project( OnlineResourceWatcherServerApp )
|
||||
add_executable( OnlineResourceWatcherServerApp main.cpp )
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-march=native -msse2 -mavx -maes -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "-march=native -msse2 -mavx -maes")
|
||||
|
||||
include_directories( /usr/include )
|
||||
link_directories( /usr/lib )
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ Stdlib::HashTable::ht *generate_routes()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-h *.*$", &Controller::ApiController::printHelp);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-v *.*$", &Controller::ApiController::printVersion);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-r *.*$", &Controller::ApiController::checkResources);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-h *.*$", (void *) &Controller::ApiController::printHelp);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-v *.*$", (void *) &Controller::ApiController::printVersion);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-r *.*$", (void *) &Controller::ApiController::checkResources);
|
||||
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-\\-install *.*$", &Controller::InstallController::installApplication);
|
||||
Stdlib::HashTable::set_entry(table, "^.*?\\-\\-install *.*$", (void *) &Controller::InstallController::installApplication);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
|
|
|||
BIN
app/server/build/OnlineResourceWatcherServerApp
Executable file
BIN
app/server/build/OnlineResourceWatcherServerApp
Executable file
Binary file not shown.
|
|
@ -19,4 +19,12 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*?/logout(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Controllers\ApiController:apiLogout',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ final class Application
|
|||
$this->app->dbPool->create('select', $this->config['db']['core']['masters']['select']);
|
||||
|
||||
$this->app->router = new WebRouter($this->app);
|
||||
$this->app->router->importFromFile(__DIR__ . '/Routes.php');
|
||||
$this->app->router->importFromFile(__DIR__ . '/../../Routes.php');
|
||||
|
||||
/* CSRF token OK? */
|
||||
|
|
|
|||
100
app/web/Applications/Backend/Routes.php
Normal file
100
app/web/Applications/Backend/Routes.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^/*$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:dashboardView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^/admin/organizations$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:adminOrganizationsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/admin/users$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:adminUsersView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/admin/resources$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:adminResourcesView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/admin/bills$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:adminBillsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/admin/logs$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:adminLogsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^/organization/settings$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:organizationSettingsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/organization/users$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:organizationUsersView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/organization/users/\d+$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:organizationUsersEditView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/organization/resources$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:organizationResourcesView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/organization/bills$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:organizationBillsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^/user/settings$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:userSettingsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/user/resources$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:userResourcesView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/user/resources/create$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:userResourcesCreateView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^/user/reports$' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:userReportsView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
--text-on-background-color-2: rgba(255, 255, 255, 0.85);
|
||||
--nav-category-background: #343a40;
|
||||
--nav-category-background-highlight: #3697db;
|
||||
--nav-category-background-hover: #434a51;
|
||||
--nav-category-background-hover: #dcd9ec;
|
||||
--nav-sub-background: #ebeff3;
|
||||
--nav-sub-background-highlight: rgb(160,56,228);
|
||||
--nav-sub-background-hover: rgb(42, 43, 48);
|
||||
|
|
@ -75,7 +75,8 @@ body {
|
|||
align-items: center;
|
||||
flex-flow: row;
|
||||
flex-shrink: 0;
|
||||
height: 55px; }
|
||||
height: 55px;
|
||||
color: #fff; }
|
||||
body > header > form {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
|
|
@ -112,24 +113,25 @@ main {
|
|||
|
||||
#nav-side-inner {
|
||||
border-top: none; }
|
||||
#nav-side-inner > li li:first-child {
|
||||
border-top: none;
|
||||
border-bottom: none; }
|
||||
#nav-side-inner > li li a:hover {
|
||||
background: var(--nav-sub-background); }
|
||||
#nav-side-inner > li {
|
||||
/* Category
|
||||
li:first-child {
|
||||
// border-top: none;
|
||||
// border-bottom: none;
|
||||
}
|
||||
*/ }
|
||||
#nav-side-inner > li li a:hover, #nav-side-inner > li li a.active, #nav-side-inner > li li a:focus {
|
||||
background: var(--nav-category-background-hover); }
|
||||
|
||||
#logo {
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding-left: 1rem; }
|
||||
#logo select {
|
||||
background: var(--nav-category-background);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: .8rem; }
|
||||
flex-direction: row;
|
||||
align-items: center; }
|
||||
|
||||
#logo-name {
|
||||
margin-left: 1rem; }
|
||||
|
||||
#t-nav-container {
|
||||
margin-left: auto; }
|
||||
|
|
@ -143,13 +145,16 @@ main {
|
|||
|
||||
#t-nav {
|
||||
font-size: .8rem;
|
||||
color: #000;
|
||||
color: #fff;
|
||||
font-weight: 300; }
|
||||
#t-nav a {
|
||||
padding: 0 5px 0 5px;
|
||||
border: 2px solid rgba(255, 255, 255, 0);
|
||||
border-radius: 3rem;
|
||||
padding: .5rem 1rem .5rem 1rem;
|
||||
line-height: 25px; }
|
||||
#t-nav a:hover, #t-nav a:focus {
|
||||
color: var(--link-hover); }
|
||||
#t-nav a:hover, #t-nav a:focus, #t-nav a.active {
|
||||
border: 2px solid rgba(255, 255, 255, 0.25);
|
||||
background: rgba(255, 255, 255, 0.25); }
|
||||
#t-nav i {
|
||||
margin-right: 5px; }
|
||||
#t-nav li {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ body {
|
|||
flex-flow: row;
|
||||
flex-shrink: 0;
|
||||
height: 55px;
|
||||
color: #fff;
|
||||
//box-shadow: 0 0 3px 1px rgba(72, 71, 114, 0.3);
|
||||
|
||||
> form {
|
||||
|
|
@ -87,32 +88,34 @@ main {
|
|||
border-top: none;
|
||||
|
||||
> li {
|
||||
/* Category
|
||||
li:first-child {
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
// border-top: none;
|
||||
// border-bottom: none;
|
||||
}
|
||||
*/
|
||||
|
||||
li a:hover {
|
||||
background: var(--nav-sub-background);
|
||||
li {
|
||||
a {
|
||||
&:hover, &.active, &:focus {
|
||||
background: var(--nav-category-background-hover);
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
|
||||
#logo {
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
select {
|
||||
background: var(--nav-category-background);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: .8rem;
|
||||
}
|
||||
#logo-name {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
#t-nav-container {
|
||||
|
|
@ -129,15 +132,18 @@ main {
|
|||
|
||||
#t-nav {
|
||||
font-size: .8rem;
|
||||
color: #000;
|
||||
color: #fff;
|
||||
font-weight: 300;
|
||||
|
||||
a {
|
||||
padding: 0 5px 0 5px;
|
||||
border: 2px solid rgba(255, 255, 255, 0);
|
||||
border-radius: 3rem;
|
||||
padding: .5rem 1rem .5rem 1rem;
|
||||
line-height: 25px;
|
||||
|
||||
&:hover, &:focus {
|
||||
color: var(--link-hover);
|
||||
&:hover, &:focus, &.active {
|
||||
border: 2px solid rgba(255, 255, 255, 0.25);
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
--text-on-background-color-2: rgba(255, 255, 255, 0.85);
|
||||
--nav-category-background: #343a40;
|
||||
--nav-category-background-highlight: #3697db;
|
||||
--nav-category-background-hover: #434a51;
|
||||
--nav-category-background-hover: #dcd9ec;
|
||||
--nav-sub-background: #ebeff3;
|
||||
--nav-sub-background-highlight: rgb(160,56,228);
|
||||
--nav-sub-background-hover: rgb(42, 43, 48);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
--nav-category-background: #343a40;
|
||||
--nav-category-background-highlight: #3697db;
|
||||
--nav-category-background-hover: #434a51;
|
||||
--nav-category-background-hover: #dcd9ec;
|
||||
|
||||
--nav-sub-background: #ebeff3;
|
||||
--nav-sub-background-highlight: rgb(160,56,228);
|
||||
|
|
|
|||
|
|
@ -45,81 +45,9 @@ $dispatch = $this->getData('dispatch') ?? [];
|
|||
</head>
|
||||
<body>
|
||||
<div class="vh" id="dim"></div>
|
||||
<header>
|
||||
<div id="t-nav-container">
|
||||
<ul id="t-nav" role="navigation">
|
||||
<li><a href=""><span class="link">Logout</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
<?php include __DIR__ . '/tpl/header.tpl.php'; ?>
|
||||
<main>
|
||||
<nav id="nav-side">
|
||||
<div id="nav-side-outer" class="oms-ui-state">
|
||||
<ul id="nav-side-inner" class="nav" role="navigation">
|
||||
<li>
|
||||
<input name="category-admin" class="oms-ui-state" id="nav-admin" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-admin">
|
||||
<i class=""></i>
|
||||
<span>Admin</span>
|
||||
<i class="fa lni lni-chevron-right expand"></i>
|
||||
</label>
|
||||
</li>
|
||||
<li><a href="">Organizations</a>
|
||||
<li><a href="">Users</a>
|
||||
<li><a href="">Bills</a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input name="category-org" class="oms-ui-state" id="nav-org" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-org">
|
||||
<i class=""></i>
|
||||
<span>Organization</span>
|
||||
<i class="fa lni lni-chevron-right expand"></i>
|
||||
</label>
|
||||
</li>
|
||||
<li><a href="">Settings</a>
|
||||
<li><a href="">Users</a>
|
||||
<li><a href="">Resources</a>
|
||||
<li><a href="">Bills</a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input name="category-home" class="oms-ui-state" id="nav-home" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-home">
|
||||
<i class=""></i>
|
||||
<span>Home</span>
|
||||
<i class="fa lni lni-chevron-right expand"></i>
|
||||
</label>
|
||||
</li>
|
||||
<li><a href="">Settings</a>
|
||||
<li><a href="">Resources</a>
|
||||
<li><a href="">Reports</a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input name="category-legal" class="oms-ui-state" id="nav-legal" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-legal">
|
||||
<i class=""></i>
|
||||
<span>Legal</span>
|
||||
<i class="fa lni lni-chevron-right expand"></i>
|
||||
</label>
|
||||
</li>
|
||||
<li><a href="">Terms</a>
|
||||
<li><a href="">Privacy</a>
|
||||
<li><a href="">Imprint</a>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<?php include __DIR__ . '/tpl/nav-side.tpl.php'; ?>
|
||||
<div id="content" class="container-fluid" role="main">
|
||||
<?php
|
||||
$c = 0;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,74 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return [[
|
||||
'SignIn' => 'Sign In',
|
||||
'Username' => 'Username',
|
||||
'Logo' => 'Logo',
|
||||
'Terms' => 'Terms',
|
||||
'Imprint' => 'Imprint',
|
||||
'PrivacyPolicy' => 'Privacy Policy',
|
||||
'Password' => 'Password',
|
||||
'Action' => 'Action',
|
||||
'Add' => 'Add',
|
||||
'Admin' => 'Admin',
|
||||
'Back' => 'Back',
|
||||
'Bills' => 'Bills',
|
||||
'By' => 'By',
|
||||
'Cancel' => 'Cancel',
|
||||
'Checked' => 'Checked',
|
||||
'Dashboard' => 'Dashboard',
|
||||
'Date' => 'Date',
|
||||
'Filter' => 'Filter',
|
||||
'ForgotPassword' => 'Forgot Password',
|
||||
'Home' => 'Home',
|
||||
'ID' => 'ID',
|
||||
'Imprint' => 'Imprint',
|
||||
'Legal' => 'Legal',
|
||||
'Log' => 'Log',
|
||||
'Logo' => 'Logo',
|
||||
'SignOut' => 'Sign Out',
|
||||
'Logs' => 'Logs',
|
||||
'Organization' => 'Organization',
|
||||
'Organizations' => 'Organizations',
|
||||
'Password' => 'Password',
|
||||
'PrivacyPolicy' => 'Privacy Policy',
|
||||
'Ref' => 'Ref',
|
||||
'Report' => 'Report',
|
||||
'Reports' => 'Reports',
|
||||
'Reset' => 'Reset',
|
||||
'Resource' => 'Resource',
|
||||
'Resources' => 'Resources',
|
||||
'Create' => 'Create',
|
||||
'Delete' => 'Delete',
|
||||
'Suspend' => 'Suspend',
|
||||
'Send' => 'Send',
|
||||
'Save' => 'Save',
|
||||
'Search' => 'Search',
|
||||
'Settings' => 'Settings',
|
||||
'SignIn' => 'Sign In',
|
||||
'Status' => 'Status',
|
||||
'Submit' => 'Submit',
|
||||
'Terms' => 'Terms',
|
||||
'Trigger' => 'Trigger',
|
||||
'Type' => 'Type',
|
||||
'User' => 'User',
|
||||
'Username' => 'Username',
|
||||
'Users' => 'Users',
|
||||
'New' => 'New',
|
||||
'Number' => 'Number',
|
||||
'CustomerNo' => 'Customer No.',
|
||||
'CustomerName' => 'Customer Name',
|
||||
'Amount' => 'Amount',
|
||||
'Members' => 'Members',
|
||||
'Name' => 'Name',
|
||||
'Active' => 'Active',
|
||||
'Address' => 'Address',
|
||||
'Postal' => 'Postal',
|
||||
'City' => 'City',
|
||||
'BillingEmail' => 'Billing Email',
|
||||
'Statistics' => 'Statistics',
|
||||
'PlanSettings' => 'Plan Settings',
|
||||
'BillingSettings' => 'Billing Settings',
|
||||
'UserSettings' => 'User Settings',
|
||||
'Login' => 'Login',
|
||||
'Email' => 'Email',
|
||||
'NewPassword' => 'New Password',
|
||||
'CreateResource' => 'Create Resource',
|
||||
'Inform' => 'Inform',
|
||||
'Element' => 'Element',
|
||||
'Exit' => 'Exit',
|
||||
'Url' => 'Url',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ $head = $this->getData('head');
|
|||
</main>
|
||||
<footer>
|
||||
<ul>
|
||||
<li><a href="<?= UriFactory::build('{/prefix}privacy'); ?>"><?= $this->getHtml('PrivacyPolicy', '0', '0'); ?></a>
|
||||
<li><a href="<?= UriFactory::build('{/prefix}terms'); ?>"><?= $this->getHtml('Terms', '0', '0'); ?></a>
|
||||
<li><a href="<?= UriFactory::build('{/prefix}imprint'); ?>"><?= $this->getHtml('Imprint', '0', '0'); ?></a>
|
||||
<li><a href="/privacy"><?= $this->getHtml('PrivacyPolicy', '0', '0'); ?></a>
|
||||
<li><a href="/terms"><?= $this->getHtml('Terms', '0', '0'); ?></a>
|
||||
<li><a href="/imprint"><?= $this->getHtml('Imprint', '0', '0'); ?></a>
|
||||
</ul>
|
||||
</footer>
|
||||
|
||||
|
|
|
|||
111
app/web/Applications/Backend/tpl/admin-bills.tpl.php
Normal file
111
app/web/Applications/Backend/tpl/admin-bills.tpl.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Bills', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'number',
|
||||
$this->getHtml('Number', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'customer_no',
|
||||
$this->getHtml('CustomerNo', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'customer_name',
|
||||
$this->getHtml('CustomerName', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'amount',
|
||||
$this->getHtml('Amount', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
133
app/web/Applications/Backend/tpl/admin-logs.tpl.php
Normal file
133
app/web/Applications/Backend/tpl/admin-logs.tpl.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Logs', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'action',
|
||||
$this->getHtml('Action', '0', '0'),
|
||||
'select',
|
||||
[
|
||||
'create' => $this->getHtml('CREATE', '0', '0'),
|
||||
'modify' => $this->getHtml('UPDATE', '0', '0'),
|
||||
'delete' => $this->getHtml('DELETE', '0', '0'),
|
||||
],
|
||||
false // don't render sort
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'type',
|
||||
$this->getHtml('Type', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'trigger',
|
||||
$this->getHtml('Trigger', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdBy',
|
||||
$this->getHtml('By', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'ref',
|
||||
$this->getHtml('Ref', '0', '0'),
|
||||
'text',
|
||||
[],
|
||||
true,
|
||||
true,
|
||||
false
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><?= $audit->getId(); ?>
|
||||
<td><?php if ($audit->getOld() === null) : echo $this->getHtml('CREATE', '0', '0'); ?>
|
||||
<?php elseif ($audit->getOld() !== null && $audit->getNew() !== null) : echo $this->getHtml('UPDATE', '0', '0'); ?>
|
||||
<?php elseif ($audit->getNew() === null) : echo $this->getHtml('DELETE', '0', '0'); ?>
|
||||
<?php else : echo $this->getHtml('UNKNOWN', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
<td><?= $audit->getType(); ?>
|
||||
<td><?= $audit->getTrigger(); ?>
|
||||
<td><a class="content" href="<?= UriFactory::build('{/prefix}admin/account/settings?id=' . $audit->createdBy->getId()); ?>"><?= $this->printHtml(
|
||||
$this->renderUserName('%3$s %2$s %1$s', [$audit->createdBy->name1, $audit->createdBy->name2, $audit->createdBy->name3, $audit->createdBy->login])
|
||||
); ?></a>
|
||||
<td><?= $this->printHtml($audit->getRef()); ?>
|
||||
<td><?= $audit->createdAt->format('Y-m-d H:i:s'); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
101
app/web/Applications/Backend/tpl/admin-organizations.tpl.php
Normal file
101
app/web/Applications/Backend/tpl/admin-organizations.tpl.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Organizations', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'name',
|
||||
$this->getHtml('Name', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'members',
|
||||
$this->getHtml('Members', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'resources',
|
||||
$this->getHtml('Resources', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
116
app/web/Applications/Backend/tpl/admin-resources.tpl.php
Normal file
116
app/web/Applications/Backend/tpl/admin-resources.tpl.php
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Resources', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'resource',
|
||||
$this->getHtml('Resource', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'user_no',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'user_name',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'status',
|
||||
$this->getHtml('Status', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'lastChecked',
|
||||
$this->getHtml('Checked', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
111
app/web/Applications/Backend/tpl/admin-users.tpl.php
Normal file
111
app/web/Applications/Backend/tpl/admin-users.tpl.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Users', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'name',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'organization',
|
||||
$this->getHtml('Organization', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'resources',
|
||||
$this->getHtml('Resources', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'lastActivity',
|
||||
$this->getHtml('Active', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
24
app/web/Applications/Backend/tpl/header.tpl.php
Normal file
24
app/web/Applications/Backend/tpl/header.tpl.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<header>
|
||||
<a id="logo" href="<?= UriFactory::build('{/prefix}'); ?>">
|
||||
<span><img alt="<?= $this->getHtml('Logo', '0', '0'); ?>" src="Applications/Backend/img/logo.png" width="40px"></span>
|
||||
<span id="logo-name">Jingga</span>
|
||||
</a>
|
||||
<?php include __DIR__ . '/nav-top.tpl.php'; ?>
|
||||
</header>
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<nav id="nav-side">
|
||||
<div id="nav-side-outer" class="oms-ui-state">
|
||||
<ul id="nav-side-inner" class="nav" role="navigation">
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-admin">
|
||||
<i class=""></i>
|
||||
<span><?= $this->getHtml('Admin', '0', '0'); ?></span>
|
||||
</label>
|
||||
</li>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'admin'
|
||||
&& $this->request->uri->getPathElement(1) === 'organizations'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>admin/organizations"><?= $this->getHtml('Organizations', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'admin'
|
||||
&& $this->request->uri->getPathElement(1) === 'users'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>admin/users"><?= $this->getHtml('Users', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'admin'
|
||||
&& $this->request->uri->getPathElement(1) === 'resources'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>admin/resources"><?= $this->getHtml('Resources', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'admin'
|
||||
&& $this->request->uri->getPathElement(1) === 'bills'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>admin/bills"><?= $this->getHtml('Bills', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'admin'
|
||||
&& $this->request->uri->getPathElement(1) === 'logs'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>admin/logs"><?= $this->getHtml('Logs', '0', '0'); ?></a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-org">
|
||||
<i class=""></i>
|
||||
<span><?= $this->getHtml('Organization', '0', '0'); ?></span>
|
||||
</label>
|
||||
</li>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'organization'
|
||||
&& $this->request->uri->getPathElement(1) === 'settings'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>organization/settings"><?= $this->getHtml('Settings', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'organization'
|
||||
&& $this->request->uri->getPathElement(1) === 'users'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>organization/users"><?= $this->getHtml('Users', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'organization'
|
||||
&& $this->request->uri->getPathElement(1) === 'resources'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>organization/resources"><?= $this->getHtml('Resources', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'organization'
|
||||
&& $this->request->uri->getPathElement(1) === 'bills'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>organization/bills"><?= $this->getHtml('Bills', '0', '0'); ?></a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-home">
|
||||
<i class=""></i>
|
||||
<span><?= $this->getHtml('Home', '0', '0'); ?></span>
|
||||
</label>
|
||||
</li>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === ''
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}');
|
||||
?>"><?= $this->getHtml('Dashboard', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'user'
|
||||
&& $this->request->uri->getPathElement(1) === 'settings'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>user/settings"><?= $this->getHtml('Settings', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'user'
|
||||
&& $this->request->uri->getPathElement(1) === 'resources'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>user/resources"><?= $this->getHtml('Resources', '0', '0'); ?></a>
|
||||
<li><a class="<?= $this->request->uri->getPathElement(0) === 'user'
|
||||
&& $this->request->uri->getPathElement(1) === 'reports'
|
||||
? 'active' : '';
|
||||
?>" href="<?= UriFactory::build('{/prefix}'); ?>user/reports"><?= $this->getHtml('Reports', '0', '0'); ?></a>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nav-legal">
|
||||
<i class=""></i>
|
||||
<span><?= $this->getHtml('Legal', '0', '0'); ?></span>
|
||||
</label>
|
||||
</li>
|
||||
<li><a href="/privacy"><?= $this->getHtml('PrivacyPolicy', '0', '0'); ?></a>
|
||||
<li><a href="/terms"><?= $this->getHtml('Terms', '0', '0'); ?></a>
|
||||
<li><a href="/imprint"><?= $this->getHtml('Imprint', '0', '0'); ?></a>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<div id="t-nav-container">
|
||||
<ul id="t-nav" role="navigation">
|
||||
<li><a id="nav-logout" class="active" href="api/logout"
|
||||
data-action='[{"key":1,"listener":"click","action":[{"key":1,"type":"event.prevent"},{"key":2,"type":"message.request","uri":"api\/logout","method":"POST","request_type":"raw"},{"key":3,"type":"dom.reload"}]}]' ><?= $this->getHtml('SignOut', '0', '0'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
99
app/web/Applications/Backend/tpl/organization-bills.tpl.php
Normal file
99
app/web/Applications/Backend/tpl/organization-bills.tpl.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Bills', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'number',
|
||||
$this->getHtml('Number', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'amount',
|
||||
$this->getHtml('Amount', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
116
app/web/Applications/Backend/tpl/organization-resources.tpl.php
Normal file
116
app/web/Applications/Backend/tpl/organization-resources.tpl.php
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Resources', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'resource',
|
||||
$this->getHtml('Resource', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'user_no',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'user_name',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'status',
|
||||
$this->getHtml('Status', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'lastChecked',
|
||||
$this->getHtml('Checked', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<form id="iOrganizationSettings" action="<?= UriFactory::build('{/api}organization/settings'); ?>" method="post">
|
||||
<div class="portlet-head"><?= $this->getHtml('BillingSettings', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name', '0', '0'); ?></label>
|
||||
<input id="iName" name="name" type="text" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iAddress"><?= $this->getHtml('Address', '0', '0'); ?></label>
|
||||
<input id="iAddress" name="address" type="text" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-control">
|
||||
<label for="iPostal"><?= $this->getHtml('Postal', '0', '0'); ?></label>
|
||||
<input id="iPostal" name="postal" type="text">
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label for="iCity"><?= $this->getHtml('City', '0', '0'); ?></label>
|
||||
<input id="iCity" name="city" type="text" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEmail"><?= $this->getHtml('BillingEmail', '0', '0'); ?></label>
|
||||
<input id="iEmail" name="email" type="email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmitOrganization" name="submitOrganization" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<form id="iPlanSettings" action="<?= UriFactory::build('{/api}organization/plan'); ?>" method="post">
|
||||
<div class="portlet-head"><?= $this->getHtml('PlanSettings', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmitPlan" name="sbmitPlan" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Statistics', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmitPlan" name="sbmitPlan" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
106
app/web/Applications/Backend/tpl/organization-users.tpl.php
Normal file
106
app/web/Applications/Backend/tpl/organization-users.tpl.php
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Users', '0', '0')
|
||||
); ?>
|
||||
<a class="button rf save" href="<?= UriFactory::build('{/prefix}'); ?>organization/users/add"><?= $this->getHtml('Add', '0', '0'); ?></a>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'name',
|
||||
$this->getHtml('User', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'resources',
|
||||
$this->getHtml('Resources', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'lastActivity',
|
||||
$this->getHtml('Active', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
11
app/web/Applications/Backend/tpl/user-dashboard.tpl.php
Normal file
11
app/web/Applications/Backend/tpl/user-dashboard.tpl.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">Test Title</div>
|
||||
<div class="portlet-body">
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
99
app/web/Applications/Backend/tpl/user-reports.tpl.php
Normal file
99
app/web/Applications/Backend/tpl/user-reports.tpl.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Reports', '0', '0')
|
||||
); ?>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'resource',
|
||||
$this->getHtml('Resource', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'status',
|
||||
$this->getHtml('Status', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<form id="iUserSettings" action="<?= UriFactory::build('{/api}user/settings'); ?>" method="post">
|
||||
<div class="portlet-head"><?= $this->getHtml('CreateResource', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iLogin"><?= $this->getHtml('Url', '0', '0'); ?></label>
|
||||
<input id="iLogin" name="rul" type="text" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iElement"><?= $this->getHtml('Element', '0', '0'); ?></label>
|
||||
<input id="iElement" name="element" type="text">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iHeader"><?= $this->getHtml('Header', '0', '0'); ?></label>
|
||||
<textarea id="iHeader" name="header"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmitUser" name="submitUser" type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<form id="iAddAccountToGroup" action="<?= UriFactory::build('{/api}admin/group/account'); ?>" method="put">
|
||||
<div class="portlet-head"><?= $this->getHtml('Inform', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iAccount"><?= $this->getHtml('Name', '0', '0'); ?></label>
|
||||
<input id="iAccount" name="account" type="text">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iAccount"><?= $this->getHtml('Email', '0', '0'); ?></label>
|
||||
<input id="iAccount" name="email" type="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Inform', '0', '0'); ?></div>
|
||||
<table class="default">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('User', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<td><?= $this->getHtml('Email', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ([] as $key => $value) : ++$c; $url = UriFactory::build('{/prefix}admin/account/settings?{?}&id=' . $value->getId()); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div class="portlet-foot"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
105
app/web/Applications/Backend/tpl/user-resources.tpl.php
Normal file
105
app/web/Applications/Backend/tpl/user-resources.tpl.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Audit\Models\Audit[] $audits
|
||||
*/
|
||||
$audits = $this->getData('audits') ?? [];
|
||||
|
||||
$tableView = $this->getData('tableView');
|
||||
$tableView->id = 'auditList';
|
||||
$tableView->baseUri = '{/prefix}admin/audit/list';
|
||||
$tableView->setObjects($audits);
|
||||
|
||||
$previous = $tableView->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $tableView->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $tableView->renderTitle(
|
||||
$this->getHtml('Resources', '0', '0')
|
||||
); ?>
|
||||
<a class="button rf save" href="<?= UriFactory::build('{/prefix}'); ?>user/resources/create"><?= $this->getHtml('New', '0', '0'); ?></a>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table id="<?= $tableView->id; ?>" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'id',
|
||||
$this->getHtml('ID', '0', '0'),
|
||||
'number'
|
||||
); ?>
|
||||
<td class="wf-100"><?= $tableView->renderHeaderElement(
|
||||
'resource',
|
||||
$this->getHtml('Resource', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'status',
|
||||
$this->getHtml('Status', '0', '0'),
|
||||
'text'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'lastChecked',
|
||||
$this->getHtml('Checked', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<td><?= $tableView->renderHeaderElement(
|
||||
'createdAt',
|
||||
$this->getHtml('Date', '0', '0'),
|
||||
'date'
|
||||
); ?>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($audits as $key => $audit) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/audit/single?id=' . $audit->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($this->getData('hasPrevious') || $this->getData('hasNext')) : ?>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($this->getData('hasPrevious')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><i class="fa fa-chevron-left"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData('hasNext')) : ?>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><i class="fa fa-chevron-right"></i></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
50
app/web/Applications/Backend/tpl/user-settings.tpl.php
Normal file
50
app/web/Applications/Backend/tpl/user-settings.tpl.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Web\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<form id="iUserSettings" action="<?= UriFactory::build('{/api}user/settings'); ?>" method="post">
|
||||
<div class="portlet-head"><?= $this->getHtml('UserSettings', '0', '0'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iLogin"><?= $this->getHtml('Login', '0', '0'); ?></label>
|
||||
<input id="iLogin" name="login" type="text" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPassword"><?= $this->getHtml('NewPassword', '0', '0'); ?></label>
|
||||
<input id="iPassword" name="password" type="password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEmail"><?= $this->getHtml('Email', '0', '0'); ?></label>
|
||||
<input id="iEmail" name="email" type="email" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEmail"><?= $this->getHtml('Organization', '0', '0'); ?></label>
|
||||
<input id="iEmail" name="organization" type="text" disabled="">
|
||||
<input type="submit" value="<?= $this->getHtml('Exit', '0', '0'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmitUser" name="submitUser" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -62,6 +62,7 @@ final class Application
|
|||
|
||||
$this->app->router = new WebRouter();
|
||||
$this->app->router->importFromFile(__DIR__ . '/../../Routes.php');
|
||||
$this->app->router->importFromFile(__DIR__ . '/Routes.php');
|
||||
|
||||
/* CSRF token OK? */
|
||||
if ($request->getData('CSRF') !== null
|
||||
|
|
|
|||
31
app/web/Applications/Frontend/Routes.php
Normal file
31
app/web/Applications/Frontend/Routes.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^/*$' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:frontView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/features' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:featureView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/pricing' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:pricingView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/signup' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:signupView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -1 +1 @@
|
|||
Front
|
||||
Frontss
|
||||
|
|
@ -7,7 +7,7 @@ use phpOMS\Uri\UriFactory;
|
|||
<header>
|
||||
<div class="floater">
|
||||
<a id="toplogo" href="<?= UriFactory::build('{/lang}'); ?>">
|
||||
<img src="Applications/Frontend/img/logo.png" width="40px">
|
||||
<img alt="Logo" src="Applications/Frontend/img/logo.png" width="40px">
|
||||
<span>Jingga</span>
|
||||
</a>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ namespace Controllers;
|
|||
use Models\AccountMapper;
|
||||
use phpOMS\Auth\LoginReturnType;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\NotificationLevel;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Model\Message\Notify;
|
||||
|
|
@ -41,4 +42,20 @@ class ApiController
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function apiLogout(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
|
||||
$this->app->sessionManager->remove('UID');
|
||||
$this->app->sessionManager->save();
|
||||
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
$response->set($request->uri->__toString(), [
|
||||
'status' => NotificationLevel::OK,
|
||||
'title' => 'Logout successfull',
|
||||
'message' => 'You are redirected to the login page',
|
||||
'response' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,26 @@ declare(strict_types=1);
|
|||
|
||||
namespace Controllers;
|
||||
|
||||
use Models\AuditMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
use Views\TableView;
|
||||
use WebApplication;
|
||||
|
||||
class BackendController
|
||||
{
|
||||
private WebApplication $app;
|
||||
|
||||
public function __construct(WebApplication $app = null)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function signinView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null): RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
|
@ -20,4 +31,742 @@ class BackendController
|
|||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function dashboardView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null): RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/user-dashboard');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function adminOrganizationsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/admin-organizations');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function adminUsersView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/admin-users');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function adminResourcesView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/admin-resources');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function adminBillsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/admin-bills');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function adminLogsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/admin-logs');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function organizationSettingsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/organization-settings');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function organizationUsersEditView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/organization-users-edit');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function organizationUsersView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/organization-users');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function organizationResourcesView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/organization-resources');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function organizationBillsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/organization-bills');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
||||
public function userSettingsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/user-settings');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function userResourcesCreateView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/user-resources-create');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function userResourcesView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/user-resources');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function userReportsView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface {
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Applications/Backend/tpl/user-reports');
|
||||
|
||||
/* Table functionality */
|
||||
|
||||
$searchFieldData = $request->getLike('.*\-p\-.*');
|
||||
$searchField = [];
|
||||
foreach ($searchFieldData as $key => $data) {
|
||||
if ($data === '1') {
|
||||
$split = \explode('-', $key);
|
||||
$member = \end($split);
|
||||
|
||||
$searchField[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$filterFieldData = $request->getLike('.*\-f\-.*?\-t');
|
||||
$filterField = [];
|
||||
foreach ($filterFieldData as $key => $type) {
|
||||
$split = \explode('-', $key);
|
||||
\end($split);
|
||||
|
||||
$member = \prev($split);
|
||||
|
||||
if (!empty($request->getData('auditlist-f-' . $member . '-f1'))) {
|
||||
$filterField[$member] = [
|
||||
'type' => $type,
|
||||
'value1' => $request->getData('auditlist-f-' . $member . '-f1'),
|
||||
'logic1' => $request->getData('auditlist-f-' . $member . '-o1'),
|
||||
'value2' => $request->getData('auditlist-f-' . $member . '-f2'),
|
||||
'logic2' => $request->getData('auditlist-f-' . $member . '-o2'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$pageLimit = 25;
|
||||
$view->addData('pageLimit', $pageLimit);
|
||||
|
||||
$mapper = AuditMapper::getAll()->with('createdBy');
|
||||
$list = AuditMapper::find(
|
||||
search: $request->getData('search'),
|
||||
mapper: $mapper,
|
||||
id: (int) ($request->getData('id') ?? 0),
|
||||
secondaryId: (string) ($request->getData('subid') ?? ''),
|
||||
type: $request->getData('pType'),
|
||||
pageLimit: empty((int) ($request->getData('limit') ?? 0)) ? 100 : ((int) $request->getData('limit')),
|
||||
sortBy: $request->getData('sort_by') ?? '',
|
||||
sortOrder: $request->getData('sort_order') ?? OrderType::DESC,
|
||||
searchFields: $searchField,
|
||||
filters: $filterField
|
||||
);
|
||||
|
||||
$view->setData('audits', $list['data']);
|
||||
|
||||
$tableView = new TableView($this->app->l11nManager, $request, $response);
|
||||
$tableView->module = 'Auditor';
|
||||
$tableView->theme = 'Backend';
|
||||
$tableView->setTitleTemplate('/Templates/table-title');
|
||||
$tableView->setColumnHeaderElementTemplate('/Templates/header-element-table');
|
||||
$tableView->setFilterTemplate('/Templates/popup-filter-table');
|
||||
$tableView->setSortTemplate('/Templates/sort-table');
|
||||
$tableView->setData('hasPrevious', $list['hasPrevious']);
|
||||
$tableView->setData('hasNext', $list['hasNext']);
|
||||
|
||||
$view->addData('tableView', $tableView);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,17 @@ use phpOMS\Message\RequestAbstract;
|
|||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
use WebApplication;
|
||||
|
||||
class FrontController
|
||||
{
|
||||
private WebApplication $app;
|
||||
|
||||
public function __construct(WebApplication $app = null)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function frontView(RequestAbstract $request, ResponseAbstract $response, mixed $data = null): RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
|
|
|||
|
|
@ -28,51 +28,4 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^/*$' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:frontView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/features' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:featureView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/pricing' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:pricingView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/signin' => [
|
||||
[
|
||||
'dest' => '\Controllers\BackendController:signinView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/signup' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:signupView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'.*?/api/download' => [
|
||||
[
|
||||
'dest' => '\Controllers\ApiController:downloadView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^.*?/login(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Controllers\ApiController:apiLogin',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
268
app/web/Models/Audit.php
Normal file
268
app/web/Models/Audit.php
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Models;
|
||||
|
||||
use phpOMS\Account\Account;
|
||||
|
||||
/**
|
||||
* Audit class.
|
||||
*
|
||||
* @package Modules\Auditor\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://karaka.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Audit
|
||||
{
|
||||
/**
|
||||
* Audit id.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Audit type.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $type;
|
||||
|
||||
/**
|
||||
* Audit trigger.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $trigger;
|
||||
|
||||
/**
|
||||
* Audit module.
|
||||
*
|
||||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $module;
|
||||
|
||||
/**
|
||||
* Audit reference.
|
||||
*
|
||||
* This could be used to reference other model ids
|
||||
*
|
||||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $ref;
|
||||
|
||||
/**
|
||||
* Audit content.
|
||||
*
|
||||
* Additional audit information
|
||||
*
|
||||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $content;
|
||||
|
||||
/**
|
||||
* Old value.
|
||||
*
|
||||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $old;
|
||||
|
||||
/**
|
||||
* New value.
|
||||
*
|
||||
* @var null|string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?string $new;
|
||||
|
||||
/**
|
||||
* Account.
|
||||
*
|
||||
* @var Account
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public Account $createdBy;
|
||||
|
||||
/**
|
||||
* Created at.
|
||||
*
|
||||
* @var \DateTimeImmutable
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
/**
|
||||
* Ip of creator.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private int $ip = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Account $account Account of the creator
|
||||
* @param null|string $old Old value
|
||||
* @param null|string $new New value
|
||||
* @param int $type Type of the audit
|
||||
* @param string $trigger Subtype of the audit
|
||||
* @param null|string $module Module id
|
||||
* @param null|string $ref Dynamic reference to model
|
||||
* @param null|string $content Additional audit information
|
||||
* @param int $ip Ip
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(
|
||||
Account $account = null,
|
||||
string $old = null,
|
||||
string $new = null,
|
||||
int $type = 0,
|
||||
string $trigger = '',
|
||||
string $module = null,
|
||||
string $ref = null,
|
||||
string $content = null,
|
||||
int $ip = 0
|
||||
) {
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->createdBy = $account ?? new NullAccount();
|
||||
$this->old = $old;
|
||||
$this->new = $new;
|
||||
$this->type = $type;
|
||||
$this->trigger = $trigger;
|
||||
$this->module = $module;
|
||||
$this->ref = $ref;
|
||||
$this->content = $content;
|
||||
$this->ip = $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getType() : int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subtype.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getTrigger() : string
|
||||
{
|
||||
return $this->trigger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Module.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getModule() : ?string
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reference.
|
||||
*
|
||||
* If existing this can be a reference to another model
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getRef() : ?string
|
||||
{
|
||||
return $this->ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getContent() : ?string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get old value.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getOld() : ?string
|
||||
{
|
||||
return $this->old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get new value.
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getNew() : ?string
|
||||
{
|
||||
return $this->new;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ip.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getIp() : int
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
}
|
||||
55
app/web/Models/AuditMapper.php
Normal file
55
app/web/Models/AuditMapper.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
final class AuditMapper extends DataMapperFactory
|
||||
{
|
||||
public const COLUMNS = [
|
||||
'auditor_audit_id' => ['name' => 'auditor_audit_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'auditor_audit_created_by' => ['name' => 'auditor_audit_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||
'auditor_audit_created_at' => ['name' => 'auditor_audit_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
'auditor_audit_ip' => ['name' => 'auditor_audit_ip', 'type' => 'int', 'internal' => 'ip', 'annotations' => ['gdpr' => true]],
|
||||
'auditor_audit_module' => ['name' => 'auditor_audit_module', 'type' => 'string', 'internal' => 'module'],
|
||||
'auditor_audit_ref' => ['name' => 'auditor_audit_ref', 'type' => 'string', 'internal' => 'ref'],
|
||||
'auditor_audit_type' => ['name' => 'auditor_audit_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'auditor_audit_trigger' => ['name' => 'auditor_audit_trigger', 'type' => 'string', 'internal' => 'trigger'],
|
||||
'auditor_audit_content' => ['name' => 'auditor_audit_content', 'type' => 'string', 'internal' => 'content'],
|
||||
'auditor_audit_old' => ['name' => 'auditor_audit_old', 'type' => 'compress', 'internal' => 'old'],
|
||||
'auditor_audit_new' => ['name' => 'auditor_audit_new', 'type' => 'compress', 'internal' => 'new'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const BELONGS_TO = [
|
||||
'createdBy' => [
|
||||
'mapper' => AccountMapper::class,
|
||||
'external' => 'auditor_audit_created_by',
|
||||
],
|
||||
];
|
||||
|
||||
public const MODEL = Audit::class;
|
||||
|
||||
public const TABLE = 'auditor_audit';
|
||||
|
||||
public const PRIMARYFIELD ='auditor_audit_id';
|
||||
|
||||
public const CREATED_AT = 'auditor_audit_created_at';
|
||||
}
|
||||
24
app/web/Models/NullAudit.php
Normal file
24
app/web/Models/NullAudit.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Auditor\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Models;
|
||||
|
||||
final class NullAudit extends Audit
|
||||
{
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
|
|
@ -28,29 +28,4 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^/*$' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:frontView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/features' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:featureView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/pricing' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:pricingView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'.*?/signup' => [
|
||||
[
|
||||
'dest' => '\Controllers\FrontController:signupView',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
14
app/web/Templates/header-element-table.tpl.php
Normal file
14
app/web/Templates/header-element-table.tpl.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<label class="checkbox" for="<?= $this->id; ?>-p-<?= $this->counter; ?>">
|
||||
<?php if ($data[6]) : ?>
|
||||
<input id="<?= $this->id; ?>-p-<?= $this->counter; ?>"
|
||||
class="oms-ui-state"
|
||||
type="checkbox"
|
||||
name="<?= $this->id; ?>-p-<?= $data[0]; ?>"
|
||||
form="<?= $this->id; ?>-search"
|
||||
value="1" checked>
|
||||
<span class="checkmark"></span>
|
||||
<?php endif; ?>
|
||||
<?= $data[1]; ?>
|
||||
</label>
|
||||
<?= $data[4] ? $this->renderSort(...$data) : ''; ?>
|
||||
<?= $data[5] ? $this->renderFilter(...$data) : ''; ?>
|
||||
54
app/web/Templates/popup-filter-table.tpl.php.php
Normal file
54
app/web/Templates/popup-filter-table.tpl.php.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php if ($data[5]) : ?>
|
||||
<span class="clickPopup">
|
||||
<input form="<?= $this->id; ?>-search" id="<?= $this->id; ?>-f-<?= $this->counter; ?>" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-t" type="hidden" value="<?= $data[2]; ?>">
|
||||
<input id="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup" name="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup" type="checkbox">
|
||||
<label for="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup"><i class="filter lni lni-funnel btn"></i></label>
|
||||
<div class="popup">
|
||||
<ul>
|
||||
<li><?= $this->getHtml('Filter', '0', '0'); ?>
|
||||
<?php if ($data[2] === 'text') : ?>
|
||||
<li>
|
||||
<input form="<?= $this->id; ?>-search" type="text" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f1">
|
||||
<?php elseif ($data[2] === 'select') : ?>
|
||||
<li>
|
||||
<select form="<?= $this->id; ?>-search" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f1" multiple>
|
||||
<?php foreach ($data[3] as $value => $option) : ?>
|
||||
<option value="<?= $value; ?>"><?= $option; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php elseif ($data[2] === 'number' || $data[2] === 'date'): ?>
|
||||
<li>
|
||||
<select form="<?= $this->id; ?>-search" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-o1">
|
||||
<option value="=">=
|
||||
<option value=">">>
|
||||
<option value=">=">>=
|
||||
<option value="<="><=
|
||||
<option value="<"><
|
||||
</select>
|
||||
<?php if ($data[2] === 'number') : ?>
|
||||
<input form="<?= $this->id; ?>-search" type="text" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f1">
|
||||
<?php else : ?>
|
||||
<input form="<?= $this->id; ?>-search" type="date" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f1">
|
||||
<?php endif; ?>
|
||||
<li><?= $this->getHtml('AND'); ?>
|
||||
<li>
|
||||
<select form="<?= $this->id; ?>-search" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-o2">
|
||||
<option value="=">=
|
||||
<option value=">">>
|
||||
<option value=">=">>=
|
||||
<option value="<="><=
|
||||
<option value="<"><
|
||||
</select>
|
||||
<?php if ($data[2] === 'number') : ?>
|
||||
<input form="<?= $this->id; ?>-search" type="text" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f2">
|
||||
<?php else : ?>
|
||||
<input form="<?= $this->id; ?>-search" type="date" name="<?= $this->id; ?>-f-<?= $data[0]; ?>-f2">
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<li><label class="button close" for="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
|
||||
<li><label class="button save" for="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup"><?= $this->getHtml('Filter', '0', '0'); ?></label>
|
||||
<li><label class="button cancel" for="<?= $this->id; ?>-f-<?= $this->counter; ?>-popup"><?= $this->getHtml('Reset', '0', '0'); ?></label>
|
||||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
29
app/web/Templates/sort-table.tpl.php
Normal file
29
app/web/Templates/sort-table.tpl.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
?>
|
||||
<label for="<?= $this->id; ?>-sort-<?= $this->counter; ?>-up">
|
||||
<input
|
||||
id="<?= $this->id; ?>-sort-<?= $this->counter; ?>-up"
|
||||
type="radio"
|
||||
name="<?= $this->id; ?>-sort"
|
||||
<?= $this->id === $this->request->getData('element')
|
||||
&& $this->request->getData('sort_order') === 'ASC'
|
||||
&& $data[1] === ($this->request->getData('sort_by') ?? '')
|
||||
? ' checked' : '';
|
||||
?>>
|
||||
<i class="sort-asc lni lni-chevron-up"></i>
|
||||
</label>
|
||||
|
||||
<label for="<?= $this->id; ?>-sort-<?= $this->counter; ?>-down">
|
||||
<input
|
||||
id="<?= $this->id; ?>-sort-<?= $this->counter; ?>-down"
|
||||
type="radio"
|
||||
name="<?= $this->id; ?>-sort"
|
||||
<?= $this->id === $this->request->getData('element')
|
||||
&& $this->request->getData('sort_order') === 'DESC'
|
||||
&& $data[1] === ($this->request->getData('sort_by') ?? '')
|
||||
? ' checked' : '';
|
||||
?>>
|
||||
<i class="sort-desc lni lni-chevron-down"></i>
|
||||
</label>
|
||||
39
app/web/Templates/table-title.tpl.php
Normal file
39
app/web/Templates/table-title.tpl.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$previous = $this->getPreviousLink(
|
||||
$this->request,
|
||||
empty($this->objects) || !$this->getData('hasPrevious') ? null : \reset($this->objects)
|
||||
);
|
||||
|
||||
$next = $this->getNextLink(
|
||||
$this->request,
|
||||
empty($this->objects) ? null : \end($this->objects),
|
||||
$this->getData('hasNext') ?? false
|
||||
);
|
||||
|
||||
$search = $this->getSearchLink(
|
||||
$this->id . '-searchbox'
|
||||
);
|
||||
?>
|
||||
<span>
|
||||
<?php if ($this->getData('hasPrevious') ?? false) : ?>
|
||||
<a rel="prefetch" href="<?= UriFactory::build($previous); ?>"><i class="fa lni lni-chevron-left btn"></i></a>
|
||||
<?php endif; ?>
|
||||
<?= $data[0]; ?>
|
||||
<?php if ($this->getData('hasNext') ?? false) : ?>
|
||||
<a rel="prefetch" href="<?= UriFactory::build($next); ?>"><i class="fa lni lni-chevron-right btn"></i></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($data[1]) : ?>
|
||||
<form class="inline" id="<?= $this->id; ?>-search" method="GET" action="<?= UriFactory::build($search); ?>&search={#<?= $this->id; ?>-searchbox}">
|
||||
<span role="search" class="inputWrapper">
|
||||
<span class="textWrapper">
|
||||
<input id="<?= $this->id; ?>-searchbox" name="search" type="text" autocomplete="off" value="<?= $this->request->getData('search') ?? ''; ?>" autofocus>
|
||||
<i class="endIcon lni lni-close" aria-hidden="true"></i>
|
||||
</span>
|
||||
<button type="submit"><i class="frontIcon lni lni-search-alt" aria-hidden="true"></i></button>
|
||||
</span>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
329
app/web/Views/TableView.php
Normal file
329
app/web/Views/TableView.php
Normal file
|
|
@ -0,0 +1,329 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package View
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://karaka.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Views;
|
||||
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Basic view which can be used as basis for specific implementations.
|
||||
*
|
||||
* @package View
|
||||
* @license OMS License 1.0
|
||||
* @link https://karaka.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class TableView extends View
|
||||
{
|
||||
/**
|
||||
* Table id
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $id = '';
|
||||
|
||||
/**
|
||||
* Table title template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $titleTemplate = '';
|
||||
|
||||
/**
|
||||
* Table column header template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $columnHeaderElementTemplate = '';
|
||||
|
||||
/**
|
||||
* Table filter template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $filterTemplate = '';
|
||||
|
||||
/**
|
||||
* Table sort template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $sortTemplate = '';
|
||||
|
||||
/**
|
||||
* Table header counter template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $counter = 0;
|
||||
|
||||
/**
|
||||
* Table objects template
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected array $objects = [];
|
||||
|
||||
/**
|
||||
* Set objects for the table
|
||||
*
|
||||
* @param array $objects Objects to be rendered in the table
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setObjects(array $objects) : void
|
||||
{
|
||||
$this->objects = $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title template
|
||||
*
|
||||
* @param string $template Path to template
|
||||
* @param string $extension Template extension
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setTitleTemplate(string $template, string $extension = 'tpl.php') : void
|
||||
{
|
||||
$this->titleTemplate = self::BASE_PATH . $template . '.' . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set column header template
|
||||
*
|
||||
* @param string $template Path to template
|
||||
* @param string $extension Template extension
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setColumnHeaderElementTemplate(string $template, string $extension = 'tpl.php') : void
|
||||
{
|
||||
$this->columnHeaderElementTemplate = self::BASE_PATH . $template . '.' . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set filter template
|
||||
*
|
||||
* @param string $template Path to template
|
||||
* @param string $extension Template extension
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setFilterTemplate(string $template, string $extension = 'tpl.php') : void
|
||||
{
|
||||
$this->filterTemplate = self::BASE_PATH . $template . '.' . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sort template
|
||||
*
|
||||
* @param string $template Path to template
|
||||
* @param string $extension Template extension
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setSortTemplate(string $template, string $extension = 'tpl.php') : void
|
||||
{
|
||||
$this->sortTemplate = self::BASE_PATH . $template . '.' . $extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define columns
|
||||
*
|
||||
* @param array $columns Column definitions
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setColumns(array $columns) : void
|
||||
{
|
||||
$this->columns = $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to previous table page
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param null|object $obj Object from table element
|
||||
* @param bool $hasPrevious Has previous page
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getPreviousLink(RequestAbstract $request, object $obj = null, bool $hasPrevious = false) : string
|
||||
{
|
||||
return $this->baseUri . (
|
||||
$obj === null
|
||||
? '?element={?element}&sort_by={?sort_by}&sort_order={?sort_order}'
|
||||
. (!empty($request->getData('search'))
|
||||
? '&search=' . $request->getData('search')
|
||||
: '')
|
||||
: '?{?}&id='
|
||||
. $obj->getId()
|
||||
. (!empty($request->getData('search'))
|
||||
? '&search=' . $request->getData('search')
|
||||
: '')
|
||||
. ($request->getData('sort_by') !== 'id' && \property_exists($obj, $request->getData('sort_by') ?? '')
|
||||
? '&subid=' . $obj->{$request->getData('sort_by')}
|
||||
: '')
|
||||
. '&ptype=p'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to next table page
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param null|object $obj Object from table element
|
||||
* @param bool $hasNext Has next page
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getNextLink(RequestAbstract $request, object $obj = null, $hasNext = false) : string
|
||||
{
|
||||
return $this->baseUri . (
|
||||
$obj === null
|
||||
? '?element={?element}&sort_by={?sort_by}&sort_order={?sort_order}'
|
||||
. (!empty($request->getData('search'))
|
||||
? '&search=' . $request->getData('search')
|
||||
: '')
|
||||
: '?{?}&id='
|
||||
. ($hasNext ? $obj->getId() : $request->getData('id'))
|
||||
. (!empty($request->getData('search'))
|
||||
? '&search=' . $request->getData('search')
|
||||
: '')
|
||||
. ($request->getData('sort_by') !== 'id' && \property_exists($obj, $request->getData('sort_by') ?? '')
|
||||
? '&subid=' . $obj->{$request->getData('sort_by')}
|
||||
: '')
|
||||
. '&ptype=n'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link for GET search
|
||||
*
|
||||
* @param string $id Element id
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getSearchLink(
|
||||
string $id
|
||||
) : string
|
||||
{
|
||||
return $this->baseUri . '?sort_by={?sort_by}&sort_order={?sort_order}';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render(mixed ...$data) : string
|
||||
{
|
||||
$this->id = $data[0];
|
||||
return parent::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render table title
|
||||
*
|
||||
* @param mixed ...$data Data to pass to renderer
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderTitle(mixed ...$data) : string
|
||||
{
|
||||
$data[0] ??= 'ERROR'; // string
|
||||
$data[1] ??= true; // render search
|
||||
|
||||
return $this->renderTemplate($this->titleTemplate, ...$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render table header
|
||||
*
|
||||
* @param mixed ...$data Data to pass to renderer
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderHeaderElement(mixed ...$data) : string
|
||||
{
|
||||
++$this->counter;
|
||||
|
||||
$data[0] ??= ''; // model name
|
||||
$data[1] ??= 'ERROR'; // string
|
||||
$data[2] ??= 'text'; // filter type, '' = don't render
|
||||
$data[3] ??= []; // filter options
|
||||
$data[4] ??= true; // render sort
|
||||
$data[5] ??= true; // render filter
|
||||
$data[6] ??= true; // render search
|
||||
|
||||
return $this->renderTemplate($this->columnHeaderElementTemplate, ...$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render table filter
|
||||
*
|
||||
* @param mixed ...$data Data to pass to renderer
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderFilter(mixed ...$data) : string
|
||||
{
|
||||
return $this->renderTemplate($this->filterTemplate, ...$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render table sort
|
||||
*
|
||||
* @param mixed ...$data Data to pass to renderer
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function renderSort(mixed ...$data) : string
|
||||
{
|
||||
return $this->renderTemplate($this->sortTemplate, ...$data);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,9 +24,9 @@ class WebApplication extends ApplicationAbstract
|
|||
|
||||
$this->logger = FileLogger::getInstance($config['log']['file']['path'], false);
|
||||
|
||||
UriFactory::setQuery('/prefix', '');
|
||||
UriFactory::setQuery('/backend', 'backend/');
|
||||
UriFactory::setQuery('/api', 'api/');
|
||||
UriFactory::setQuery('/prefix', '', true);
|
||||
UriFactory::setQuery('/backend', 'backend/', true);
|
||||
UriFactory::setQuery('/api', 'api/', true);
|
||||
$applicationName = $this->getApplicationName(HttpUri::fromCurrent(), $config['app'], $config['page']['root']);
|
||||
$request = $this->initRequest($config['page']['root'], $config['app']);
|
||||
$response = $this->initResponse($request, $config);
|
||||
|
|
@ -123,21 +123,26 @@ class WebApplication extends ApplicationAbstract
|
|||
}
|
||||
|
||||
$defaultLang = $config['app']['domains'][$request->uri->host]['lang'] ?? $config['app']['default']['lang'];
|
||||
$uriLang = \strtolower($request->uri->getPathElement(0));
|
||||
|
||||
$uriLang = \strtolower($request->uri->getPathElement(0));
|
||||
$uriLang = ISO639x1Enum::isValidValue($uriLang) && \in_array($uriLang, $config['language'])
|
||||
? $uriLang
|
||||
: \strtolower($request->uri->getPathElement(0, false));
|
||||
|
||||
$requestLang = $request->getLanguage();
|
||||
$langCode = ISO639x1Enum::isValidValue($requestLang) && \in_array($requestLang, $config['language'])
|
||||
? $requestLang
|
||||
: (ISO639x1Enum::isValidValue($uriLang) && \in_array($uriLang, $config['language'])
|
||||
? $uriLang
|
||||
$langCode = ISO639x1Enum::isValidValue($uriLang) && \in_array($uriLang, $config['language'])
|
||||
? $uriLang
|
||||
: (ISO639x1Enum::isValidValue($requestLang) && \in_array($requestLang, $config['language'])
|
||||
? $requestLang
|
||||
: $defaultLang
|
||||
);
|
||||
|
||||
$response->header->l11n->loadFromLanguage($langCode, \explode('_', $request->getLocale())[1] ?? '*');
|
||||
UriFactory::setQuery('/lang', $request->getLanguage());
|
||||
UriFactory::setQuery('/lang', $request->getLanguage(), true);
|
||||
|
||||
if (ISO639x1Enum::isValidValue($uriLang)) {
|
||||
UriFactory::setQuery('/prefix', $uriLang . '/' . (empty(UriFactory::getQuery('/prefix')) ? '' : UriFactory::getQuery('/prefix')));
|
||||
UriFactory::setQuery('/api', $uriLang . '/' . (empty(UriFactory::getQuery('/api')) ? '' : UriFactory::getQuery('/api')));
|
||||
UriFactory::setQuery('/prefix', $uriLang . '/' . (empty(UriFactory::getQuery('/prefix')) ? '' : UriFactory::getQuery('/prefix')), true);
|
||||
UriFactory::setQuery('/api', $uriLang . '/' . (empty(UriFactory::getQuery('/api')) ? '' : UriFactory::getQuery('/api')), true);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
|
@ -164,7 +169,8 @@ class WebApplication extends ApplicationAbstract
|
|||
'/prefix',
|
||||
empty(UriFactory::getQuery('/prefix')
|
||||
? ''
|
||||
: UriFactory::getQuery('/prefix') . '/') . $uri->getPathElement($subDirDepth + 1) . '/'
|
||||
: UriFactory::getQuery('/prefix') . '/') . $uri->getPathElement($subDirDepth + 1) . '/',
|
||||
true
|
||||
);
|
||||
|
||||
return $appName;
|
||||
|
|
@ -180,7 +186,8 @@ class WebApplication extends ApplicationAbstract
|
|||
'/prefix',
|
||||
empty(UriFactory::getQuery('/prefix')
|
||||
? ''
|
||||
: UriFactory::getQuery('/prefix') . '/') . $uri->getPathElement($subDirDepth + 1) . '/'
|
||||
: UriFactory::getQuery('/prefix') . '/') . $uri->getPathElement($subDirDepth + 1) . '/',
|
||||
true
|
||||
);
|
||||
|
||||
return $appName;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user