ajout filtre et tri pour artiste
This commit is contained in:
@@ -63,6 +63,33 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_filtered_artistes($genre = [], $sort = null, $order = null) {
|
||||
$this->db->distinct();
|
||||
$this->db->select('artist.Id,artist.name, genre.name as genreName');
|
||||
$this->db->from('artist');
|
||||
$this->db->join('album', 'album.artistId = artist.Id');
|
||||
$this->db->join('genre', 'album.genreId = genre.Id');
|
||||
|
||||
if (!empty($genre)) {
|
||||
$this->db->where_in('genre.name', $genre);
|
||||
}
|
||||
if ($sort && in_array($sort, ['name'])) {
|
||||
$this->db->order_by($sort, $order);
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_all_genres_artistes() {
|
||||
$this->db->distinct();
|
||||
$this->db->select('genreId,genre.name as genreName');
|
||||
$this->db->from('artist');
|
||||
$this->db->join('album', 'album.artistId = artist.Id');
|
||||
$this->db->join('genre', 'album.genreId = genre.Id');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_filtered_chansons($genre = [], $artist = [], $year = [], $album = [], $sort = null, $order = null) {
|
||||
$this->db->select('track.id as trackId, song.name,song.id,album.year,album.name as albumName, artist.name as artistName, genre.name as genreName');
|
||||
$this->db->from('song');
|
||||
|
||||
Reference in New Issue
Block a user