2024-06-03 16:51:37 +02:00
|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
2024-06-04 17:24:06 +02:00
|
|
|
class Artistes extends CI_Controller {
|
2024-06-16 17:39:26 +02:00
|
|
|
public function __construct() {
|
2024-06-04 21:08:14 +02:00
|
|
|
parent::__construct();
|
2024-06-19 14:08:59 +02:00
|
|
|
$this->load->model('Model_artist');
|
|
|
|
$this->load->model('Model_music');
|
|
|
|
$this->load->library('pagination');
|
2024-06-04 21:08:14 +02:00
|
|
|
}
|
2024-06-03 16:51:37 +02:00
|
|
|
|
2024-06-16 17:39:26 +02:00
|
|
|
public function index() {
|
2024-06-04 21:08:14 +02:00
|
|
|
$genre = $this->input->get('genre');
|
|
|
|
$order = $this->input->get('order');
|
2024-06-04 22:09:23 +02:00
|
|
|
$query = $this->input->get('query');
|
2024-06-19 14:08:59 +02:00
|
|
|
|
|
|
|
// Configuration de la pagination
|
|
|
|
$config = array();
|
|
|
|
$config['base_url'] = site_url('artistes');
|
|
|
|
$config['total_rows'] = $this->Model_artist->get_total_artists($genre, $query);
|
|
|
|
$config['per_page'] = 16; // Nombre d'artistes par page
|
|
|
|
$config['uri_segment'] = 2; // Segment de l'URI contenant le numéro de la page
|
|
|
|
$config['reuse_query_string'] = TRUE;
|
|
|
|
|
|
|
|
$this->pagination->initialize($config);
|
|
|
|
|
|
|
|
$page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
|
|
|
|
|
|
|
|
// Correction pour éviter l'erreur str_replace()
|
|
|
|
$pagination_links = $this->pagination->create_links();
|
|
|
|
if ($pagination_links === null) {
|
|
|
|
$pagination_links = '';
|
|
|
|
}
|
|
|
|
|
2024-06-04 21:08:14 +02:00
|
|
|
$data = array(
|
2024-06-19 14:08:59 +02:00
|
|
|
'artists' => $this->Model_artist->getArtists($genre, $order, $query, $config['per_page'], $page),
|
|
|
|
'genres' => $this->Model_music->researchtype(),
|
|
|
|
'pagination' => $pagination_links,
|
|
|
|
'is_logged_in' => $this->session->userdata('logged_in')
|
2024-06-04 21:08:14 +02:00
|
|
|
);
|
2024-06-19 14:08:59 +02:00
|
|
|
|
2024-06-04 21:08:14 +02:00
|
|
|
$this->load->view('layout/header', $data);
|
|
|
|
$this->load->view('layout/getter', $data);
|
2024-06-04 22:09:23 +02:00
|
|
|
$this->load->view('artists_list', $data);
|
2024-06-04 21:08:14 +02:00
|
|
|
$this->load->view('layout/footer');
|
|
|
|
}
|
2024-06-19 14:08:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-04 22:55:02 +02:00
|
|
|
|
|
|
|
public function view($artistId) {
|
2024-06-19 14:08:59 +02:00
|
|
|
$artistDetails = $this->Model_artist->getArtistDetails($artistId);
|
|
|
|
$albums = $this->Model_artist->getAlbumsByArtist($artistId);
|
|
|
|
|
|
|
|
if (!$artistDetails) {
|
|
|
|
show_404();
|
|
|
|
}
|
|
|
|
|
2024-06-16 17:39:26 +02:00
|
|
|
$data = array(
|
2024-06-19 14:08:59 +02:00
|
|
|
'artist' => $artistDetails,
|
2024-06-16 17:39:26 +02:00
|
|
|
'albums' => $albums,
|
2024-06-19 14:08:59 +02:00
|
|
|
'is_logged_in' => $this->session->userdata('logged_in')
|
2024-06-16 17:39:26 +02:00
|
|
|
);
|
2024-06-19 14:08:59 +02:00
|
|
|
|
2024-06-16 17:39:26 +02:00
|
|
|
$this->load->view('layout/header', $data);
|
|
|
|
$this->load->view('artist_details', $data);
|
|
|
|
$this->load->view('layout/footer');
|
|
|
|
}
|
2024-06-19 14:08:59 +02:00
|
|
|
|
2024-06-16 17:39:26 +02:00
|
|
|
}
|