ajout temps
This commit is contained in:
parent
ffd3f5dd39
commit
906c5abf52
@ -42,6 +42,7 @@ class Albums extends CI_Controller {
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list', ['songs' => $songs, 'playlists' => $playlists]);
|
||||
$this->load->view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
public function addAllSongsToPlaylist(){
|
||||
|
@ -10,9 +10,10 @@ class Song extends CI_Controller {
|
||||
|
||||
public function view($album_id){
|
||||
$songs = $this->model_music->getSongOfAlbum($album_id);
|
||||
$duration = $this->model_music->getDurationSong($songs);
|
||||
$playlists = $this->model_music->getPlaylist();
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list', ['songs' => $songs, 'playlists' => $playlists]);
|
||||
$this->load->view('song_album_list', ['songs' => $songs, 'playlists' => $playlists, 'duration' => $duration]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
||||
|
@ -92,9 +92,11 @@ class Model_music extends CI_Model {
|
||||
|
||||
public function getSongOfAlbum($album_id){
|
||||
$query = $this->db->query(
|
||||
"SELECT song.id, song.name
|
||||
"SELECT song.id, song.name, track.duration
|
||||
FROM song
|
||||
INNER JOIN track ON song.id = track.songId
|
||||
|
||||
|
||||
WHERE track.albumId = ?",
|
||||
array($album_id)
|
||||
);
|
||||
@ -237,4 +239,5 @@ class Model_music extends CI_Model {
|
||||
WHERE id = ?",
|
||||
array($new_playlist_id, $playlist_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,15 @@
|
||||
<section class="list">
|
||||
<?php
|
||||
$i = 0;
|
||||
echo '<img src="data:image/jpeg;base64,' . base64_encode($album->jpeg) . '" alt="' . $album->name . '" />';
|
||||
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>";
|
||||
foreach($songs as $song){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo "{$song->name} ";
|
||||
|
||||
$i = $i+1;
|
||||
$minutes = floor($song->duration/60);
|
||||
$secondes = $song->duration %60;
|
||||
echo "{$i} - {$song->name} : {$minutes} min {$secondes} sec";
|
||||
if ($this->session->userdata('logged')):
|
||||
echo "<form action='" . base_url("index.php/playlist/addSongToPlaylist") . "' method='post'>";
|
||||
echo "<select name='playlist'>";
|
||||
|
Loading…
Reference in New Issue
Block a user