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