From 04968758d153e7dd6223e141e2337de7a6e8cb9a Mon Sep 17 00:00:00 2001 From: brigitte Date: Mon, 10 Jun 2024 16:12:11 +0200 Subject: [PATCH] =?UTF-8?q?playlist=20cach=C3=A9=20si=20d=C3=A9connect?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/application/config/config.php | 2 +- ci/application/controllers/Artistes.php | 3 +- ci/application/controllers/Connexion.php | 51 ++++++++------------- ci/application/views/Welcome.php | 12 +++-- ci/application/views/albums_artist_list.php | 41 +++++++++-------- ci/application/views/albums_list.php | 1 - ci/application/views/layout/header.php | 32 +++++++------ ci/assets/style.css | 2 +- 8 files changed, 72 insertions(+), 72 deletions(-) diff --git a/ci/application/config/config.php b/ci/application/config/config.php index fdddfcb..f248cde 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'] = '/~gallego/SAEWEB2.2/ci/'; +$config['base_url'] = '/~brigitte/SAEWEB2.2/ci/'; /* |-------------------------------------------------------------------------- diff --git a/ci/application/controllers/Artistes.php b/ci/application/controllers/Artistes.php index 9d5f1f5..0d99155 100644 --- a/ci/application/controllers/Artistes.php +++ b/ci/application/controllers/Artistes.php @@ -16,10 +16,11 @@ class artistes extends CI_Controller { } public function view($AlbumsOfArtistId){ + $artistes = $this->model_music->getArtists(); $AlbumsOfArtists = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId); $playlists = $this->model_music->getPlaylist(); $this->load->view('layout/header'); - $this->load->view('albums_artist_list', ['AlbumsOfArtists' => $AlbumsOfArtists, 'playlists' => $playlists, 'artist_id' => $AlbumsOfArtistId]); + $this->load->view('albums_artist_list', ['AlbumsOfArtists' => $AlbumsOfArtists, 'playlists' => $playlists, 'artist_id' => $AlbumsOfArtistId, 'artistes' => $artistes]); $this->load->view('layout/footer'); } diff --git a/ci/application/controllers/Connexion.php b/ci/application/controllers/Connexion.php index 3a2962e..3286127 100644 --- a/ci/application/controllers/Connexion.php +++ b/ci/application/controllers/Connexion.php @@ -1,17 +1,4 @@ load->model('model_music'); - } - public function index(){ - $this->load->view('layout/connexion.php'); - } - -}*/ defined('BASEPATH') OR exit('No direct script access allowed'); @@ -28,24 +15,24 @@ class Connexion extends CI_Controller{ } public function login() { - $login = ''; - $password = ''; - if ($_SERVER["REQUEST_METHOD"] == "POST") { - if(isset($_POST['login']) && isset($_POST['password'])){ - $login = $_POST['login']; - $password = $_POST['password']; - } - } - $result = $this->model_music->getLogin($login,$password); -if (count($result) > 0) { - $this->session->set_userdata('logged', true); - $this->load->view('layout/header'); - redirect('albums'); -} else { - $this->load->view('layout/header'); - $this->load->view('login'); - $this->load->view('layout/footer'); - echo "Invalid login or password"; -} + $login = ''; + $password = ''; + if ($_SERVER["REQUEST_METHOD"] == "POST") { + if(isset($_POST['login']) && isset($_POST['password'])){ + $login = $_POST['login']; + $password = $_POST['password']; + } + } + $result = $this->model_music->getLogin($login,$password); + if (count($result) > 0) { + $this->session->set_userdata('logged', true); + $this->load->view('layout/header'); + redirect('albums'); + } else { + //$this->load->view('layout/header'); + $this->load->view('login'); + $this->load->view('layout/footer'); + echo "Invalid login or password"; + } } } diff --git a/ci/application/views/Welcome.php b/ci/application/views/Welcome.php index a6903e0..5949a35 100644 --- a/ci/application/views/Welcome.php +++ b/ci/application/views/Welcome.php @@ -31,12 +31,18 @@ -
  • + session->userdata('logged')): ?> +
  • +
    - Connexion - S'inscrire + session->userdata('logged')): ?> +
  • + +
  • +
  • +
    diff --git a/ci/application/views/albums_artist_list.php b/ci/application/views/albums_artist_list.php index e22408b..25754ec 100644 --- a/ci/application/views/albums_artist_list.php +++ b/ci/application/views/albums_artist_list.php @@ -1,27 +1,28 @@
    "; - echo "
    "; - echo anchor("albums/view/{$AlbumsOfArtist->id}", "{$AlbumsOfArtist->name}"); - echo "
    "; - echo "
    "; - echo '' . $AlbumsOfArtist->name . ''; - echo "
    $AlbumsOfArtist->year
    "; + foreach ($AlbumsOfArtists as $AlbumsOfArtist) { + echo "
    "; + echo "
    "; + echo "
    "; + echo "
    "; + echo '' . $AlbumsOfArtist->name . ''; + echo "
    $AlbumsOfArtist->year
    "; - // Ajout du formulaire pour ajouter toutes les chansons de l'album à une playlist - echo "
    "; - echo ""; - echo ""; - echo ""; - echo "
    "; - - echo "
    "; + // Ajout du formulaire pour ajouter toutes les chansons de l'album à une playlist + echo "
    "; + echo ""; + echo ""; + echo ""; + echo "
    "; + echo "
    "; + } ?> + + diff --git a/ci/application/views/albums_list.php b/ci/application/views/albums_list.php index 6dabe59..ff62cad 100644 --- a/ci/application/views/albums_list.php +++ b/ci/application/views/albums_list.php @@ -4,7 +4,6 @@ foreach($albums as $album){ echo "
    "; echo "
    "; - echo anchor("albums/view/{$album->id}", "{$album->name}"); echo "
    "; echo '' . $album->name . ''; echo "
    {$album->year} - {$album->artistName}
    "; diff --git a/ci/application/views/layout/header.php b/ci/application/views/layout/header.php index bcdab3f..0094a76 100644 --- a/ci/application/views/layout/header.php +++ b/ci/application/views/layout/header.php @@ -17,29 +17,35 @@
    - >Connexion - >S'inscrire + session->userdata('logged')): ?> +
  • + +
  • +
  • +
    @@ -48,4 +54,4 @@ - + \ No newline at end of file diff --git a/ci/assets/style.css b/ci/assets/style.css index 702e8f2..0826706 100644 --- a/ci/assets/style.css +++ b/ci/assets/style.css @@ -39,7 +39,7 @@ body { border: 2px; margin: 0 40px; } -.user{ +.user { margin-right: 50px; padding-left: center; list-style: none;