asdasd
This commit is contained in:
@@ -74,87 +74,85 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="section-box">
|
||||
<div class="module-admin-grid">
|
||||
<?php foreach ($modules as $module): ?>
|
||||
<?php if (empty($module['enabled'])) { continue; } ?>
|
||||
<?php
|
||||
$auth = is_array($module['auth'] ?? null) ? $module['auth'] : [];
|
||||
$authRequired = !empty($auth['required']);
|
||||
$authUsers = is_array($auth['users'] ?? null) ? array_filter($auth['users']) : [];
|
||||
$authGroups = is_array($auth['groups'] ?? null) ? array_filter($auth['groups']) : [];
|
||||
$hasSpecificAccess = $authRequired && ($authUsers !== [] || $authGroups !== []);
|
||||
if ($hasSpecificAccess) {
|
||||
$accessParts = [];
|
||||
if ($authGroups !== []) {
|
||||
$accessParts[] = 'Gruppen: ' . implode(', ', $authGroups);
|
||||
}
|
||||
if ($authUsers !== []) {
|
||||
$userLabels = array_map(
|
||||
static fn (string $user): string => $authUserLabels[$user] ?? $user,
|
||||
$authUsers
|
||||
);
|
||||
$accessParts[] = 'Nutzer: ' . implode(', ', $userLabels);
|
||||
}
|
||||
$accessLabel = implode(' · ', $accessParts);
|
||||
$accessClass = ' module-admin-badge--success';
|
||||
} elseif ($authRequired) {
|
||||
$accessLabel = 'Login erforderlich';
|
||||
$accessClass = ' module-admin-badge--warning';
|
||||
} else {
|
||||
$accessLabel = 'Offen ohne Modulschutz';
|
||||
$accessClass = ' module-admin-badge--danger';
|
||||
}
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$changedMigrations = $migrationStatus['changed'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e($module['title']) ?></h2>
|
||||
<p><?= e($module['description'] ?? '') ?></p>
|
||||
</div>
|
||||
<div class="module-admin-grid">
|
||||
<?php foreach ($modules as $module): ?>
|
||||
<?php if (empty($module['enabled'])) { continue; } ?>
|
||||
<?php
|
||||
$auth = is_array($module['auth'] ?? null) ? $module['auth'] : [];
|
||||
$authRequired = !empty($auth['required']);
|
||||
$authUsers = is_array($auth['users'] ?? null) ? array_filter($auth['users']) : [];
|
||||
$authGroups = is_array($auth['groups'] ?? null) ? array_filter($auth['groups']) : [];
|
||||
$hasSpecificAccess = $authRequired && ($authUsers !== [] || $authGroups !== []);
|
||||
if ($hasSpecificAccess) {
|
||||
$accessParts = [];
|
||||
if ($authGroups !== []) {
|
||||
$accessParts[] = 'Gruppen: ' . implode(', ', $authGroups);
|
||||
}
|
||||
if ($authUsers !== []) {
|
||||
$userLabels = array_map(
|
||||
static fn (string $user): string => $authUserLabels[$user] ?? $user,
|
||||
$authUsers
|
||||
);
|
||||
$accessParts[] = 'Nutzer: ' . implode(', ', $userLabels);
|
||||
}
|
||||
$accessLabel = implode(' · ', $accessParts);
|
||||
$accessClass = ' module-admin-badge--success';
|
||||
} elseif ($authRequired) {
|
||||
$accessLabel = 'Login erforderlich';
|
||||
$accessClass = ' module-admin-badge--warning';
|
||||
} else {
|
||||
$accessLabel = 'Offen ohne Modulschutz';
|
||||
$accessClass = ' module-admin-badge--danger';
|
||||
}
|
||||
$migrationStatus = modules()->migrationStatus($module['name']);
|
||||
$pendingMigrations = $migrationStatus['pending'] ?? [];
|
||||
$changedMigrations = $migrationStatus['changed'] ?? [];
|
||||
$migrationLabel = $pendingMigrations !== []
|
||||
? count($pendingMigrations) . ' ausstehend'
|
||||
: (($migrationStatus['available'] ?? 0) > 0 ? 'Schema aktuell' : 'Keine Migrationen');
|
||||
?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e($module['title']) ?></h2>
|
||||
<p><?= e($module['description'] ?? '') ?></p>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge module-admin-badge--success">Aktiv</strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Zugriff</span>
|
||||
<strong class="module-admin-badge<?= e($accessClass) ?>"><?= e($accessLabel) ?></strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Status</span>
|
||||
<strong class="module-admin-badge module-admin-badge--success">Aktiv</strong>
|
||||
</div>
|
||||
<?php if ($changedMigrations !== []): ?>
|
||||
<div class="module-admin-warning">
|
||||
Achtung: <?= e((string)count($changedMigrations)) ?> bereits angewendete Migration(en) wurden verändert.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
|
||||
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
|
||||
<a class="nav-link" href="/modules/access/<?= e($module['name']) ?>">Zugriff</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Zugriff</span>
|
||||
<strong class="module-admin-badge<?= e($accessClass) ?>"><?= e($accessLabel) ?></strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Migrationen</span>
|
||||
<strong class="module-admin-badge<?= $pendingMigrations !== [] ? ' module-admin-badge--accent' : (($migrationStatus['available'] ?? 0) > 0 ? ' module-admin-badge--success' : '') ?>"><?= e($migrationLabel) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($changedMigrations !== []): ?>
|
||||
<div class="module-admin-warning">
|
||||
Achtung: <?= e((string)count($changedMigrations)) ?> bereits angewendete Migration(en) wurden verändert.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="module-admin-actions">
|
||||
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
|
||||
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
|
||||
<a class="nav-link" href="/modules/access/<?= e($module['name']) ?>">Zugriff</a>
|
||||
<?php if ($pendingMigrations !== []): ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
|
||||
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div></div></div>
|
||||
|
||||
Reference in New Issue
Block a user