playlist caché si déconnecté

This commit is contained in:
Wilfried BRIGITTE 2024-06-10 16:12:11 +02:00
parent 686aaaa8be
commit 04968758d1
8 changed files with 72 additions and 72 deletions

View File

@ -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/';
/*
|--------------------------------------------------------------------------

View File

@ -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');
}

View File

@ -1,17 +1,4 @@
<?php
/*defined('BASEPATH') OR exit('No direct script access allowed');
class Connexion extends CI_Controller {
public function __construct(){
parent::__construct();
$this->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";
}
}
}

View File

@ -31,12 +31,18 @@
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/62','Tool'); ?>
</div>
</li>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php if ($this->session->userdata('logged')): ?>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php endif ?>
</ul>
</nav>
<div class="user">
<a class="bouton" href="connexion.php">Connexion</a>
<a class="bouton" href="html/Inscription.html">S'inscrire</a>
<?php if ($this->session->userdata('logged')): ?>
<li class="bouton"><?=anchor('Deconnexion', 'Déconnexion');?></li>
<?php else: ?>
<li class="bouton"><?=anchor('Connexion','Connexion');?></li>
<li class="bouton"><?=anchor('Enregistrer','Enregistrer');?></li>
<?php endif ?>
</div>
</header>
<div id="Page">

View File

@ -1,27 +1,28 @@
<section class="container">
<?php
foreach ($AlbumsOfArtists as $AlbumsOfArtist) {
echo "<div class='album'><article>";
echo "<header class='album-title'>";
echo anchor("albums/view/{$AlbumsOfArtist->id}", "{$AlbumsOfArtist->name}");
echo "<br>";
echo "</header>";
echo '<img src="data:image/jpeg;base64,' . base64_encode($AlbumsOfArtist->jpeg) . '" alt="' . $AlbumsOfArtist->name . '" />';
echo "<footer class='short-text'>$AlbumsOfArtist->year</footer>";
foreach ($AlbumsOfArtists as $AlbumsOfArtist) {
echo "<div class='album'><article>";
echo "<header class='album-title'>";
echo "<br>";
echo "</header>";
echo '<img src="data:image/jpeg;base64,' . base64_encode($AlbumsOfArtist->jpeg) . '" alt="' . $AlbumsOfArtist->name . '" />';
echo "<footer class='short-text'>$AlbumsOfArtist->year</footer>";
// Ajout du formulaire pour ajouter toutes les chansons de l'album à une playlist
echo "<form action='" . base_url('index.php/albums/addAllSongsToPlaylist') . "' method='post'>";
echo "<input type='hidden' name='album_id' value='{$AlbumsOfArtist->id}'>";
echo "<select name='playlist'>";
foreach($playlists as $playlist){
echo "<option value='{$playlist->id}'>{$playlist->name}</option>";
}
echo "</select>";
echo "<button type='submit'>Ajouter toutes les chansons</button>";
echo "</form>";
// Ajout du formulaire pour ajouter toutes les chansons de l'album à une playlist
echo "<form action='" . base_url('index.php/albums/addAllSongsToPlaylist') . "' method='post'>";
echo "<input type='hidden' name='album_id' value='{$AlbumsOfArtist->id}'>";
echo "<select name='playlist'>";
foreach($playlists as $playlist){
echo "<option value='{$playlist->id}'>{$playlist->name}</option>";
}
echo "</select>";
echo "<button type='submit'>Ajouter toutes les chansons</button>";
echo "</form>";
echo "</article></div>";
echo "</article></div>";
}
?>
</section>

View File

@ -4,7 +4,6 @@
foreach($albums as $album){
echo "<div class='album'><article>";
echo "<header class='album-title'>";
echo anchor("albums/view/{$album->id}", "{$album->name}");
echo "</header>";
echo '<img src="data:image/jpeg;base64,' . base64_encode($album->jpeg) . '" alt="' . $album->name . '" />';
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>";

View File

@ -17,29 +17,35 @@
</div>
<nav class="menu">
<ul>
<li><?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/','Home'); ?></li>
<li><?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/','Home'); ?></li>
<li class="menu_déroulant"><?= anchor('albums','Albums'); ?>
<div class="menu_déroulant_content">
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/196','New Masters'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/88','Joe Cocker!'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/213','Dylan'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/142','Mothers Milk'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/196','New Masters'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/88','Joe Cocker!'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/213','Dylan'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/142','Mothers Milk'); ?>
</div>
</li>
<li class="menu_déroulant"><?= anchor('artistes','Artistes'); ?>
<div class="menu_déroulant_content">
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/artistes/view/34','Queen'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/21','Slayer'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/63','Muse'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~gallego/SAEWEB2.2/ci/index.php/Song/view/62','Tool'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/artistes/view/34','Queen'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/21','Slayer'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/63','Muse'); ?>
<?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/62','Tool'); ?>
</div>
</li>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php if ($this->session->userdata('logged')): ?>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php endif ?>
</ul>
</nav>
<div class="user">
<a class="bouton" <?= anchor('Connexion','Connexion'); ?>>Connexion</a>
<a class="bouton" <?= anchor('Enregistrer','Enregistrer'); ?>>S'inscrire</a>
<?php if ($this->session->userdata('logged')): ?>
<li class="bouton"><?=anchor('Deconnexion', 'Déconnexion');?></li>
<?php else: ?>
<li class="bouton"><?=anchor('Connexion','Connexion');?></li>
<li class="bouton"><?=anchor('Enregistrer','Enregistrer');?></li>
<?php endif ?>
</div>
</header>
</main>

View File

@ -39,7 +39,7 @@ body {
border: 2px;
margin: 0 40px;
}
.user{
.user {
margin-right: 50px;
padding-left: center;
list-style: none;