86 lines
3.4 KiB
PHP
86 lines
3.4 KiB
PHP
<section class="albums-details">
|
|
<div class="albums-content">
|
|
<div class="albums-image">
|
|
<?php
|
|
echo '<img src="data:image/jpeg;base64,' . base64_encode($albums->coverImage) . '" style="width: 300px; height: 300px;" />';
|
|
?>
|
|
<br>
|
|
<br>
|
|
<?php
|
|
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
|
$long_page = count($page)-1;
|
|
$url = $page[$long_page];
|
|
while ($page[$long_page] != 'albums'){
|
|
$long_page = $long_page - 1;
|
|
$url = $page[$long_page];
|
|
}
|
|
?>
|
|
<h4><?php echo $albums->name; ?></h4>
|
|
|
|
<h8> <?php echo " - Artiste : " . $albums->artist->name; ?></h8>
|
|
<p><?php echo " - Année : " . $albums->year; ?></p>
|
|
|
|
</div>
|
|
<div class="albums-songs">
|
|
<?php
|
|
// Afficher les noms des chansons sous forme de tableau
|
|
echo "<table>";
|
|
echo "<tr>";
|
|
echo "<th><h6>Titre</h6></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
|
|
echo "<th><h6>Durée</h6></th>";
|
|
|
|
echo "</tr>";
|
|
foreach ($albums->songs as $index => $songName) {
|
|
$artistName = $albums->artist->name;
|
|
$duration = isset($albums->tracks[$index]->duration) ? convertirSecondesEnMinutes($albums->tracks[$index]->duration) : '';
|
|
echo "<td>{$songName}</td>";
|
|
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
if ($this->session->userdata('logged_in')){
|
|
if($this->model_music->SongInPlaylist($albums->tracks[$index]->trackId)){
|
|
echo "<td>";
|
|
echo anchor("chansons/deleteSongtoPlaylist/{$albums->tracks[$index]->trackId}?page={$url}","<i class='fa fa-trash'></i>");
|
|
echo "</td>";
|
|
}
|
|
echo "<td>";
|
|
echo anchor("chansons/addSongtoPlaylist/{$albums->tracks[$index]->trackId}?page={$url}","<i class='fa fa-plus'></i>");
|
|
echo "</td>";
|
|
}
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
echo "<th></th>";
|
|
|
|
echo "<td>{$duration}</td>";
|
|
echo "</tr>";
|
|
}
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
|
|
|
function convertirSecondesEnMinutes($secondes) {
|
|
$minutes = floor($secondes / 60);
|
|
$secondesRestantes = $secondes % 60;
|
|
return sprintf('%02d:%02d', $minutes, $secondesRestantes);
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</section>
|