config dynamics videos

This commit is contained in:
2025-04-08 09:12:46 +04:00
parent 0e4a4dcdd8
commit 504b83a9af
5 changed files with 286 additions and 271 deletions
+66 -131
View File
@@ -9,6 +9,11 @@
<link rel="stylesheet" href="css/mastodon-timeline.min.css">
</head>
<body>
<?php
// Inclure la configuration
require_once 'includes/config.php';
?>
<!-- Sidebar de navigation -->
<div class="sidebar">
<a href="index.php" class="logo">
@@ -133,31 +138,14 @@
<div class="carousel">
<div class="carousel-container">
<?php
// Dans un vrai projet, ces données viendraient d'une API PeerTube
$shorts = [
[
'id' => 101,
'thumbnail' => 'img/video-thumbnails/short-1.jpg',
'title' => 'Interview avec Jean Dupont'
],
[
'id' => 102,
'thumbnail' => 'img/video-thumbnails/short-2.jpg',
'title' => 'Frédéric MAILLOT'
],
[
'id' => 103,
'thumbnail' => 'img/video-thumbnails/short-3.jpg',
'title' => 'Discussion sur l\'avenir'
],
[
'id' => 104,
'thumbnail' => 'img/video-thumbnails/short-4.jpg',
'title' => 'Panel sur les droits humains'
]
];
// Récupérer les shorts depuis l'API PeerTube
$shorts = getShorts();
foreach ($shorts as $video):
// Traiter le cas où aucun short n'est trouvé
if (empty($shorts)) {
echo '<div class="no-results">Aucun short disponible pour le moment</div>';
} else {
foreach ($shorts as $video):
?>
<div class="carousel-item">
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
@@ -169,15 +157,19 @@
</div>
</div>
</div>
<?php endforeach; ?>
<?php
endforeach;
}
?>
</div>
<?php if (!empty($shorts) && count($shorts) > 1): ?>
<div class="carousel-controls">
<div class="carousel-dot active"></div>
<div class="carousel-dot"></div>
<div class="carousel-dot"></div>
<div class="carousel-dot"></div>
<?php for ($i = 0; $i < count($shorts); $i++): ?>
<div class="carousel-dot <?php echo $i === 0 ? 'active' : ''; ?>"></div>
<?php endfor; ?>
</div>
<?php endif; ?>
</div>
</div>
@@ -192,35 +184,14 @@
<div class="video-grid">
<?php
// Dans un vrai projet, ces données viendraient d'une API PeerTube
$recentVideos = [
[
'id' => 1,
'title' => 'L\'indépendance de La Réunion : KA UBUNTU À BAKOU',
'thumbnail' => 'img/video-thumbnails/recent-1.jpg',
'tag' => '#Bakou',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 2,
'title' => '#1 Départementalisation de La Réunion (1946) : l\'heure du bilan ?',
'thumbnail' => 'img/video-thumbnails/recent-2.jpg',
'tag' => '#LaRéunion',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 3,
'title' => 'POURQUOI L\'INDÉPENDANCE DE LA REUNION ?',
'thumbnail' => 'img/video-thumbnails/recent-3.jpg',
'tag' => '#Indépendance',
'date' => '29 mars 2025',
'views' => 10
]
];
// Récupérer les vidéos récentes depuis l'API PeerTube
$recentVideos = getRecentVideos();
foreach ($recentVideos as $video):
// Traiter le cas où aucune vidéo n'est trouvée
if (empty($recentVideos)) {
echo '<div class="no-results">Aucune vidéo disponible pour le moment</div>';
} else {
foreach ($recentVideos as $video):
?>
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
<div class="video-thumbnail">
@@ -228,19 +199,21 @@
<div class="video-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<div class="video-duration"><?php echo formatDuration($video['duration']); ?></div>
</div>
<div class="video-info">
<h3 class="video-title"><?php echo $video['title']; ?></h3>
<div class="video-channel"><?php echo $video['channel']; ?></div>
<div class="video-metadata">
<span class="video-tag"><?php echo $video['tag']; ?></span>
<div>
<span class="video-date"><?php echo $video['date']; ?></span>
<span class="video-views"><?php echo $video['views']; ?> vues</span>
</div>
<span class="video-views"><?php echo formatViewCount($video['views']); ?> vues</span>
<span class="video-date"><?php echo formatDate($video['date']); ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
<?php
endforeach;
}
?>
</div>
<button class="view-more">Voir plus</button>
@@ -257,35 +230,14 @@
<div class="video-grid">
<?php
// Dans un vrai projet, ces données viendraient d'une API PeerTube
$trendingVideos = [
[
'id' => 4,
'title' => 'Serge Sinamalé i koz',
'thumbnail' => 'img/video-thumbnails/trending-1.jpg',
'tag' => '#Sinamalé',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 5,
'title' => '"Seule la lutte libère !" Thomas Sankara',
'thumbnail' => 'img/video-thumbnails/trending-2.jpg',
'tag' => '#LaRéunion',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 6,
'title' => 'La naissance d\'une nation',
'thumbnail' => 'img/video-thumbnails/trending-3.jpg',
'tag' => '#Indépendance',
'date' => '29 mars 2025',
'views' => 10
]
];
// Récupérer les vidéos tendances depuis l'API PeerTube
$trendingVideos = getTrendingVideos();
foreach ($trendingVideos as $video):
// Traiter le cas où aucune vidéo n'est trouvée
if (empty($trendingVideos)) {
echo '<div class="no-results">Aucune vidéo disponible pour le moment</div>';
} else {
foreach ($trendingVideos as $video):
?>
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
<div class="video-thumbnail">
@@ -293,19 +245,21 @@
<div class="video-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<div class="video-duration"><?php echo formatDuration($video['duration']); ?></div>
</div>
<div class="video-info">
<h3 class="video-title"><?php echo $video['title']; ?></h3>
<div class="video-channel"><?php echo $video['channel']; ?></div>
<div class="video-metadata">
<span class="video-tag"><?php echo $video['tag']; ?></span>
<div>
<span class="video-date"><?php echo $video['date']; ?></span>
<span class="video-views"><?php echo $video['views']; ?> vues</span>
</div>
<span class="video-views"><?php echo formatViewCount($video['views']); ?> vues</span>
<span class="video-date"><?php echo formatDate($video['date']); ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
<?php
endforeach;
}
?>
</div>
<button class="view-more">Voir plus</button>
@@ -322,35 +276,14 @@
<div class="video-grid">
<?php
// Dans un vrai projet, ces données viendraient d'une API PeerTube
$independenceVideos = [
[
'id' => 7,
'title' => 'L\'HÉRITAGE AFRICAIN DANS NOS LUTTES : PRÉSENTATION DU PANAFRICANISME',
'thumbnail' => 'img/video-thumbnails/independence-1.jpg',
'tag' => '#Afrique',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 8,
'title' => 'Maloya : Musique de résistance',
'thumbnail' => 'img/video-thumbnails/independence-2.jpg',
'tag' => '#Maloya',
'date' => '29 mars 2025',
'views' => 10
],
[
'id' => 9,
'title' => 'La lutte indépendantiste à la Réunion',
'thumbnail' => 'img/video-thumbnails/independence-3.jpg',
'tag' => '#Conférence',
'date' => '29 mars 2025',
'views' => 10
]
];
// Récupérer les vidéos sur l'indépendance depuis l'API PeerTube
$independenceVideos = getIndependenceVideos();
foreach ($independenceVideos as $video):
// Traiter le cas où aucune vidéo n'est trouvée
if (empty($independenceVideos)) {
echo '<div class="no-results">Aucune vidéo disponible pour le moment</div>';
} else {
foreach ($independenceVideos as $video):
?>
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
<div class="video-thumbnail">
@@ -358,19 +291,21 @@
<div class="video-play-icon">
<i class="fas fa-play-circle"></i>
</div>
<div class="video-duration"><?php echo formatDuration($video['duration']); ?></div>
</div>
<div class="video-info">
<h3 class="video-title"><?php echo $video['title']; ?></h3>
<div class="video-channel"><?php echo $video['channel']; ?></div>
<div class="video-metadata">
<span class="video-tag"><?php echo $video['tag']; ?></span>
<div>
<span class="video-date"><?php echo $video['date']; ?></span>
<span class="video-views"><?php echo $video['views']; ?> vues</span>
</div>
<span class="video-views"><?php echo formatViewCount($video['views']); ?> vues</span>
<span class="video-date"><?php echo formatDate($video['date']); ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
<?php
endforeach;
}
?>
</div>
<button class="view-more">Voir plus</button>