Test pages * 1/?

This commit is contained in:
Vincent
2024-06-04 23:26:09 +02:00
parent a59966d698
commit f0260ba791
6 changed files with 54 additions and 9 deletions

View File

@@ -128,13 +128,13 @@ class Model_music extends CI_Model {
$this->db->select('artist.name as artistName, artist.id, genre.name as genreName, artist.jpeg');
$this->db->from('artist');
$this->db->join('album', 'album.artistid = artist.id');
$this->db->join('genre', 'genre.id = album.genreid');
$this->db->join('genre', 'genre.id = album.genreid', 'left');
$this->db->where('artist.id', $artistId);
$artistQuery = $this->db->get();
$artistDetails = $artistQuery->row();
// Get artist's albums
$this->db->select('album.name as albumName, album.id as albumId, album.year');
$this->db->select('album.id as albumId, album.name as albumName, album.year');
$this->db->from('album');
$this->db->where('album.artistid', $artistId);
$albumsQuery = $this->db->get();
@@ -143,6 +143,20 @@ class Model_music extends CI_Model {
return array('artist' => $artistDetails, 'albums' => $albums);
}
public function getSongDetails($songId) {
// Get song details
$this->db->select('song.name as songName, track.id as trackId, album.name as albumName, album.year, artist.name as artistName, genre.name as genreName, cover.jpeg');
$this->db->from('track');
$this->db->join('song', 'track.songId = song.id');
$this->db->join('album', 'track.albumId = album.id');
$this->db->join('artist', 'album.artistid = artist.id');
$this->db->join('genre', 'album.genreid = genre.id');
$this->db->join('cover', 'album.coverid = cover.id');
$this->db->where('track.id', $songId);
$songQuery = $this->db->get();
return $songQuery->row();
}