<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Artistes extends CI_Controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('model_music');
        $this->load->library('session');
    }

    public function index(){
        $genre = $this->input->get('genre');
        $order = $this->input->get('order');
        $query = $this->input->get('query');

        $artists = $this->model_music->getArtists($genre, $order, $query);
        $genres = $this->model_music->researchtype();

        $is_logged_in = $this->session->userdata('logged_in');
        $data = array(
            'artists' => $artists,
            'genres' => $genres,
            'is_logged_in' => $is_logged_in
        );

        $this->load->view('layout/header', $data);
        $this->load->view('layout/getter', $data);
        $this->load->view('artists_list', $data);
        $this->load->view('layout/footer');
    }

    public function view($artistId) {
		$artistData = $this->model_music->getArtistDetails($artistId);
	
		$is_logged_in = $this->session->userdata('logged_in');
		$data = array(
			'artist' => $artistData['artist'],
			'albums' => $artistData['albums'],
			'is_logged_in' => $is_logged_in
		);
	
		$this->load->view('layout/header', $data);
		$this->load->view('artist_details', $data);
		$this->load->view('layout/footer');
	}
	
}