Files
deskhub/DeskHub-Webseite/staff/mentions.php
T
2026-10-16 19:12:21 +00:00

58 lines
1.7 KiB
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
$staff = require_staff_login();
$pdo = get_db();
// Alle als gelesen markieren bei Aufruf
$pdo->prepare('UPDATE staff_mentions SET is_read=1 WHERE mentioned_staff_id=?')->execute([$staff['id']]);
$stmt = $pdo->prepare(
"SELECT sm.*, t.ticket_number, t.subject, s.name AS by_name, sm.created_at
FROM staff_mentions sm
JOIN tickets t ON t.id = sm.ticket_id
JOIN staff s ON s.id = sm.mentioned_by_staff_id
WHERE sm.mentioned_staff_id = ?
ORDER BY sm.created_at DESC
LIMIT 100"
);
$stmt->execute([$staff['id']]);
$mentions = $stmt->fetchAll();
$pageTitle = 'Meine Erwähnungen';
$activePage = 'mentions';
require __DIR__ . '/_header.php';
?>
<div class="topbar">
<h1>🔔 Meine Erwähnungen</h1>
</div>
<div class="card">
<?php if (!$mentions): ?>
<div class="empty-state">Keine Erwähnungen vorhanden.</div>
<?php else: ?>
<table>
<thead>
<tr>
<th>Ticket</th>
<th>Betreff</th>
<th>Erwähnt von</th>
<th>Datum</th>
</tr>
</thead>
<tbody>
<?php foreach ($mentions as $m): ?>
<tr>
<td><a href="/staff/ticket_view.php?n=<?= urlencode($m['ticket_number']) ?>" class="ticket-no">#<?= e($m['ticket_number']) ?></a></td>
<td><a href="/staff/ticket_view.php?n=<?= urlencode($m['ticket_number']) ?>"><?= e($m['subject']) ?></a></td>
<td><?= e($m['by_name']) ?></td>
<td class="muted"><?= format_dt($m['created_at']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<?php require __DIR__ . '/_footer.php'; ?>