résolution d'un bug
This commit is contained in:
@@ -68,7 +68,7 @@ class Albums extends CI_Controller {
|
||||
$playlistId = $this->input->post('playlist_id');
|
||||
$page = $this->input->get('page');
|
||||
$this->model_music->AddAlbumtoPlaylist($playlistId,$id);
|
||||
redirect(echo $page);
|
||||
redirect('albums');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,9 @@ class Chansons extends CI_Controller {
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$playlistId = $this->input->post('playlist_id');
|
||||
$url = $this->input->get('page');
|
||||
$this->model_music->AddSongtoPlaylist($playlistId,$id);
|
||||
redirect('chansons');
|
||||
redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +67,9 @@ class Chansons extends CI_Controller {
|
||||
$this->load->view('layout/footer');
|
||||
}else{
|
||||
$playlistId = $this->input->post('playlist_id');
|
||||
$url = $this->input->get('page');
|
||||
$this->model_music->DeleteSongtoPlaylist($playlistId,$id);
|
||||
redirect('chansons');
|
||||
redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,16 +59,8 @@ if ($page[count($page)-2] != 'viewAlbum'): ?>
|
||||
|
||||
<h5>Albums list</h5>
|
||||
<section class="list">
|
||||
<?php
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$long_page = count($page)-1;
|
||||
$url = $page[$long_page];
|
||||
while ($page[$long_page] != 'albums'){
|
||||
$long_page = $long_page - 1;
|
||||
$url = $page[$long_page].'/'.$url;
|
||||
}
|
||||
print_r($url);
|
||||
|
||||
<?php
|
||||
foreach ($albums as $album):
|
||||
?>
|
||||
<div>
|
||||
@@ -76,7 +68,7 @@ foreach ($albums as $album):
|
||||
<header class="short-text">
|
||||
<?= anchor("albums/viewMusique/{$album->albumId}", $album->name); ?>
|
||||
<?php if ($this->session->userdata('logged_in')): ?>
|
||||
<?= anchor("albums/addAlbumtoPlaylist/{$album->albumId}?page={$url}", "<i class='fa fa-plus'></i>"); ?>
|
||||
<?= anchor("albums/addAlbumtoPlaylist/{$album->albumId}", "<i class='fa fa-plus'></i>"); ?>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg); ?>" alt="cover de l'album" />
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<?php
|
||||
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
||||
$long_page = count($page)-1;
|
||||
$url = $page[$long_page];
|
||||
while ($page[$long_page] != 'albums'){
|
||||
$long_page = $long_page - 1;
|
||||
$url = $page[$long_page].'/'.$url;
|
||||
$page = preg_split('/[\/]/', $_SERVER['REQUEST_URI']);
|
||||
$long_page = count($page) - 1;
|
||||
$valid_segments = ['albums', 'chansons'];
|
||||
$url = '';
|
||||
|
||||
for ($i = $long_page; $i >= 0; $i--) {
|
||||
if (in_array($page[$i], $valid_segments)) {
|
||||
$url = implode('/', array_slice($page, $i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
print_r($url);
|
||||
?>
|
||||
<section class="album-details">
|
||||
<div class="album-content">
|
||||
@@ -27,7 +30,9 @@
|
||||
echo "<tr>";
|
||||
echo "<th>Titre</th>";
|
||||
echo "<th>Durée</th>";
|
||||
if ($this->session->userdata('logged_in')){
|
||||
echo "<th>Action</th>";
|
||||
}
|
||||
echo "</tr>";
|
||||
echo "</thead>";
|
||||
echo "<tbody>";
|
||||
@@ -40,10 +45,10 @@
|
||||
echo "<td>";
|
||||
if ($this->session->userdata('logged_in')){
|
||||
if($this->model_music->SongInPlaylist($albums->tracks[$index]->trackId)){
|
||||
echo anchor("chansons/deleteSongtoPlaylist/{$albums->tracks[$index]->trackId}", "<i class='fa fa-trash'></i>", ['title' => 'Supprimer de la playlist']);
|
||||
echo anchor("chansons/deleteSongtoPlaylist/{$albums->tracks[$index]->trackId}?page=$url", "<i class='fa fa-trash'></i>", ['title' => 'Supprimer de la playlist']);
|
||||
}
|
||||
echo anchor("chansons/addSongtoPlaylist/{$albums->tracks[$index]->trackId}?page=$url", "<i class='fa fa-plus'></i>", ['title' => 'Ajouter à la playlist']);
|
||||
}
|
||||
echo anchor("chansons/addSongtoPlaylist/{$albums->tracks[$index]->trackId}", "<i class='fa fa-plus'></i>", ['title' => 'Ajouter à la playlist']);
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<?php $page = preg_split('/[\/]/', $_SERVER['REQUEST_URI']);
|
||||
if ($page[count($page)-2] != 'view'): ?>
|
||||
<h5>Filter Chansons</h5>
|
||||
<button type="button" onclick="toggleFilterOptions()">Filter</button>
|
||||
|
||||
@@ -64,6 +66,7 @@
|
||||
<button type="button" onclick="sortAlbums('genreName', 'asc')">Sort by Genre Asc</button>
|
||||
<button type="button" onclick="sortAlbums('genreName', 'desc')">Sort by Genre Desc</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h5>Chansons list</h5>
|
||||
<section class="list">
|
||||
@@ -103,9 +106,9 @@ foreach($chansons_for_current_page as $chanson): ?>
|
||||
<h6> <?php echo $chanson->name; ?> </h6>
|
||||
<?php if($this->session->userdata('logged_in')): ?>
|
||||
<?php if($this->model_music->SongInPlaylist($chanson->trackId)): ?>
|
||||
<?= anchor("chansons/deleteSongtoPlaylist/{$chanson->trackId}?page={$url}", "<i class='fa fa-trash'></i>"); ?>
|
||||
<?= anchor("chansons/deleteSongtoPlaylist/{$chanson->trackId}?page=$url", "<i class='fa fa-trash'></i>"); ?>
|
||||
<?php endif; ?>
|
||||
<?= anchor("chansons/addSongtoPlaylist/{$chanson->trackId}?page={$url}", "<i class='fa fa-plus'></i>"); ?>
|
||||
<?= anchor("chansons/addSongtoPlaylist/{$chanson->trackId}?page=$url", "<i class='fa fa-plus'></i>"); ?>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<nav class='short-text'>Nom album: <?= $chanson->albumName; ?></nav>
|
||||
|
||||
@@ -91,7 +91,7 @@ section.list img {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
html {
|
||||
background-color: #13171f;
|
||||
color: #ffffff;
|
||||
font-family: Arial, sans-serif;
|
||||
|
||||
Reference in New Issue
Block a user