58 lines
2.4 KiB
PHP
58 lines
2.4 KiB
PHP
<?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];
|
|
}
|
|
?>
|
|
<section class="album-details">
|
|
<div class="album-content">
|
|
<div class="album-image">
|
|
<?php
|
|
echo '<img src="data:image/jpeg;base64,' . base64_encode($albums->coverImage) . '" style="width: 300px; height: 300px;" />';
|
|
?>
|
|
<br>
|
|
<br>
|
|
<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="album-songs">
|
|
<?php
|
|
echo "<table>";
|
|
echo "<tr>";
|
|
echo "<th>Titre</th>";
|
|
echo "<th>Durée</th>";
|
|
echo "<th>Action</th>";
|
|
echo "</tr>";
|
|
foreach ($albums->songs as $index => $song) {
|
|
$artistName = $albums->artist->name;
|
|
$duration = isset($albums->tracks[$index]->duration) ? convertirSecondesEnMinutes($albums->tracks[$index]->duration) : '';
|
|
echo "<tr>";
|
|
echo "<td>{$song}</td>";
|
|
echo "<td>{$duration}</td>";
|
|
echo "<td>";
|
|
if ($this->session->userdata('logged_in')){
|
|
if($this->model_music->SongInPlaylist($albums->tracks[$index]->trackId)){
|
|
echo anchor("chansons/deleteSongtoPlaylist/{$albums->tracks[$index]->trackId}","<i class='fa fa-trash'></i>");
|
|
}
|
|
}
|
|
echo anchor("chansons/addSongtoPlaylist/{$albums->tracks[$index]->trackId}","<i class='fa fa-plus'></i>");
|
|
//echo "<a href='" . site_url('albums/select_playlist?track_id=' . $albums->tracks[$index]->trackId) . "' class='btn-plus'>+</a>";
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
}
|
|
echo "</table>";
|
|
|
|
function convertirSecondesEnMinutes($secondes) {
|
|
$minutes = floor($secondes / 60);
|
|
$secondesRestantes = $secondes % 60;
|
|
return sprintf('%02d:%02d', $minutes, $secondesRestantes);
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</section>
|