Test pages * 1/?
This commit is contained in:
		@@ -6,7 +6,7 @@ class Artistes extends CI_Controller {
 | 
				
			|||||||
    public function __construct(){
 | 
					    public function __construct(){
 | 
				
			||||||
        parent::__construct();
 | 
					        parent::__construct();
 | 
				
			||||||
        $this->load->model('model_music');
 | 
					        $this->load->model('model_music');
 | 
				
			||||||
        $this->load->library('session'); // La session est déjà chargée via autoload.php, mais par précaution.
 | 
					        $this->load->library('session');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function index(){
 | 
					    public function index(){
 | 
				
			||||||
@@ -14,7 +14,7 @@ class Artistes extends CI_Controller {
 | 
				
			|||||||
        $order = $this->input->get('order');
 | 
					        $order = $this->input->get('order');
 | 
				
			||||||
        $query = $this->input->get('query');
 | 
					        $query = $this->input->get('query');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $artists = $this->model_music->getArtists($genre, $order, $query); // Pass $query
 | 
					        $artists = $this->model_music->getArtists($genre, $order, $query);
 | 
				
			||||||
        $genres = $this->model_music->researchtype();
 | 
					        $genres = $this->model_music->researchtype();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $is_logged_in = $this->session->userdata('logged_in');
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,8 +13,7 @@ class Music extends CI_Controller {
 | 
				
			|||||||
        $genre = $this->input->get('genre');
 | 
					        $genre = $this->input->get('genre');
 | 
				
			||||||
        $order = $this->input->get('order');
 | 
					        $order = $this->input->get('order');
 | 
				
			||||||
        $artist = $this->input->get('artist');
 | 
					        $artist = $this->input->get('artist');
 | 
				
			||||||
		$query = $this->input->get('query');
 | 
					        $query = $this->input->get('query');
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $musics = $this->model_music->getMusics($genre, $order, $artist, $query);
 | 
					        $musics = $this->model_music->getMusics($genre, $order, $artist, $query);
 | 
				
			||||||
        $genres = $this->model_music->researchtype();
 | 
					        $genres = $this->model_music->researchtype();
 | 
				
			||||||
@@ -33,4 +32,19 @@ class Music extends CI_Controller {
 | 
				
			|||||||
        $this->load->view('musiques_list', $data);
 | 
					        $this->load->view('musiques_list', $data);
 | 
				
			||||||
        $this->load->view('layout/footer');
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function song($songId) {
 | 
				
			||||||
 | 
					        $songData = $this->model_music->getSongDetails($songId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $is_logged_in = $this->session->userdata('logged_in');
 | 
				
			||||||
 | 
					        $data = array(
 | 
				
			||||||
 | 
					            'song' => $songData,
 | 
				
			||||||
 | 
					            'is_logged_in' => $is_logged_in
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->load->view('layout/header', $data);
 | 
				
			||||||
 | 
					        $this->load->view('song_details', $data);
 | 
				
			||||||
 | 
					        $this->load->view('layout/footer');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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->select('artist.name as artistName, artist.id, genre.name as genreName, artist.jpeg');
 | 
				
			||||||
        $this->db->from('artist');
 | 
					        $this->db->from('artist');
 | 
				
			||||||
        $this->db->join('album', 'album.artistid = artist.id');
 | 
					        $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);
 | 
					        $this->db->where('artist.id', $artistId);
 | 
				
			||||||
        $artistQuery = $this->db->get();
 | 
					        $artistQuery = $this->db->get();
 | 
				
			||||||
        $artistDetails = $artistQuery->row();
 | 
					        $artistDetails = $artistQuery->row();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        // Get artist's albums
 | 
					        // 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->from('album');
 | 
				
			||||||
        $this->db->where('album.artistid', $artistId);
 | 
					        $this->db->where('album.artistid', $artistId);
 | 
				
			||||||
        $albumsQuery = $this->db->get();
 | 
					        $albumsQuery = $this->db->get();
 | 
				
			||||||
@@ -143,6 +143,20 @@ class Model_music extends CI_Model {
 | 
				
			|||||||
        return array('artist' => $artistDetails, 'albums' => $albums);
 | 
					        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();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@
 | 
				
			|||||||
    <h2>Songs</h2>
 | 
					    <h2>Songs</h2>
 | 
				
			||||||
    <ul>
 | 
					    <ul>
 | 
				
			||||||
        <?php foreach ($songs as $song): ?>
 | 
					        <?php foreach ($songs as $song): ?>
 | 
				
			||||||
            <li><?= $song->trackName ?></li>
 | 
					            <li><?= anchor("music/song/{$song->trackId}", $song->trackName) ?></li>
 | 
				
			||||||
        <?php endforeach; ?>
 | 
					        <?php endforeach; ?>
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,8 +5,12 @@
 | 
				
			|||||||
</head>
 | 
					</head>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <h1><?= $artist->artistName ?></h1>
 | 
					    <h1><?= $artist->artistName ?></h1>
 | 
				
			||||||
    <p><strong>Genre:</strong> <?= $artist->genreName ?></p>
 | 
					    <?php if (!empty($artist->genreName)): ?>
 | 
				
			||||||
    <img src="data:image/jpeg;base64,<?= base64_encode($artist->jpeg) ?>" alt="<?= $artist->artistName ?> Photo">
 | 
					        <p><strong>Genre:</strong> <?= $artist->genreName ?></p>
 | 
				
			||||||
 | 
					    <?php endif; ?>
 | 
				
			||||||
 | 
					    <?php if (!empty($artist->jpeg)): ?>
 | 
				
			||||||
 | 
					        <img src="data:image/jpeg;base64,<?= base64_encode($artist->jpeg) ?>" alt="<?= $artist->artistName ?> Photo">
 | 
				
			||||||
 | 
					    <?php endif; ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <h2>Albums</h2>
 | 
					    <h2>Albums</h2>
 | 
				
			||||||
    <ul>
 | 
					    <ul>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								application/views/song_details.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								application/views/song_details.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html>
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					    <title><?= $song->songName ?> - Details</title>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <h1><?= $song->songName ?></h1>
 | 
				
			||||||
 | 
					    <p><strong>Album:</strong> <?= anchor("albums/view/{$song->trackId}", $song->albumName) ?> (<?= $song->year ?>)</p>
 | 
				
			||||||
 | 
					    <p><strong>Artist:</strong> <?= $song->artistName ?></p>
 | 
				
			||||||
 | 
					    <p><strong>Genre:</strong> <?= $song->genreName ?></p>
 | 
				
			||||||
 | 
					    <img src="data:image/jpeg;base64,<?= base64_encode($song->jpeg) ?>" alt="<?= $song->albumName ?> Cover">
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user