diff --git a/ci/application/config/config.php b/ci/application/config/config.php index e901ca5..80d6f99 100644 --- a/ci/application/config/config.php +++ b/ci/application/config/config.php @@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = '/~brigitte/SAEWEB2.2/ci'; +$config['base_url'] = 'https://dwarves.iut-fbleau.fr/~boutaric/test/ci/'; /* |-------------------------------------------------------------------------- diff --git a/ci/application/config/routes.php b/ci/application/config/routes.php index 2785ed9..e8e2296 100644 --- a/ci/application/config/routes.php +++ b/ci/application/config/routes.php @@ -49,6 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | Examples: my-controller/index -> my_controller/index | my-controller/my-method -> my_controller/my_method */ -$route['default_controller'] = 'albums'; +$route['default_controller'] = 'welcome'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; diff --git a/ci/application/controllers/Albums.php b/ci/application/controllers/Albums.php index 7b7e917..a62c2f7 100644 --- a/ci/application/controllers/Albums.php +++ b/ci/application/controllers/Albums.php @@ -3,22 +3,29 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Albums extends CI_Controller { - public function __construct(){ - parent::__construct(); - $this->load->model('model_music'); - } - public function index(){ - $albums = $this->model_music->getAlbums(); - $this->load->view('layout/header'); - $this->load->view('albums_list',['albums'=>$albums]); - $this->load->view('layout/footer'); - } + 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'); - } + public function index(){ + $albums = $this->model_music->getAlbums(); + $this->load->view('layout/header_album'); + $this->load->view('albums_list', ['albums' => $albums]); + $this->load->view('layout/footer_album'); + } + + public function view($album_id){ + $songs = $this->model_music->getSongsByAlbum($album_id); + if (empty($songs)) { + $songs = []; // Assurez-vous que $songs est un tableau vide si aucune chanson n'est trouvée + } + // Debugging: Log the $songs variable to see its content + log_message('debug', 'Songs: ' . print_r($songs, true)); + + $this->load->view('layout/header_album'); + $this->load->view('song_album_list', ['songs' => $songs]); + $this->load->view('layout/footer_album'); + } } - +?> diff --git a/ci/application/controllers/Artistes.php b/ci/application/controllers/Artistes.php index cfb25dc..61a5960 100644 --- a/ci/application/controllers/Artistes.php +++ b/ci/application/controllers/Artistes.php @@ -9,15 +9,9 @@ class artistes extends CI_Controller { } public function index(){ $artistes = $this->model_music->getArtists(); - $this->load->view('layout/header'); + $this->load->view('layout/header_artistes'); $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'); + $this->load->view('layout/footer_artistes'); } } \ No newline at end of file diff --git a/ci/application/controllers/Chansons.php b/ci/application/controllers/Chansons.php index 894234c..992e9d6 100644 --- a/ci/application/controllers/Chansons.php +++ b/ci/application/controllers/Chansons.php @@ -9,9 +9,9 @@ class Albums extends CI_Controller { } public function index(){ $albums = $this->model_music->getAlbums(); - $this->load->view('layout/header'); + $this->load->view('layout/header_chanson'); $this->load->view('albums_list',['albums'=>$albums]); - $this->load->view('layout/footer'); + $this->load->view('layout/footer_chanson'); } } diff --git a/ci/application/controllers/Song.php b/ci/application/controllers/Song.php index 77b552a..0161f08 100644 --- a/ci/application/controllers/Song.php +++ b/ci/application/controllers/Song.php @@ -10,8 +10,8 @@ class Song extends CI_Controller { public function view($album_id){ $songs = $this->model_music->getSongOfAlbum($album_id); - $this->load->view('layout/header'); + $this->load->view('layout/header_song'); $this->load->view('song_album_list',['songs'=>$songs]); - $this->load->view('layout/footer'); + $this->load->view('layout/footer_song'); } } \ No newline at end of file diff --git a/ci/application/controllers/Welcome.php b/ci/application/controllers/Welcome.php index 5f82771..edd94e8 100644 --- a/ci/application/controllers/Welcome.php +++ b/ci/application/controllers/Welcome.php @@ -1,25 +1,15 @@ - * @see https://codeigniter.com/userguide3/general/urls.html - */ - public function index() - { - $this->load->view('welcome_message'); + public function __construct(){ + parent::__construct(); + $this->load->model('model_music'); } + public function index(){ + $this->load->view('layout/header'); + $this->load->view('layout/footer'); + } + } diff --git a/ci/application/views/albums_list.php b/ci/application/views/albums_list.php index 45d0462..ad8709b 100644 --- a/ci/application/views/albums_list.php +++ b/ci/application/views/albums_list.php @@ -1,14 +1,14 @@ -
+ + +
+ +
+ + +