rinkplanner/hub/views/admin_users.php
torsten 9819311403 feat: Website und Hub zweisprachig (Deutsch/Englisch)
Website (rinkplanner.programmschmiede.de) liegt jetzt im Repo unter web/:
Sprachweiche nach Accept-Language (der User-Agent enthält keine Sprache),
/de/ und /en/ als eigene URLs mit hreflang, Cookie für die manuelle Wahl,
Texte in web/i18n.php, Markup in web/template.php. Deployment über
tools/deploy_web.sh (--sync, --check, --all); /index.html leitet weiter.

Hub: optionale englische Oberfläche über den DE/EN-Umschalter, Cookie
RHUB_LANG, Route /language. Alle Texte (Views, Meldungen, Validierung,
API-messages) stehen in hub/app/i18n_strings.php und laufen über t();
Datum und Zahlen folgen der Sprache. Die API behält ihre code-Felder und
antwortet ohne Cookie weiter deutsch.

deploy_hub.sh --check prüft jetzt Schlüsselparität und fehlende t()-Schlüssel.
Doku: docs/website.md neu, docs/hub.md und AGENTS.md ergänzt.
2026-11-12 22:38:32 +01:00

92 lines
5.2 KiB
PHP

<?php /** @var array $users */ ?>
<?php $me = auth_user(); ?>
<div class="page-head">
<div>
<h1><?= e(t('admin.title')) ?></h1>
<p class="muted"><?= e(t('admin_users.lede')) ?></p>
</div>
</div>
<?php $active = 'users'; require HUB_ROOT . '/views/_admin_nav.php'; ?>
<section class="panel">
<h2><?= e(t('admin.tab_users')) ?></h2>
<div class="table-wrap">
<table class="list compact">
<thead>
<tr>
<th><?= e(t('admin.tab_users')) ?></th>
<th><?= e(t('table.role')) ?></th>
<th><?= e(t('table.status')) ?></th>
<th><?= e(t('table.routines')) ?></th>
<th><?= e(t('table.registered')) ?></th>
<th><?= e(t('table.last_login')) ?></th>
<th><?= e(t('table.actions')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td>
<strong><?= e($user['display_name']) ?></strong>
<span class="muted">@<?= e($user['username']) ?></span>
<?php if (!empty($user['email'])): ?>
<div class="muted small"><?= e($user['email']) ?></div>
<?php endif; ?>
</td>
<td><?= e($user['role'] === 'admin' ? t('admin_users.role_admin') : t('admin_users.role_user')) ?></td>
<td>
<span class="status status-<?= $user['status'] === 'active' ? 'open' : 'expired' ?>">
<?= e($user['status'] === 'active' ? t('status.active') : t('status.blocked')) ?>
</span>
</td>
<td><?= (int) $user['routine_count'] ?></td>
<td><?= e(fmt_dt($user['created_at'])) ?></td>
<td><?= e(fmt_dt($user['last_login_at'])) ?></td>
<td>
<?php if ((int) $user['id'] === (int) $me['id']): ?>
<span class="muted small"><?= e(t('admin_users.self')) ?></span>
<?php else: ?>
<div class="row-actions">
<?php if ($user['status'] === 'active'): ?>
<form class="inline" method="post" action="<?= e(url('/admin/users/action')) ?>">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
<input type="hidden" name="action" value="disable">
<button class="link-button danger" type="submit"><?= e(t('admin_users.block')) ?></button>
</form>
<?php else: ?>
<form class="inline" method="post" action="<?= e(url('/admin/users/action')) ?>">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
<input type="hidden" name="action" value="enable">
<button class="link-button" type="submit"><?= e(t('admin_users.unblock')) ?></button>
</form>
<?php endif; ?>
<form class="inline" method="post" action="<?= e(url('/admin/users/action')) ?>">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
<input type="hidden" name="action" value="reset">
<button class="link-button" type="submit"><?= e(t('admin_users.reset')) ?></button>
</form>
<details class="danger-zone">
<summary><?= e(t('admin_users.delete')) ?></summary>
<form method="post" action="<?= e(url('/admin/users/action')) ?>" class="stack-tight">
<?= csrf_field() ?>
<input type="hidden" name="user_id" value="<?= (int) $user['id'] ?>">
<input type="hidden" name="action" value="delete">
<label class="check small">
<input type="checkbox" name="confirm" value="1" required>
<?= e(t('admin_users.delete_confirm')) ?>
</label>
<button class="link-button danger" type="submit"><?= e(t('admin_users.delete_submit')) ?></button>
</form>
</details>
</div>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>