prepare for module/account audits

This commit is contained in:
Dennis Eichhorn 2019-06-07 23:12:57 +02:00
parent b0574d74af
commit 612a10232e
3 changed files with 20 additions and 16 deletions

View File

@ -14,9 +14,11 @@ declare(strict_types=1);
namespace Modules\Auditor\Controller;
use Modules\Admin\Models\AccountMapper;
use Modules\Auditor\Models\AuditMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\RelationType;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
@ -91,8 +93,8 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Auditor/Theme/Backend/module-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006201001, $request, $response));
$list = AuditMapper::getNewest(50);
$view->setData('audits', $list);
$list = $this->app->moduleManager->getAllModules();
$view->setData('modules', $list);
return $view;
}
@ -135,8 +137,7 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Auditor/Theme/Backend/account-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006201001, $request, $response));
$list = AuditMapper::getNewest(50);
$view->setData('audits', $list);
$view->setData('accounts', AccountMapper::getNewest(50, null, RelationType::NONE));
return $view;
}

View File

@ -13,6 +13,7 @@
/**
* @var \phpOMS\Views\View $this
*/
$accounts = $this->getData('accounts');
echo $this->getData('nav')->render(); ?>
@ -25,18 +26,18 @@ echo $this->getData('nav')->render(); ?>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Name') ?>
<td class="wf-100"><?= $this->getHtml('Date') ?>
<tfoot>
<tr>
<td colspan="3">
<td colspan="2">
<tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
<?php $count = 0; foreach ($accounts as $key => $account) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $account->getId()); ?>
<tr data-href="<?= $url; ?>">
<td>
<td><?= $this->printHtml($account->getId()); ?>
<td><?= $this->printHtml($account->getName1()); ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>

View File

@ -14,6 +14,8 @@
* @var \phpOMS\Views\View $this
*/
$modules = $this->getData('modules');
echo $this->getData('nav')->render(); ?>
<div class="row">
@ -25,18 +27,18 @@ echo $this->getData('nav')->render(); ?>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Name') ?>
<td class="wf-100"><?= $this->getHtml('Date') ?>
<tfoot>
<tr>
<td colspan="3">
<td colspan="2">
<tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $audit->getId()); ?>
<?php $count = 0; foreach ($modules as $key => $module) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/audit/single?{?}&id=' . $module['name']['id']); ?>
<tr data-href="<?= $url; ?>">
<td>
<td><?= $this->printHtml($module['name']['id']); ?>
<td><?= $this->printHtml($module['name']['external']); ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>