2024-06-04 16:21:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< ? php  if  (  !  defined ( 'BASEPATH' ))  exit ( 'No direct script access allowed' ); 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 10:29:40 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								class  Model_music  extends  CI_Model  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:21:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  function  __construct (){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $this -> load -> database (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 10:29:40 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:39:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  function  getAlbums ( $genre  =  '' ,  $order  =  'asc' ,  $artist  =  '' ,  $query  =  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $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' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $this -> db -> join ( 'genre' ,  'genre.id = album.genreid' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $this -> db -> join ( 'cover' ,  'cover.id = album.coverid' ); 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( ! empty ( $genre )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $this -> db -> where ( 'genre.name' ,  $genre ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( ! empty ( $artist )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $this -> db -> where ( 'artist.name' ,  $artist ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( $order  ==  'asc'  ||  $order  ==  'desc' ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $this -> db -> order_by ( 'album.name' ,  $order ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 21:29:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if ( ! empty ( $query )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $this -> db -> like ( 'album.name' ,  $query ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $query  =  $this -> db -> get (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  $query -> result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:18:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    public  function  researchtype (){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $this -> db -> select ( 'name' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $this -> db -> from ( 'genre' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $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 (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:21:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    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 " ); 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-03 16:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-04 16:21:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        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 (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    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 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        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 (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // Suppression de la deuxième méthode researchtype
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    public  function  research (){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $query  =  $this -> db -> query (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 10:29:40 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}