The bot (Aion2_RaidPlaner, deployed 2026-09-25) has no slash commands any more. Raids,
premades, events, activity checks and reports are created and managed only here; in Discord
members sign up for raids, answer invitations and activity checks and report players.
- Raid signup works the same in Discord and here: the bot assigns the group (perform_signup),
the website only sends the wish (raid_signup(..., $wish)) and shows the reason when it did
not fit (locked, role full, raid full). raid_wish_is_sensible() and the role constants are
gone. Declining ("Abmelden") now keeps the player under "Abgemeldet" (raid_decline, new bot
endpoint .../decline) like in Discord; the raid card shows "Du hast dich abgemeldet" with
"Doch anmelden". Class input is checked against AION_CLASSES.
- The Discord message shows the raid lead and the Lumipunkte: raid_create_action/raid_edit_action
send lead_id/lead_name/points_text, raid_sync_extras() on raids.php pushes them for raids
where the bot is missing them (at most 3 per page view, follows changed raid IDs).
- bot_api.php?action=member: main class (profile choice) and whether the person has an
(active) account - the bot preselects the class and hints that Lumipunkte need an account.
- New page Verwaltung -> Discord-Bot (admin/bot.php, includes/discord_bot.php, permission
bot.manage, on update granted to groups with raids.manage; schema 53): raid, log and report
channel, post the premade overview (updates itself) and the report panel (the bot replaces
the previous one), resync all raid messages (reposted raids move their settings via
raid_rename_id). Audit area "Discord-Bot", sidebar entry with a new bot icon.
- Reports: after picking a player in the filter, delete all of their reports at once
(DELETE /api/reports/user/{id}), which also lifts the auto-mute.
- Calendar and raid logs no longer count declined players as signed up / on the bench.
- Texts that mentioned bot commands (events, activity check, config example, README) updated;
privacy policy mentions the main-class lookup and that declines stay visible. Patch notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
342 lines
23 KiB
PHP
342 lines
23 KiB
PHP
<?php
|
||
/**
|
||
* Aktivitaetschecks: im Discord einen Check mit "Ich bin da" / "Ich bin nicht da" posten,
|
||
* Rueckmeldungen verfolgen und den Check (vorzeitig) abschliessen. Den Check selbst verwaltet
|
||
* der Bot (cogs/activity.py) - diese Seite spricht mit ihm ueber includes/activity_api.php.
|
||
*/
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/activity_api.php';
|
||
require_once __DIR__ . '/includes/activity_points.php';
|
||
require_permission('activity.manage');
|
||
|
||
$detailId = (int) ($_GET['id'] ?? 0);
|
||
$apiError = null;
|
||
$checks = [];
|
||
$detail = null;
|
||
try {
|
||
if ($detailId > 0) {
|
||
$detail = activity_api_request('GET', '/' . $detailId)['check'] ?? null;
|
||
} else {
|
||
$checks = activity_api_request('GET', '', ['guild_id' => events_guild_id()])['checks'] ?? [];
|
||
}
|
||
} catch (Throwable $e) {
|
||
$apiError = $e->getMessage();
|
||
}
|
||
if ($detailId > 0 && !$detail && !$apiError) {
|
||
show_not_found();
|
||
}
|
||
// Lumipunkte fuer abgeschlossene Checks vergeben (der angezeigte sofort, sonst alle mit abgelaufener Frist)
|
||
if (!$apiError) {
|
||
foreach (activity_process_points($detail && $detail['status'] !== 'open' ? (int) $detail['check_id'] : null, $detail) as $pointsMessage) {
|
||
set_flash('success', $pointsMessage);
|
||
}
|
||
}
|
||
$detailPoints = $detail ? activity_points_get((int) $detail['check_id']) : null;
|
||
|
||
// Kanaele und Rollen fuer das Formular
|
||
$channels = [];
|
||
$roles = [];
|
||
$pickerError = null;
|
||
if ($detailId === 0) {
|
||
try {
|
||
$channels = guilds_api_request('/channels')['channels'] ?? [];
|
||
$roles = guilds_api_request('/roles')['roles'] ?? [];
|
||
} catch (Throwable $e) {
|
||
$pickerError = $e->getMessage();
|
||
}
|
||
}
|
||
|
||
/** Discord-IDs -> Website-Konten (Name + Profilbild), fuer die Listen in der Detailansicht. */
|
||
$usersByDiscord = [];
|
||
if ($detail) {
|
||
$ids = array_merge(array_column($detail['responses'] ?? [], 'user_id'), array_column($detail['pending'] ?? [], 'user_id'),
|
||
array_column($detail['result']['missing'] ?? [], 'user_id'));
|
||
$ids = array_values(array_unique(array_map('strval', $ids)));
|
||
if ($ids) {
|
||
$stmt = db()->prepare('SELECT id, username, display_name, avatar_filename, discord_id FROM users WHERE discord_id IN ('
|
||
. implode(',', array_fill(0, count($ids), '?')) . ')');
|
||
$stmt->execute($ids);
|
||
foreach ($stmt->fetchAll() as $row) {
|
||
$usersByDiscord[(string) $row['discord_id']] = $row;
|
||
}
|
||
}
|
||
}
|
||
$person = static function (string $discordId, string $fallbackName) use ($usersByDiscord): string {
|
||
$user = $usersByDiscord[$discordId] ?? null;
|
||
$name = $user ? ($user['display_name'] !== '' ? $user['display_name'] : $user['username']) : $fallbackName;
|
||
$avatar = avatar_html($user ?: ['id' => $discordId, 'display_name' => $fallbackName], 28);
|
||
return '<li class="activity-person">' . $avatar . ($user ? '<a href="/member.php?id=' . (int) $user['id'] . '">' . e($name) . '</a>' : '<span>' . e($name) . '</span>') . '</li>';
|
||
};
|
||
|
||
/** "noch 2 Tage 4 Std." bzw. "vor 3 Std." */
|
||
$relative = static function (int $timestamp): string {
|
||
$diff = $timestamp - time();
|
||
$abs = abs($diff);
|
||
$text = $abs >= 86400 ? floor($abs / 86400) . ' Tg. ' . floor(($abs % 86400) / 3600) . ' Std.'
|
||
: ($abs >= 3600 ? floor($abs / 3600) . ' Std. ' . floor(($abs % 3600) / 60) . ' Min.' : max(1, (int) floor($abs / 60)) . ' Min.');
|
||
return $diff >= 0 ? 'noch ' . $text : 'vor ' . $text;
|
||
};
|
||
|
||
$roleOptions = static function (string $selected = '', bool $withNone = false) use ($roles): string {
|
||
$html = $withNone ? '<option value="">– keine –</option>' : '<option value="">– Rolle wählen –</option>';
|
||
foreach ($roles as $role) {
|
||
$rid = (string) ($role['role_id'] ?? '');
|
||
$html .= '<option value="' . e($rid) . '"' . ($rid === $selected ? ' selected' : '') . '>@' . e((string) ($role['name'] ?? '')) . '</option>';
|
||
}
|
||
return $html;
|
||
};
|
||
|
||
$openChecks = array_values(array_filter($checks, static fn ($c) => ($c['status'] ?? '') === 'open'));
|
||
$pastChecks = array_values(array_filter($checks, static fn ($c) => ($c['status'] ?? '') !== 'open'));
|
||
|
||
$pageTitle = $detail ? 'Aktivitätscheck: ' . $detail['title'] : 'Aktivitätschecks';
|
||
$containerWide = true;
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<?php if ($apiError): ?>
|
||
<div class="panel"><div class="flash flash-error">Der Discord-Bot ist gerade nicht erreichbar: <?= e($apiError) ?></div></div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($detail): ?>
|
||
<?php
|
||
$c = $detail['counts'] ?? [];
|
||
$isOpen = $detail['status'] === 'open';
|
||
$isClosing = $detail['status'] === 'closing';
|
||
$present = array_values(array_filter($detail['responses'] ?? [], static fn ($r) => $r['status'] === 'present'));
|
||
$absent = array_values(array_filter($detail['responses'] ?? [], static fn ($r) => $r['status'] === 'absent'));
|
||
$missing = $isOpen ? ($detail['pending'] ?? []) : ($detail['result']['missing'] ?? []);
|
||
?>
|
||
<div class="panel activity-detail-head">
|
||
<a href="/activity.php" class="text-muted">‹ Alle Aktivitätschecks</a>
|
||
<div class="raid-header">
|
||
<h1>📋 <?= e($detail['title']) ?></h1>
|
||
<span class="badge <?= $isOpen ? 'badge-active' : '' ?>"><?= $isOpen ? 'Läuft' : ($isClosing ? 'Wird abgeschlossen …' : ($detail['status'] === 'cancelled' ? 'Abgebrochen' : 'Abgeschlossen')) ?></span>
|
||
</div>
|
||
<p class="text-muted">
|
||
#<?= e((string) ($detail['channel_name'] ?? $detail['channel_id'])) ?> · für @<?= e((string) ($detail['target_role_name'] ?? '?')) ?> ·
|
||
<?= $isOpen ? 'endet ' . e(date('d.m.Y H:i', (int) $detail['deadline'])) . ' Uhr (' . e($relative((int) $detail['deadline'])) . ')'
|
||
: ($isClosing ? 'wird gerade abgeschlossen' : 'beendet ' . e(date('d.m.Y H:i', (int) $detail['closed_at'])) . ' Uhr von ' . e((string) $detail['closed_by'])) ?>
|
||
<?php if (!empty($detail['jump_url'])): ?> · <a href="<?= e($detail['jump_url']) ?>" target="_blank" rel="noopener">Im Discord ansehen</a><?php endif; ?>
|
||
</p>
|
||
<?php if ($isClosing): ?>
|
||
<div class="flash flash-info activity-closing">⏳ Der Bot verschickt gerade die PNs und ändert Rollen - das kann bei vielen Leuten ein, zwei Minuten dauern. Die Seite aktualisiert sich von selbst.</div>
|
||
<script>setTimeout(function () { location.reload(); }, 5000);</script>
|
||
<?php endif; ?>
|
||
<?php if ($isOpen): ?>
|
||
<div class="activity-actions">
|
||
<form method="post" action="/activity_action.php" class="inline-form"
|
||
data-confirm="Alle ohne Rückmeldung (<?= (int) ($c['pending'] ?? 0) ?>) bekommen sofort die eingestellten Folgen." data-confirm-title="Check jetzt abschließen?" data-confirm-ok="Jetzt abschließen">
|
||
<?= csrf_field() ?><input type="hidden" name="action" value="close"><input type="hidden" name="id" value="<?= (int) $detail['check_id'] ?>">
|
||
<button type="submit" class="button-success">✓ Jetzt abschließen</button>
|
||
</form>
|
||
<form method="post" action="/activity_action.php" class="inline-form" data-confirm="Der Check endet ohne Folgen - niemand bekommt eine PN oder verliert eine Rolle." data-confirm-title="Check abbrechen?" data-confirm-ok="Ohne Folgen abbrechen">
|
||
<?= csrf_field() ?><input type="hidden" name="action" value="cancel"><input type="hidden" name="id" value="<?= (int) $detail['check_id'] ?>">
|
||
<button type="submit" class="button-secondary">Abbrechen (ohne Folgen)</button>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
<div class="activity-consequences">
|
||
<strong>Folgen ohne Rückmeldung<?= !empty($detail['apply_to_absent']) ? ' (auch bei „nicht da“)' : '' ?>:</strong>
|
||
<?php
|
||
$parts = [];
|
||
if (!empty($detail['dm_enabled'])) $parts[] = '✉️ PN';
|
||
if (!empty($detail['remove_role_id'])) $parts[] = '➖ @' . ($detail['remove_role_name'] ?? $detail['remove_role_id']) . ' entfernen';
|
||
if (!empty($detail['add_role_id'])) $parts[] = '➕ @' . ($detail['add_role_name'] ?? $detail['add_role_id']) . ' geben';
|
||
?>
|
||
<?= $parts ? e(implode(' · ', $parts)) : '<span class="text-muted">keine - nur Liste im Log-Kanal</span>' ?>
|
||
<?php if ($detailPoints): ?>
|
||
<br><strong>Belohnung:</strong> <?= contribution_coin(16) ?> <?= (int) $detailPoints['points_present'] ?> Lumipunkte für „Ich bin da“
|
||
<span class="text-muted">- <?= $detailPoints['processed_at'] ? e((string) $detailPoints['result']) : 'werden nach dem Abschluss vergeben' ?></span>
|
||
<?php endif; ?>
|
||
<?php if (!$isOpen && !empty($detail['result']) && $detail['status'] === 'closed'): ?>
|
||
<br><span class="text-muted">Ergebnis: <?= (int) ($detail['result']['dm_sent'] ?? 0) ?> PN verschickt<?= !empty($detail['result']['dm_failed']) ? ' (' . (int) $detail['result']['dm_failed'] . ' mit geschlossenen PNs)' : '' ?>,
|
||
<?= (int) ($detail['result']['roles_changed'] ?? 0) ?> Rollen geändert<?= !empty($detail['result']['role_errors']) ? ', ' . (int) $detail['result']['role_errors'] . ' Fehler (fehlen dem Bot Rechte?)' : '' ?></span>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="activity-columns">
|
||
<div class="panel activity-column activity-present">
|
||
<h2>✅ Da <span class="chip-count"><?= count($present) ?></span></h2>
|
||
<ul><?php foreach ($present as $r): ?><?= $person((string) $r['user_id'], (string) $r['user_name']) ?><?php endforeach; ?></ul>
|
||
<?php if (!$present): ?><p class="text-muted">Noch niemand.</p><?php endif; ?>
|
||
</div>
|
||
<div class="panel activity-column activity-absent">
|
||
<h2>❌ Nicht da <span class="chip-count"><?= count($absent) ?></span></h2>
|
||
<ul><?php foreach ($absent as $r): ?><?= $person((string) $r['user_id'], (string) $r['user_name']) ?><?php endforeach; ?></ul>
|
||
<?php if (!$absent): ?><p class="text-muted">Niemand.</p><?php endif; ?>
|
||
</div>
|
||
<div class="panel activity-column activity-missing">
|
||
<h2>⏳ <?= $isOpen ? 'Noch offen' : 'Ohne Rückmeldung' ?> <span class="chip-count"><?= count($missing) ?></span></h2>
|
||
<ul><?php foreach ($missing as $r): ?><?= $person((string) $r['user_id'], (string) ($r['user_name'] ?? $r['name'] ?? '?')) ?><?php endforeach; ?></ul>
|
||
<?php if (!$missing): ?><p class="text-muted"><?= $isClosing ? 'Wird gerade ermittelt …' : 'Alle haben sich gemeldet 🎉' ?></p><?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if (!$isOpen): ?>
|
||
<div class="panel">
|
||
<form method="post" action="/activity_action.php" data-confirm="Diesen Check samt Nachricht im Discord endgültig löschen?" data-confirm-title="Check löschen" data-confirm-danger data-confirm-ok="Löschen">
|
||
<?= csrf_field() ?><input type="hidden" name="action" value="delete"><input type="hidden" name="id" value="<?= (int) $detail['check_id'] ?>">
|
||
<button type="submit" class="button-danger button-small">Check löschen</button>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php elseif (!$apiError): ?>
|
||
<div class="panel">
|
||
<div class="raid-header">
|
||
<h1>📋 Aktivitätschecks</h1>
|
||
<?php if (!$pickerError): ?>
|
||
<button type="button" class="button-success" data-toggle-activity-form>+ Neuer Aktivitätscheck</button>
|
||
<?php endif; ?>
|
||
</div>
|
||
<p class="text-muted">
|
||
Der Bot postet eine Nachricht mit den Knöpfen „Ich bin da“ und „Ich bin nicht da“. Wer die Zielrolle hat, meldet sich
|
||
dort zurück. Zur Frist - oder vorher über „Jetzt abschließen“ - bekommen alle ohne Rückmeldung die eingestellten Folgen.
|
||
</p>
|
||
<?php if ($pickerError): ?>
|
||
<div class="flash flash-error">Kanäle/Rollen konnten nicht geladen werden: <?= e($pickerError) ?></div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if (!$pickerError): ?>
|
||
<div class="panel activity-create" id="activity-create" hidden>
|
||
<h2>Neuer Aktivitätscheck</h2>
|
||
<form method="post" action="/activity_action.php" class="activity-form" id="activity-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="create">
|
||
<div class="activity-form-grid">
|
||
<div class="activity-form-fields">
|
||
<fieldset>
|
||
<legend>Aussehen</legend>
|
||
<label>Titel<input type="text" name="title" maxlength="100" required value="Aktivitätscheck" data-preview="title"></label>
|
||
<label>Nachricht<textarea name="message" rows="5" maxlength="3500" required data-preview="message">Hey zusammen! 👋
|
||
Bitte meldet euch kurz zurück, ob ihr noch aktiv dabei seid. Einfach unten auf den passenden Knopf klicken.</textarea></label>
|
||
<div class="activity-color-row">
|
||
<span>Farbe</span>
|
||
<?php foreach (ACTIVITY_COLORS as $hex => $label): ?>
|
||
<label class="activity-swatch" title="<?= e($label) ?>" style="--swatch: <?= e($hex) ?>">
|
||
<input type="radio" name="color" value="<?= e($hex) ?>" <?= $hex === '#206694' ? 'checked' : '' ?> data-preview="color">
|
||
</label>
|
||
<?php endforeach; ?>
|
||
<input type="color" name="color_custom" value="#206694" title="Eigene Farbe" data-preview="color-custom">
|
||
</div>
|
||
<label><span>Bild <span class="text-muted">(optional, https-Link)</span></span><input type="url" name="image_url" maxlength="500" placeholder="https://…" data-preview="image"></label>
|
||
<div class="activity-row">
|
||
<label>Knopf „da“<input type="text" name="yes_label" maxlength="60" placeholder="Ich bin da" data-preview="yes"></label>
|
||
<label>Knopf „nicht da“<input type="text" name="no_label" maxlength="60" placeholder="Ich bin nicht da" data-preview="no"></label>
|
||
</div>
|
||
</fieldset>
|
||
<fieldset>
|
||
<legend>Wo und für wen</legend>
|
||
<label>Kanal
|
||
<select name="channel_id" required>
|
||
<option value="">– Kanal wählen –</option>
|
||
<?php foreach ($channels as $channel): ?>
|
||
<option value="<?= e((string) $channel['channel_id']) ?>" <?= empty($channel['can_post']) ? 'disabled' : '' ?>>
|
||
#<?= e((string) $channel['name']) ?><?= !empty($channel['category']) ? ' (' . e((string) $channel['category']) . ')' : '' ?><?= empty($channel['can_post']) ? ' – Bot darf hier nicht posten' : '' ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</label>
|
||
<label><span>Wer soll sich melden? <span class="text-muted">(Zielrolle)</span></span>
|
||
<select name="target_role_id" required data-preview="role"><?= $roleOptions() ?></select>
|
||
</label>
|
||
<label class="checkbox-label"><input type="checkbox" name="ping_role" value="1" checked data-preview="ping"> Zielrolle beim Posten pingen</label>
|
||
<div class="activity-row">
|
||
<label>Zeit zum Zurückmelden<input type="number" name="duration_value" min="1" max="60" value="3" required data-preview="duration"></label>
|
||
<label> <select name="duration_unit" data-preview="duration">
|
||
<option value="hours">Stunden</option>
|
||
<option value="days" selected>Tage</option>
|
||
</select></label>
|
||
</div>
|
||
</fieldset>
|
||
<fieldset>
|
||
<legend>Belohnung</legend>
|
||
<label><span>Lumipunkte für „Ich bin da“ <span class="text-muted">(0 = keine)</span></span>
|
||
<input type="number" name="points_present" min="0" max="<?= CONTRIBUTION_MAX_POINTS ?>" value="0">
|
||
</label>
|
||
<p class="field-hint">Werden nach dem Abschluss an alle mit „Ich bin da“ und Website-Konto vergeben - auch wenn der Bot den Check nach Ablauf der Frist schließt. Bei einem Abbruch gibt es keine Punkte.</p>
|
||
</fieldset>
|
||
<fieldset>
|
||
<legend>Was passiert ohne Rückmeldung?</legend>
|
||
<label class="checkbox-label"><input type="checkbox" name="dm_enabled" value="1" data-toggle-dm> Private Nachricht (PN) schicken</label>
|
||
<label class="activity-dm" hidden><span>Text der PN <span class="text-muted">- Platzhalter: {name}, {titel}, {server}</span></span>
|
||
<textarea name="dm_message" rows="3" maxlength="1800"><?= e(ACTIVITY_DEFAULT_DM) ?></textarea>
|
||
</label>
|
||
<div class="activity-row">
|
||
<label>Rolle entfernen<select name="remove_role_id"><?= $roleOptions('', true) ?></select></label>
|
||
<label><span>Rolle geben <span class="text-muted">(z.B. „Inaktiv“)</span></span><select name="add_role_id"><?= $roleOptions('', true) ?></select></label>
|
||
</div>
|
||
<label class="checkbox-label"><input type="checkbox" name="apply_to_absent" value="1"> Folgen auch für alle mit „Ich bin nicht da“</label>
|
||
<p class="field-hint">Die Liste aller ohne Rückmeldung landet immer im Log-Kanal. Rollen ändern kann der Bot nur bei Rollen unterhalb seiner eigenen.</p>
|
||
</fieldset>
|
||
</div>
|
||
|
||
<div class="activity-preview-wrap">
|
||
<span class="event-preview-label">Vorschau in Discord</span>
|
||
<div class="discord-preview">
|
||
<div class="discord-ping" data-out="ping">@<span data-out="role">Rolle</span></div>
|
||
<div class="discord-embed" data-out="embed">
|
||
<strong class="discord-embed-title">📋 <span data-out="title">Aktivitätscheck</span></strong>
|
||
<div class="discord-embed-text" data-out="message"></div>
|
||
<div class="discord-embed-field"><b>Rückmeldungen</b><span>✅ 0 da · ❌ 0 nicht da · ⏳ … offen</span></div>
|
||
<div class="discord-embed-field"><b>⏰ Rückmeldung bis</b><span data-out="deadline">…</span></div>
|
||
<img class="discord-embed-image" data-out="image" alt="" hidden>
|
||
<div class="discord-embed-footer">Aktivitätscheck #…</div>
|
||
</div>
|
||
<div class="discord-buttons">
|
||
<span class="discord-button discord-button-green">✅ <span data-out="yes">Ich bin da</span></span>
|
||
<span class="discord-button">❌ <span data-out="no">Ich bin nicht da</span></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="actions">
|
||
<button type="submit" class="button-success">📋 Check jetzt posten</button>
|
||
<button type="button" class="button-secondary" data-toggle-activity-form>Abbrechen</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="panel">
|
||
<h2>Laufende Checks <span class="chip-count"><?= count($openChecks) ?></span></h2>
|
||
<?php if (!$openChecks): ?><p class="text-muted">Gerade läuft kein Aktivitätscheck.</p><?php endif; ?>
|
||
<div class="activity-cards">
|
||
<?php foreach ($openChecks as $check): ?>
|
||
<?php
|
||
$c = $check['counts'] ?? [];
|
||
$total = max(1, (int) ($c['present'] ?? 0) + (int) ($c['absent'] ?? 0) + (int) ($c['pending'] ?? 0));
|
||
?>
|
||
<a class="activity-card" href="/activity.php?id=<?= (int) $check['check_id'] ?>" style="--accent: #<?= e(str_pad(dechex((int) $check['color']), 6, '0', STR_PAD_LEFT)) ?>">
|
||
<strong>📋 <?= e($check['title']) ?></strong>
|
||
<span class="text-muted">#<?= e((string) ($check['channel_name'] ?? '?')) ?> · @<?= e((string) ($check['target_role_name'] ?? '?')) ?> · <?= e($relative((int) $check['deadline'])) ?></span>
|
||
<div class="activity-bar" title="<?= (int) ($c['present'] ?? 0) ?> da, <?= (int) ($c['absent'] ?? 0) ?> nicht da, <?= (int) ($c['pending'] ?? 0) ?> offen">
|
||
<i class="bar-present" style="width: <?= round(100 * (int) ($c['present'] ?? 0) / $total, 1) ?>%"></i>
|
||
<i class="bar-absent" style="width: <?= round(100 * (int) ($c['absent'] ?? 0) / $total, 1) ?>%"></i>
|
||
</div>
|
||
<span class="activity-counts">✅ <?= (int) ($c['present'] ?? 0) ?> · ❌ <?= (int) ($c['absent'] ?? 0) ?> · ⏳ <?= (int) ($c['pending'] ?? 0) ?> offen</span>
|
||
</a>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($pastChecks): ?>
|
||
<div class="panel">
|
||
<h2>Beendet</h2>
|
||
<ul class="activity-past">
|
||
<?php foreach ($pastChecks as $check): ?>
|
||
<?php $c = $check['counts'] ?? []; ?>
|
||
<li>
|
||
<a href="/activity.php?id=<?= (int) $check['check_id'] ?>"><strong><?= e($check['title']) ?></strong></a>
|
||
<span class="text-muted"><?= e(date('d.m.Y', (int) ($check['closed_at'] ?: $check['deadline']))) ?> ·
|
||
<?= $check['status'] === 'cancelled' ? 'abgebrochen' : '✅ ' . (int) ($c['present'] ?? 0) . ' · ❌ ' . (int) ($c['absent'] ?? 0) . ' · ohne Rückmeldung: ' . count($check['result']['missing'] ?? []) ?></span>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
</div>
|
||
<?php endif; ?>
|
||
<script src="<?= e(asset_url('/assets/js/activity.js')) ?>"></script>
|
||
<?php endif; ?>
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|