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

View File

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

View File

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