Fix query 4/?
This commit is contained in:
parent
7baa63a9ea
commit
d2b77e594d
application
controllers
models
views
@ -12,9 +12,9 @@ class Artistes extends CI_Controller {
|
||||
public function index(){
|
||||
$genre = $this->input->get('genre');
|
||||
$order = $this->input->get('order');
|
||||
$query = $this->input->get('query');
|
||||
$query = $this->input->get('query');
|
||||
|
||||
$artists = $this->model_music->getArtists($genre, $order, $query);
|
||||
$artists = $this->model_music->getArtists($genre, $order, $query); // Pass $query
|
||||
$genres = $this->model_music->researchtype();
|
||||
|
||||
$is_logged_in = $this->session->userdata('logged_in');
|
||||
@ -26,7 +26,8 @@ class Artistes extends CI_Controller {
|
||||
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('layout/getter', $data);
|
||||
$this->load->view('artists_name', $data);
|
||||
$this->load->view('artists_list', $data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Music extends CI_Controller {
|
||||
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('layout/getter', $data);
|
||||
$this->load->view('musiques_name', $data);
|
||||
$this->load->view('musiques_list', $data);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
||||
|
@ -46,32 +46,33 @@ class Model_music extends CI_Model {
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getArtists($genre = '', $order = '') {
|
||||
public function getArtists($genre = '', $order = 'asc', $query = '') {
|
||||
$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");
|
||||
|
||||
|
||||
if (!empty($genre)) {
|
||||
$this->db->where('genre.name', $genre);
|
||||
}
|
||||
|
||||
|
||||
if ($order == 'asc' || $order == 'desc') {
|
||||
$this->db->order_by('artist.name', $order);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($query)) {
|
||||
$this->db->like('artist.name', $query);
|
||||
}
|
||||
|
||||
|
||||
$result = $this->db->get();
|
||||
return $result->result();
|
||||
}
|
||||
|
||||
|
||||
public function getMusics($genre = '', $order = '', $artist = '') {
|
||||
public function getMusics($genre = '', $order = '', $artist = '', $query = '') {
|
||||
$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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h5>Albums list</h5>
|
||||
<h5>Liste des Albums</h5>
|
||||
<section class="list">
|
||||
|
||||
<?php
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h5>Artists list</h5>
|
||||
<h5>Liste des Artistes</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
foreach($artists as $artist){
|
@ -1,4 +1,4 @@
|
||||
<h5>Musiques List</h5>
|
||||
<h5>Liste des musiques</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
foreach($musics as $music){
|
Loading…
x
Reference in New Issue
Block a user