rpg-westreiche/westreiche_website/views/admin_users.php

76 lines
3.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/** @var array $users */
/** @var array|null $lastInvite */
?>
<div class="page-head">
<div>
<h1>Benutzer der Runde</h1>
<p class="lede">Konten entstehen nur durch Einladung. Ein Einladungslink ist sieben Tage gültig und einmal verwendbar.</p>
</div>
<a class="btn btn-primary" href="<?= e(url('/admin/users/new')) ?>">Konto anlegen</a>
</div>
<?php if (is_array($lastInvite)): ?>
<section class="panel">
<h2>Einladungslink</h2>
<?php if (!empty($lastInvite['sent'])): ?>
<p class="muted">Die Einladung ging per E-Mail an <strong><?= e((string) $lastInvite['to']) ?></strong> und gilt bis
<?= e((new DateTimeImmutable((string) $lastInvite['expires_at'], new DateTimeZone('UTC')))->setTimezone(new DateTimeZone('Europe/Berlin'))->format('d.m.Y H:i')) ?> Uhr.</p>
<?php else: ?>
<p class="muted">Diesen Link an die Person weitergeben – er ersetzt das Passwort und verfällt am
<?= e((new DateTimeImmutable((string) $lastInvite['expires_at'], new DateTimeZone('UTC')))->setTimezone(new DateTimeZone('Europe/Berlin'))->format('d.m.Y H:i')) ?> Uhr.</p>
<?php endif; ?>
<div class="copy-box"><span id="invite-url"><?= e((string) $lastInvite['url']) ?></span>
<button class="btn btn-small" type="button" data-copy="#invite-url">Kopieren</button>
</div>
</section>
<?php endif; ?>
<section class="panel">
<table class="data">
<thead>
<tr><th>Benutzer</th><th>E-Mail</th><th>Rolle</th><th class="num">Charaktere</th><th>Zuletzt</th><th></th></tr>
</thead>
<tbody>
<?php foreach ($users as $row): ?>
<tr>
<td>
<a href="<?= e(url('/admin/users/' . (int) $row['id'])) ?>"><?= e((string) $row['username']) ?></a>
<?php if ((string) $row['display_name'] !== '' && $row['display_name'] !== $row['username']): ?>
<span class="muted">· <?= e((string) $row['display_name']) ?></span>
<?php endif; ?>
<?php if ($row['status'] !== 'active'): ?>
<span class="badge badge-retired" style="font-size:.6rem">deaktiviert</span>
<?php endif; ?>
</td>
<td class="muted"><?= e((string) ($row['email'] ?? '–')) ?></td>
<td>
<?php if ($row['role'] === 'admin'): ?>
<span class="badge badge-admin">Spielleiter</span>
<?php else: ?>
<span class="muted">Spieler</span>
<?php endif; ?>
</td>
<td class="num"><?= (int) $row['character_count'] ?></td>
<td class="muted">
<?= $row['last_login_at'] !== null
? e((new DateTimeImmutable((string) $row['last_login_at'], new DateTimeZone('UTC')))->setTimezone(new DateTimeZone('Europe/Berlin'))->format('d.m.Y H:i'))
: '–' ?>
</td>
<td class="num">
<a class="btn btn-small" href="<?= e(url('/admin/users/' . (int) $row['id'])) ?>">bearbeiten</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
<section class="panel">
<h2>Kataloge</h2>
<p class="muted">
<a class="btn btn-small" href="<?= e(url('/admin/skills')) ?>">Fertigkeiten pflegen</a>
<a class="btn btn-small" href="<?= e(url('/admin/spells')) ?>">Zauber &amp; Liturgien ansehen</a>
<a class="btn btn-small" href="<?= e(url('/admin/equipment')) ?>">Waffen &amp; Rüstungen</a>
</p>
</section>