album(s) des artistes

This commit is contained in:
Wilfried BRIGITTE 2024-05-28 11:34:30 +02:00
parent 63937f0b53
commit c98f0758c8
6 changed files with 54 additions and 8 deletions

View File

@ -13,11 +13,5 @@ class Albums extends CI_Controller {
$this->load->view('albums_list',['albums'=>$albums]); $this->load->view('albums_list',['albums'=>$albums]);
$this->load->view('layout/footer'); $this->load->view('layout/footer');
} }
public function view($album_id){
$songs = $this->model_music->getSongOfAlbum($album_id);
$this->load->view('layout/header');
$this->load->view('song_album_list',['songs'=>$songs]);
$this->load->view('layout/footer');
}
} }

View File

@ -13,5 +13,11 @@ class artistes extends CI_Controller {
$this->load->view('artistes_list',['artistes'=>$artistes]); $this->load->view('artistes_list',['artistes'=>$artistes]);
$this->load->view('layout/footer'); $this->load->view('layout/footer');
} }
public function view($AlbumsOfArtistId){
$AlbumsOfArtist = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId);
$this->load->view('layout/header');
$this->load->view('albums_artist_list',['AlbumsOfArtist'=>$AlbumsOfArtist]);
$this->load->view('layout/footer');
}
} }

View File

@ -0,0 +1,17 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Song extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->model('model_music');
}
public function view($album_id){
$songs = $this->model_music->getSongOfAlbum($album_id);
$this->load->view('layout/header');
$this->load->view('song_album_list',['songs'=>$songs]);
$this->load->view('layout/footer');
}
}

View File

@ -35,7 +35,21 @@ class Model_music extends CI_Model {
INNER JOIN track ON song.id = track.songId INNER JOIN track ON song.id = track.songId
WHERE track.albumId = ?", WHERE track.albumId = ?",
array($album_id) array($album_id)
); );
return $query->result(); return $query->result();
} }
public function getAlbumsOfArtist($artist_id){
$query = $this->db->query(
"SELECT album.name, album.id, album.year, genre.name as genreName, cover.jpeg
FROM album
JOIN artist ON album.artistId = artist.id
JOIN genre ON album.genreId = genre.id
JOIN cover ON album.coverId = cover.id
WHERE artist.id = ?",
array($artist_id)
);
return $query->result();
}
} }

View File

@ -0,0 +1,15 @@
<h5>Albums of the artist</h5>
<section class="list">
<?php
foreach($AlbumsOfArtist as $AlbumOfArtists){
echo "<div><article>";
echo "<header class='short-text'>";
echo anchor("albums/view/{$AlbumOfArtists->id}","{$AlbumOfArtists->name}");
echo "<br>";
echo "</header>";
echo "</article></div>";
}
?>
</section>

View File

@ -4,7 +4,7 @@
foreach($albums as $album){ foreach($albums as $album){
echo "<div><article>"; echo "<div><article>";
echo "<header class='short-text'>"; echo "<header class='short-text'>";
echo anchor("albums/view/{$album->id}","{$album->name}"); echo anchor("Song/view/{$album->id}","{$album->name}");
echo "</header>"; echo "</header>";
echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />'; echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />';
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer> echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>