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. | 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){ public function view($AlbumsOfArtistId){
$artistes = $this->model_music->getArtists();
$AlbumsOfArtists = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId); $AlbumsOfArtists = $this->model_music->getAlbumsOfArtist($AlbumsOfArtistId);
$playlists = $this->model_music->getPlaylist(); $playlists = $this->model_music->getPlaylist();
$this->load->view('layout/header'); $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'); $this->load->view('layout/footer');
} }

View File

@ -1,17 +1,4 @@
<?php <?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'); defined('BASEPATH') OR exit('No direct script access allowed');
@ -28,24 +15,24 @@ class Connexion extends CI_Controller{
} }
public function login() { public function login() {
$login = ''; $login = '';
$password = ''; $password = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if(isset($_POST['login']) && isset($_POST['password'])){ if(isset($_POST['login']) && isset($_POST['password'])){
$login = $_POST['login']; $login = $_POST['login'];
$password = $_POST['password']; $password = $_POST['password'];
} }
} }
$result = $this->model_music->getLogin($login,$password); $result = $this->model_music->getLogin($login,$password);
if (count($result) > 0) { if (count($result) > 0) {
$this->session->set_userdata('logged', true); $this->session->set_userdata('logged', true);
$this->load->view('layout/header'); $this->load->view('layout/header');
redirect('albums'); redirect('albums');
} else { } else {
$this->load->view('layout/header'); //$this->load->view('layout/header');
$this->load->view('login'); $this->load->view('login');
$this->load->view('layout/footer'); $this->load->view('layout/footer');
echo "Invalid login or password"; 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'); ?> <?= anchor('https://dwarves.iut-fbleau.fr/~brigitte/SAEWEB2.2/ci/index.php/Song/view/62','Tool'); ?>
</div> </div>
</li> </li>
<li><?= anchor('playlist','Playlist'); ?></li> <?php if ($this->session->userdata('logged')): ?>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php endif ?>
</ul> </ul>
</nav> </nav>
<div class="user"> <div class="user">
<a class="bouton" href="connexion.php">Connexion</a> <?php if ($this->session->userdata('logged')): ?>
<a class="bouton" href="html/Inscription.html">S'inscrire</a> <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> </div>
</header> </header>
<div id="Page"> <div id="Page">

View File

@ -1,27 +1,28 @@
<section class="container"> <section class="container">
<?php <?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 . '" />'; foreach ($AlbumsOfArtists as $AlbumsOfArtist) {
echo "<footer class='short-text'>$AlbumsOfArtist->year</footer>"; 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 // 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 "<form action='" . base_url('index.php/albums/addAllSongsToPlaylist') . "' method='post'>";
echo "<input type='hidden' name='album_id' value='{$AlbumsOfArtist->id}'>"; echo "<input type='hidden' name='album_id' value='{$AlbumsOfArtist->id}'>";
echo "<select name='playlist'>"; echo "<select name='playlist'>";
foreach($playlists as $playlist){ foreach($playlists as $playlist){
echo "<option value='{$playlist->id}'>{$playlist->name}</option>"; echo "<option value='{$playlist->id}'>{$playlist->name}</option>";
} }
echo "</select>"; echo "</select>";
echo "<button type='submit'>Ajouter toutes les chansons</button>"; echo "<button type='submit'>Ajouter toutes les chansons</button>";
echo "</form>"; echo "</form>";
echo "</article></div>";
echo "</article></div>";
} }
?> ?>
</section> </section>

View File

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

View File

@ -17,29 +17,35 @@
</div> </div>
<nav class="menu"> <nav class="menu">
<ul> <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'); ?> <li class="menu_déroulant"><?= anchor('albums','Albums'); ?>
<div class="menu_déroulant_content"> <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/~brigitte/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/~brigitte/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/~brigitte/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/142','Mothers Milk'); ?>
</div> </div>
</li> </li>
<li class="menu_déroulant"><?= anchor('artistes','Artistes'); ?> <li class="menu_déroulant"><?= anchor('artistes','Artistes'); ?>
<div class="menu_déroulant_content"> <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/~brigitte/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/~brigitte/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/~brigitte/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/Song/view/62','Tool'); ?>
</div> </div>
</li> </li>
<li><?= anchor('playlist','Playlist'); ?></li> <?php if ($this->session->userdata('logged')): ?>
<li><?= anchor('playlist','Playlist'); ?></li>
<?php endif ?>
</ul> </ul>
</nav> </nav>
<div class="user"> <div class="user">
<a class="bouton" <?= anchor('Connexion','Connexion'); ?>>Connexion</a> <?php if ($this->session->userdata('logged')): ?>
<a class="bouton" <?= anchor('Enregistrer','Enregistrer'); ?>>S'inscrire</a> <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> </div>
</header> </header>
</main> </main>
@ -48,4 +54,4 @@
<span>&#8593;</span> <span>&#8593;</span>
</button> </button>
</body> </body>
</html> </html>

View File

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