creation aléatoire de playlist
This commit is contained in:
@@ -1,86 +1,57 @@
|
||||
<section class="albums-details">
|
||||
<div class="albums-content">
|
||||
<div class="albums-image">
|
||||
<?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>
|
||||
<?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>
|
||||
|
||||
<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">
|
||||
<div class="album-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>";
|
||||
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 "</table>";
|
||||
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);
|
||||
}
|
||||
function convertirSecondesEnMinutes($secondes) {
|
||||
$minutes = floor($secondes / 60);
|
||||
$secondesRestantes = $secondes % 60;
|
||||
return sprintf('%02d:%02d', $minutes, $secondesRestantes);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user