Files
kaubuntu.re/includes/sidebar.php
T

82 lines
3.7 KiB
PHP
Raw Normal View History

<!-- Sidebar de navigation -->
<div class="sidebar">
2025-07-20 16:29:16 +04:00
<a href="/" class="logo">
2025-04-11 06:27:03 +04:00
<img src="img/logo.png" alt="kaubuntu.re">
</a>
2025-07-20 16:29:16 +04:00
2025-04-11 07:22:18 +04:00
<?php
// Détecter la page courante et ses paramètres
$currentPage = basename($_SERVER['PHP_SELF']);
$currentCategoryId = isset($_GET['id']) ? intval($_GET['id']) : null;
$currentQuery = isset($_GET['q']) ? trim($_GET['q']) : '';
$isTagSearch = !empty($currentQuery) && substr($currentQuery, 0, 1) === '#';
$currentTag = $isTagSearch ? substr($currentQuery, 1) : '';
?>
2025-07-20 16:29:16 +04:00
<nav class="sidebar-nav">
2025-07-20 16:29:16 +04:00
<a href="/" class="nav-item <?php echo ($currentPage === 'index.php') ? 'active' : ''; ?>" data-title="Accueil">
<i class="fas fa-home"></i> <span>Accueil</span>
</a>
2025-04-11 07:22:18 +04:00
<a href="direct.php" class="nav-item <?php echo ($currentPage === 'direct.php') ? 'active' : ''; ?>" data-title="Direct">
<i class="fas fa-broadcast-tower"></i> <span>Direct</span>
</a>
2025-07-20 16:29:16 +04:00
<div class="nav-divider"></div>
2025-04-10 09:43:10 +04:00
2025-04-10 09:34:44 +04:00
<?php
// Afficher les catégories prioritaires
if (defined('PRIORITY_CATEGORIES') && !empty(PRIORITY_CATEGORIES)) {
// Tableau associatif des icônes pour les catégories
$categoryIcons = [
2025-04-11 06:47:45 +04:00
1 => 'fas fa-music', // Musique
2025-04-10 09:34:44 +04:00
2 => 'fas fa-film', // Films
2025-04-11 06:47:45 +04:00
3 => 'fas fa-car', // Véhicules
4 => 'fas fa-palette', // Jeux
5 => 'fas fa-running', // Sport
2025-04-10 09:34:44 +04:00
6 => 'fas fa-laugh', // Humour
2025-04-11 06:47:45 +04:00
7 => 'fas fa-gamepad', // Art
8 => 'fas fa-person', // Personnalités
9 => 'fas fa-face-grin-tears', // Comédie
10 => 'fas fa-tv', // Divertissement
11 => 'fas fa-globe', // Actualité & Politique
12 => 'fas fa-chalkboard-user', // Tutoriel
2025-04-10 09:34:44 +04:00
13 => 'fas fa-graduation-cap', // Education
2025-04-11 06:47:45 +04:00
14 => 'fas fa-fist-raised', // Activisme
15 => 'fas fa-microscope', // Science & Technologie
16 => 'fas fa-paw', // Animaux
17 => 'fas fa-child', // Enfants
18 => 'fas fa-utensils' // Cuisine
2025-04-10 09:34:44 +04:00
];
2025-07-20 16:29:16 +04:00
2025-04-10 09:34:44 +04:00
foreach (PRIORITY_CATEGORIES as $id => $name) {
2025-04-11 07:22:18 +04:00
$isActive = ($currentPage === 'categories.php' && $currentCategoryId === $id);
2025-04-10 09:34:44 +04:00
$icon = isset($categoryIcons[$id]) ? $categoryIcons[$id] : 'fas fa-folder';
2025-04-11 07:22:18 +04:00
echo '<a href="categories.php?id=' . $id . '" class="nav-item ' . ($isActive ? 'active' : '') . '" data-title="' . htmlspecialchars($name) . '">';
2025-04-10 09:34:44 +04:00
echo '<i class="' . $icon . '"></i> <span>' . htmlspecialchars($name) . '</span>';
echo '</a>';
}
}
?>
2025-07-20 16:29:16 +04:00
<div class="nav-divider"></div>
2025-07-20 16:29:16 +04:00
<div class="category-title">
<i class="fas fa-hashtag"></i> <span>Hashtags</span>
</div>
2025-07-20 16:29:16 +04:00
<?php
2025-04-10 13:40:25 +04:00
if (defined('IMPORTANT_TAGS') && !empty(IMPORTANT_TAGS)):
foreach (IMPORTANT_TAGS as $tag):
2025-04-10 13:30:15 +04:00
$encodedTag = urlencode('#' . $tag);
2025-04-11 07:22:18 +04:00
$isActive = ($isTagSearch && strtolower($currentTag) === strtolower($tag));
2025-04-10 13:30:15 +04:00
?>
2025-04-11 07:22:18 +04:00
<a href="recherche.php?q=<?php echo $encodedTag; ?>" class="tag-item <?php echo $isActive ? 'active' : ''; ?>" data-title="<?php echo htmlspecialchars($tag); ?>">
2025-04-10 13:30:15 +04:00
<i class="fas fa-hashtag tag-icon"></i> <span><?php echo htmlspecialchars($tag); ?></span>
2025-04-10 09:43:10 +04:00
</a>
2025-07-20 16:29:16 +04:00
<?php
2025-04-10 13:30:15 +04:00
endforeach;
endif;
?>
</nav>
</div>