test filtre 3/?
This commit is contained in:
parent
4b5b72f2c0
commit
d9c01b0729
@ -1,11 +1,11 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Model_music extends CI_Model {
|
||||
public function __construct(){
|
||||
$this->load->database();
|
||||
}
|
||||
public function __construct(){
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function getAlbums($genre = '', $order = 'asc', $artist = '') {
|
||||
public function getAlbums($genre = '', $order = 'asc', $artist = '') {
|
||||
$this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg');
|
||||
$this->db->from('album');
|
||||
$this->db->join('artist', 'album.artistid = artist.id');
|
||||
@ -41,92 +41,57 @@ class Model_music extends CI_Model {
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
public function getArtists($genre = '', $order = '') {
|
||||
$this->db->select('artist.name as artistName, artist.id as artistId');
|
||||
$this->db->from('artist');
|
||||
$this->db->join('album', 'album.artistid = artist.id');
|
||||
$this->db->join('genre', 'genre.id = album.genreid');
|
||||
$this->db->join('cover', 'cover.id = album.coverid');
|
||||
public function getArtists($genre = '', $order = '') {
|
||||
$this->db->select('artist.name as artistName, artist.id as artistId');
|
||||
$this->db->from('artist');
|
||||
$this->db->join('album', 'album.artistid = artist.id');
|
||||
$this->db->join('genre', 'genre.id = album.genreid');
|
||||
$this->db->join('cover', 'cover.id = album.coverid');
|
||||
|
||||
$this->db->distinct("artist.name");
|
||||
$this->db->distinct("artist.name");
|
||||
|
||||
if(!empty($genre)){
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
if(!empty($genre)){
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('artist.name',$order );
|
||||
}
|
||||
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('artist.name',$order );
|
||||
}
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getMusics($genre = '', $order = '', $artist = '') {
|
||||
public function getMusics($genre = '', $order = '', $artist = '') {
|
||||
$this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg, song.name as trackName, track.id as trackId');
|
||||
$this->db->from('track');
|
||||
$this->db->join('album', 'track.albumId = album.id');
|
||||
$this->db->join('song', 'song.id = track.songId');
|
||||
$this->db->join('artist', 'album.artistid = artist.id');
|
||||
$this->db->join('genre', 'genre.id = album.genreid');
|
||||
$this->db->join('cover', 'cover.id = album.coverid');
|
||||
$this->db->limit(100);
|
||||
|
||||
$this->db->select('album.name, album.id, year, artist.name as artistName, genre.name as genreName, jpeg, song.name as trackName, track.id as trackId');
|
||||
$this->db->from('track');
|
||||
$this->db->join('album', 'track.albumId = album.id');
|
||||
$this->db->join('song', 'song.id = track.songId');
|
||||
$this->db->join('artist', 'album.artistid = artist.id');
|
||||
$this->db->join('genre', 'genre.id = album.genreid');
|
||||
$this->db->join('cover', 'cover.id = album.coverid');
|
||||
$this->db->limit(100);
|
||||
if(!empty($genre)){
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
if(!empty($artist)){
|
||||
$this->db->where('artist.name', $artist);
|
||||
}
|
||||
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('song.name',$order );
|
||||
}
|
||||
|
||||
if(!empty($genre)){
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
if(!empty($artist)){
|
||||
$this->db->where('artist.name', $artist);
|
||||
}
|
||||
|
||||
|
||||
if($order == 'asc' || $order == 'desc'){
|
||||
$this->db->order_by('song.name',$order );
|
||||
}
|
||||
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function research(){
|
||||
$query = $this->db->query(
|
||||
|
||||
);}
|
||||
|
||||
public function researchtype(){
|
||||
|
||||
$this->db->select('name');
|
||||
$this->db->from('genre');
|
||||
/*
|
||||
if(!empty($playlist_id)){
|
||||
$this->db->where('playlists.playlist_id', $playlist_id);
|
||||
}*/
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
public function nameArtist(){
|
||||
|
||||
$this->db->select('name');
|
||||
$this->db->from('artist');
|
||||
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
// Suppression de la deuxième méthode researchtype
|
||||
|
||||
public function research(){
|
||||
$query = $this->db->query();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user