Upload via GUI (258 Dateien)
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
|
||||
if (get_setting('kb_enabled', '1') !== '1') {
|
||||
flash('error', 'Die Wissensdatenbank ist derzeit nicht verfügbar.');
|
||||
redirect('/home.php');
|
||||
}
|
||||
|
||||
$pdo = get_db();
|
||||
$q = trim($_GET['q'] ?? '');
|
||||
|
||||
if ($q !== '') {
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT a.*, c.name AS category_name FROM kb_articles a
|
||||
JOIN kb_categories c ON c.id = a.category_id
|
||||
WHERE a.is_published = 1 AND (a.title LIKE ? OR a.body LIKE ?)
|
||||
ORDER BY a.views DESC"
|
||||
);
|
||||
$like = '%' . $q . '%';
|
||||
$stmt->execute([$like, $like]);
|
||||
$articles = $stmt->fetchAll();
|
||||
$categories = [];
|
||||
} else {
|
||||
$categories = $pdo->query('SELECT * FROM kb_categories ORDER BY sort_order, name')->fetchAll();
|
||||
$artStmt = $pdo->prepare('SELECT * FROM kb_articles WHERE category_id = ? AND is_published = 1 ORDER BY title');
|
||||
$articles = null;
|
||||
}
|
||||
|
||||
$pageTitle = 'Wissensdatenbank';
|
||||
$activePage = 'kb';
|
||||
$showHeroBanner = true;
|
||||
$showHeroImage = true;
|
||||
$heroEyebrow = 'Wissensdatenbank';
|
||||
$heroTitle = 'Wonach suchen Sie?';
|
||||
$heroSubtitle = 'Antworten auf häufige Fragen – oft schneller als der Weg über ein Ticket.';
|
||||
$heroSearchPlaceholder = 'Suchbegriff eingeben …';
|
||||
$heroSearchValue = $q;
|
||||
require __DIR__ . '/includes/header_customer.php';
|
||||
?>
|
||||
|
||||
<?php if ($articles !== null): ?>
|
||||
<h3><?= count($articles) ?> Ergebnis(se) für „<?= e($q) ?>“</h3>
|
||||
<?php if (!$articles): ?>
|
||||
<div class="card empty-state">Keine Artikel gefunden. <a href="/ticket_new.php">Erstellen Sie ein Ticket</a>, falls Sie weitere Hilfe benötigen.</div>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($articles as $a): ?>
|
||||
<div class="card kb-result-card">
|
||||
<a href="/kb_article.php?slug=<?= urlencode($a['slug']) ?>"><h3 style="margin:0"><?= e($a['title']) ?></h3></a>
|
||||
<span class="muted"><?= e($a['category_name']) ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php $anyArticles = false; ?>
|
||||
<div class="kb-category-grid">
|
||||
<?php foreach ($categories as $i => $cat): ?>
|
||||
<?php
|
||||
$artStmt->execute([$cat['id']]);
|
||||
$arts = $artStmt->fetchAll();
|
||||
if (!$arts) continue;
|
||||
$anyArticles = true;
|
||||
?>
|
||||
<div class="card kb-category-card">
|
||||
<div class="kb-category-head">
|
||||
<div class="icon-badge"><svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="M8 9h8M8 13h5"/></svg></div>
|
||||
<div>
|
||||
<h3 style="margin:0"><?= e($cat['name']) ?></h3>
|
||||
<span class="muted" style="font-size:.78rem"><?= count($arts) ?> Artikel</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach ($arts as $a): ?>
|
||||
<a class="kb-article-link" href="/kb_article.php?slug=<?= urlencode($a['slug']) ?>">
|
||||
<span><?= e($a['title']) ?></span>
|
||||
<span class="arrow">→</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if (!$anyArticles): ?>
|
||||
<div class="card empty-state">Es wurden noch keine Artikel veröffentlicht. <a href="/ticket_new.php">Erstellen Sie ein Ticket</a>, falls Sie Hilfe benötigen.</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php require __DIR__ . '/includes/footer_customer.php'; ?>
|
||||
Reference in New Issue
Block a user