2024-05-20 21:59:37 +02:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
class Artiste extends CI_Controller {
|
|
|
|
|
|
|
|
public function __construct(){
|
|
|
|
parent::__construct();
|
2024-05-20 22:42:38 +02:00
|
|
|
$this->load->model('Model_artist');
|
2024-05-22 20:03:53 +02:00
|
|
|
$this->load->model('Model_music');
|
2024-05-20 21:59:37 +02:00
|
|
|
$this->load->helper('url');
|
2024-05-23 11:52:41 +02:00
|
|
|
$this->load->helper('html');
|
2024-05-20 21:59:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function index($artiste_id){
|
|
|
|
// Récupérer les détails de l'artiste
|
2024-05-20 22:42:38 +02:00
|
|
|
$artiste = $this->Model_artist->getArtisteById($artiste_id);
|
2024-05-23 09:59:04 +02:00
|
|
|
$mostUsedGenre = $this->Model_music->getMostUsedGenreByArtist($artiste_id);
|
2024-05-22 22:05:48 +02:00
|
|
|
|
2024-05-20 21:59:37 +02:00
|
|
|
if($artiste){
|
|
|
|
// Récupérer tous les albums de l'artiste
|
2024-05-22 20:03:53 +02:00
|
|
|
$albums = $this->Model_music->getAlbumsByArtiste($artiste_id);
|
2024-05-20 21:59:37 +02:00
|
|
|
|
|
|
|
// Charger la vue avec les détails de l'artiste et ses albums
|
|
|
|
$data['artiste'] = $artiste;
|
|
|
|
$data['albums'] = $albums;
|
2024-05-22 22:05:48 +02:00
|
|
|
$data['mostUsedGenre'] = $mostUsedGenre; // Passer $mostUsedGenre à la vue
|
2024-05-30 13:49:35 +02:00
|
|
|
$data['title']="Détails de l'artiste - Onzeur ".$artiste->name;
|
|
|
|
$data['css'] = 'assets/css/artiste_details';
|
2024-05-23 14:33:23 +02:00
|
|
|
|
2024-05-30 13:49:35 +02:00
|
|
|
$this->load->view('layout/header_dark', $data);
|
2024-05-25 01:13:18 +02:00
|
|
|
$this->load->view('artiste_details', $data);
|
|
|
|
$this->load->view('layout/footer_dark');
|
2024-05-23 14:33:23 +02:00
|
|
|
|
2024-05-20 21:59:37 +02:00
|
|
|
} else {
|
2024-05-22 20:03:53 +02:00
|
|
|
// Gérer le cas où l'artiste n'est pas trouvé == afficher un error 404
|
2024-05-20 22:42:38 +02:00
|
|
|
show_404();
|
2024-05-20 21:59:37 +02:00
|
|
|
}
|
|
|
|
}
|
2024-05-22 22:05:48 +02:00
|
|
|
|
2024-05-20 22:42:38 +02:00
|
|
|
|
|
|
|
public function list_artists(){
|
2024-05-22 20:03:53 +02:00
|
|
|
// Récupérer le paramètre de tri (croissant ou decroissant)
|
|
|
|
$order = $this->input->get('order') ? $this->input->get('order') : 'ASC';
|
|
|
|
|
2024-05-20 22:42:38 +02:00
|
|
|
// Récupérer la liste des artistes
|
2024-05-22 20:03:53 +02:00
|
|
|
$artists = $this->Model_artist->getArtists($order);
|
2024-05-20 22:42:38 +02:00
|
|
|
|
|
|
|
// Charger la vue avec la liste des artistes
|
|
|
|
$data['artists'] = $artists;
|
2024-05-22 20:03:53 +02:00
|
|
|
$data['current_order'] = $order;
|
2024-05-30 13:49:35 +02:00
|
|
|
$data['title']="Détails de l'artiste - Onzeur ";
|
|
|
|
$data['css'] = 'assets/css/artists_list.css';
|
2024-05-23 14:33:23 +02:00
|
|
|
|
2024-05-30 13:49:35 +02:00
|
|
|
$this->load->view('layout/header_dark',$data);
|
2024-05-25 01:13:18 +02:00
|
|
|
$this->load->view('artists_list', $data);
|
|
|
|
$this->load->view('layout/footer_dark');
|
2024-05-20 22:42:38 +02:00
|
|
|
}
|
2024-05-20 21:59:37 +02:00
|
|
|
}
|
|
|
|
?>
|