album(s) des artistes
This commit is contained in:
parent
63937f0b53
commit
c98f0758c8
@ -13,11 +13,5 @@ class Albums extends CI_Controller {
|
||||
$this->load->view('albums_list',['albums'=>$albums]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
public function view($album_id){
|
||||
$songs = $this->model_music->getSongOfAlbum($album_id);
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list',['songs'=>$songs]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,5 +13,11 @@ class artistes extends CI_Controller {
|
||||
$this->load->view('artistes_list',['artistes'=>$artistes]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
public function view($AlbumsOfArtistId){
|
||||
$AlbumsOfArtist = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId);
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('albums_artist_list',['AlbumsOfArtist'=>$AlbumsOfArtist]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
|
||||
}
|
17
ci/application/controllers/Song.php
Normal file
17
ci/application/controllers/Song.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Song extends CI_Controller {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('model_music');
|
||||
}
|
||||
|
||||
public function view($album_id){
|
||||
$songs = $this->model_music->getSongOfAlbum($album_id);
|
||||
$this->load->view('layout/header');
|
||||
$this->load->view('song_album_list',['songs'=>$songs]);
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
}
|
@ -38,4 +38,18 @@ class Model_music extends CI_Model {
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function getAlbumsOfArtist($artist_id){
|
||||
$query = $this->db->query(
|
||||
"SELECT album.name, album.id, album.year, genre.name as genreName, cover.jpeg
|
||||
FROM album
|
||||
JOIN artist ON album.artistId = artist.id
|
||||
JOIN genre ON album.genreId = genre.id
|
||||
JOIN cover ON album.coverId = cover.id
|
||||
WHERE artist.id = ?",
|
||||
array($artist_id)
|
||||
);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
}
|
||||
|
15
ci/application/views/albums_artist_list.php
Normal file
15
ci/application/views/albums_artist_list.php
Normal file
@ -0,0 +1,15 @@
|
||||
<h5>Albums of the artist</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
|
||||
|
||||
foreach($AlbumsOfArtist as $AlbumOfArtists){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("albums/view/{$AlbumOfArtists->id}","{$AlbumOfArtists->name}");
|
||||
echo "<br>";
|
||||
echo "</header>";
|
||||
echo "</article></div>";
|
||||
}
|
||||
?>
|
||||
</section>
|
@ -4,7 +4,7 @@
|
||||
foreach($albums as $album){
|
||||
echo "<div><article>";
|
||||
echo "<header class='short-text'>";
|
||||
echo anchor("albums/view/{$album->id}","{$album->name}");
|
||||
echo anchor("Song/view/{$album->id}","{$album->name}");
|
||||
echo "</header>";
|
||||
echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />';
|
||||
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>
|
||||
|
Loading…
Reference in New Issue
Block a user