diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index 878adb8..d52ebf7 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -29,6 +29,7 @@ use phpOMS\DataStorage\Database\RelationType;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleInfo;
+use phpOMS\Utils\StringUtils;
use phpOMS\Views\View;
/**
@@ -249,6 +250,27 @@ final class BackendController extends Controller
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
$view->addData('editor', $editor);
+ // audit log
+ if ($request->getData('ptype') === 'p') {
+ $view->setData('auditlogs',
+ AuditMapper::withConditional('module', self::MODULE_NAME, [Audit::class])
+ ::withConditional('type', StringUtils::hash(GroupMapper::class), [Audit::class])
+ ::withConditional('ref', (string) $request->getData('id') ?? '0', [Audit::class])
+ ::getBeforePivot((int) $request->getData('audit'), null, 25));
+ } elseif ($request->getData('ptype') === 'n') {
+ $view->setData('auditlogs',
+ AuditMapper::withConditional('module', self::MODULE_NAME, [Audit::class])
+ ::withConditional('type', StringUtils::hash(GroupMapper::class), [Audit::class])
+ ::withConditional('ref', (string) $request->getData('id') ?? '0', [Audit::class])
+ ::getAfterPivot((int) $request->getData('audit'), null, 25));
+ } else {
+ $view->setData('auditlogs',
+ AuditMapper::withConditional('module', self::MODULE_NAME, [Audit::class])
+ ::withConditional('type', StringUtils::hash(GroupMapper::class), [Audit::class])
+ ::withConditional('ref', (string) $request->getData('id') ?? '0', [Audit::class])
+ ::getAfterPivot(0, null, 25));
+ }
+
return $view;
}
@@ -335,6 +357,15 @@ final class BackendController extends Controller
$groupPermission = GroupMapper::getPermissionForModule($id);
$view->setData('groupPermissions', $groupPermission);
+ // audit log
+ if ($request->getData('ptype') === 'p') {
+ $view->setData('auditlogs', AuditMapper::withConditional('module', (string) $request->getData('id'), [Audit::class])::getBeforePivot((int) $request->getData('audit'), null, 25));
+ } elseif ($request->getData('ptype') === 'n') {
+ $view->setData('auditlogs', AuditMapper::withConditional('module', (string) $request->getData('id'), [Audit::class])::getAfterPivot((int) $request->getData('audit'), null, 25));
+ } else {
+ $view->setData('auditlogs', AuditMapper::withConditional('module', (string) $request->getData('id'), [Audit::class])::getAfterPivot(0, null, 25));
+ }
+
return $view;
}
}
diff --git a/Theme/Backend/accounts-single.tpl.php b/Theme/Backend/accounts-single.tpl.php
index ea9e4c1..07e9fbb 100755
--- a/Theme/Backend/accounts-single.tpl.php
+++ b/Theme/Backend/accounts-single.tpl.php
@@ -39,7 +39,7 @@ use phpOMS\Uri\UriFactory;
*/
$account = $this->getData('account');
$permissions = $this->getData('permissions');
-$audits = $this->getData('auditlogs');
+$audits = $this->getData('auditlogs') ?? [];
$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/account/settings?id={?id}#{\#}' : '{/prefix}admin/account/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/account/settings?id={?id}#{\#}' : '{/prefix}admin/account/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
@@ -285,7 +285,7 @@ echo $this->getData('nav')->render(); ?>
-
+
@@ -306,7 +306,7 @@ echo $this->getData('nav')->render(); ?>
= $this->getHtml('Date', 'Auditor') ?>
|
$audit) : ++$count;
- $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
+ $url = UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
| = $audit->getId(); ?>
| = $this->printHtml($audit->getModule()); ?>
diff --git a/Theme/Backend/groups-single.tpl.php b/Theme/Backend/groups-single.tpl.php
index fede8e3..0f7d08b 100755
--- a/Theme/Backend/groups-single.tpl.php
+++ b/Theme/Backend/groups-single.tpl.php
@@ -16,6 +16,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Account\GroupStatus;
use phpOMS\Account\PermissionOwner;
use phpOMS\Uri\UriFactory;
+use phpOMS\Message\Http\HttpHeader;
/**
* @todo Orange-Management/Modules#122
@@ -49,6 +50,10 @@ use phpOMS\Uri\UriFactory;
$group = $this->getData('group');
$permissions = $this->getData('permissions');
$accounts = $group->getAccounts();
+$audits = $this->getData('auditlogs') ?? [];
+
+$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/group/settings?id={?id}#{\#}' : '{/prefix}admin/group/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
+$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/group/settings?id={?id}#{\#}' : '{/prefix}admin/group/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
echo $this->getData('nav')->render(); ?>
@@ -251,24 +256,52 @@ echo $this->getData('nav')->render(); ?>
- = $this->getHtml('AuditLog') ?>
-
+ = $this->getHtml('Audits', 'Auditor') ?>
+
+
+
+
+
+
+
+
+
+
+
+
-
- | = $this->getHtml('ID', '0', '0'); ?>
- | Name
+ |
+ | = $this->getHtml('ID', '0', '0'); ?>
+ | = $this->getHtml('Module', 'Auditor') ?>
+ | = $this->getHtml('Type', 'Auditor') ?>
+ | = $this->getHtml('Subtype', 'Auditor') ?>
+ | = $this->getHtml('Old', 'Auditor') ?>
+ | = $this->getHtml('New', 'Auditor') ?>
+ | = $this->getHtml('Content', 'Auditor') ?>
+ | = $this->getHtml('By', 'Auditor') ?>
+ | = $this->getHtml('Date', 'Auditor') ?>
|
- $value) : ++$c; ?>
-
- |
- |
- |
-
-
- | | = $this->getHtml('Empty', '0', '0'); ?>
-
+ $audit) : ++$count;
+ $url = UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
+ |
+ | = $audit->getId(); ?>
+ | = $this->printHtml($audit->getModule()); ?>
+ | = $audit->getType(); ?>
+ | = $audit->getSubtype(); ?>
+ | = $this->printHtml($audit->getOld()); ?>
+ | = $this->printHtml($audit->getNew()); ?>
+ | = $this->printHtml($audit->getContent()); ?>
+ | = $this->printHtml($audit->getCreatedBy()->getName()); ?>
+ | = $audit->getCreatedAt()->format('Y-m-d H:i'); ?>
+
+
+ | | = $this->getHtml('Empty', '0', '0'); ?>
+
|
-
+
diff --git a/Theme/Backend/modules-single.tpl.php b/Theme/Backend/modules-single.tpl.php
index 631365d..de9b83d 100755
--- a/Theme/Backend/modules-single.tpl.php
+++ b/Theme/Backend/modules-single.tpl.php
@@ -12,8 +12,9 @@
*/
declare(strict_types=1);
-
use Modules\Admin\Models\ModuleStatusUpdateType;
+use phpOMS\Message\Http\HttpHeader;
+use phpOMS\Uri\UriFactory;
/**
* @var \phpOMS\Views\View $this
@@ -22,107 +23,179 @@ $modules = $this->getData('modules');
$active = $this->getData('active');
$installed = $this->getData('installed');
$id = $this->getData('id');
+$audits = $this->getData('auditlogs') ?? [];
$nav = $this->getData('nav');
+$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/module/settings?id={?id}#{\#}' : '{/prefix}admin/module/settings?{?}&audit=' . \reset($audits)->getId() . '&ptype=p#{\#}';
+$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? '{/prefix}admin/module/settings?id={?id}#{\#}' : '{/prefix}admin/module/settings?{?}&audit=' . \end($audits)->getId() . '&ptype=n#{\#}';
+
if ($nav !== null) {
echo $this->getData('nav')->render();
}
?>
+
+
+
+
+
+
+
+
+ request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : '' ?>>
+
+
+
+
+ = $this->printHtml($modules[$id]['name']['external']); ?>
-
-
-
- = $this->printHtml($modules[$id]['name']['external']); ?>
-
-
-
-
-
- | = $this->getHtml('Name'); ?>
- | = $this->printHtml($modules[$id]['name']['external']); ?>
- |
- | = $this->getHtml('Version'); ?>
- | = $this->printHtml($modules[$id]['version']); ?>
- |
- | = $this->getHtml('CreatedBy'); ?>
- | = $this->printHtml($modules[$id]['creator']['name']); ?>
- |
- | = $this->getHtml('Website'); ?>
- | = $this->printHtml($modules[$id]['creator']['website']); ?>
- |
- | = $this->getHtml('Description'); ?>
- | = $this->printHtml($modules[$id]['description']); ?>
- |
-
- |