2024-06-16 19:05:37 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="<?= base_url('assets/styles.css'); ?>">
|
|
|
|
|
<script src="<?= base_url('assets/scripts.js'); ?>"></script>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
|
|
|
|
<h5>Filter Chansons</h5>
|
|
|
|
|
<button type="button" onclick="toggleFilterOptions()">Filter</button>
|
|
|
|
|
|
|
|
|
|
<div id="filter-options" class="filter-options">
|
|
|
|
|
<form method="get">
|
|
|
|
|
<div id="filter-buttons" class="filter-buttons">
|
|
|
|
|
<button type="button" onclick="toggleCheckboxes('genre')">Genres</button>
|
|
|
|
|
<button type="button" onclick="toggleCheckboxes('artist')">Artists</button>
|
|
|
|
|
<button type="button" onclick="toggleCheckboxes('year')">Years</button>
|
|
|
|
|
<button type="button" onclick="toggleCheckboxes('album')">Albums</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="genre-checkboxes" style="display:none;">
|
|
|
|
|
<?php foreach ($genres as $genre): ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="genre[]" value="<?= $genre->genreName; ?>">
|
|
|
|
|
<?= $genre->genreName; ?>
|
|
|
|
|
</label><br>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="artist-checkboxes" style="display:none;">
|
|
|
|
|
<?php foreach ($artists as $artist): ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="artist[]" value="<?= $artist->artistName; ?>">
|
|
|
|
|
<?= $artist->artistName; ?>
|
|
|
|
|
</label><br>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="year-checkboxes" style="display:none;">
|
|
|
|
|
<?php foreach ($years as $year): ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="year[]" value="<?= $year->year; ?>">
|
|
|
|
|
<?= $year->year; ?>
|
|
|
|
|
</label><br>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="album-checkboxes" style="display:none;">
|
|
|
|
|
<?php foreach ($albums as $album): ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox" name="albums[]" value="<?= $album->albumName; ?>">
|
|
|
|
|
<?= $album->albumName; ?>
|
|
|
|
|
</label><br>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button type="submit">Apply Filters</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<h5>Sort Chansons</h5>
|
|
|
|
|
<button type="button" onclick="toggleSortButtons()">Sort</button>
|
|
|
|
|
<div id="sort-buttons" class="sort-buttons">
|
|
|
|
|
<button onclick="sortAlbums('year', 'asc')">Sort by Year Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('year', 'desc')">Sort by Year Desc</button>
|
|
|
|
|
<button onclick="sortAlbums('artistName', 'asc')">Sort by Artist Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('artistName', 'desc')">Sort by Artist Desc</button>
|
2024-06-10 11:42:39 +02:00
|
|
|
<button onclick="sortAlbums('name', 'asc')">Sort by Chanson Name Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('name', 'desc')">Sort by Chanson Name Desc</button>
|
|
|
|
|
<button onclick="sortAlbums('albumName', 'asc')">Sort by Album Name Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('albumName', 'desc')">Sort by Album Name Desc</button>
|
2024-06-10 09:52:24 +02:00
|
|
|
<button onclick="sortAlbums('genreName', 'asc')">Sort by Genre Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('genreName', 'desc')">Sort by Genre Desc</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-05-27 13:32:33 +02:00
|
|
|
<h5>Chansons list</h5>
|
|
|
|
|
<section class="list">
|
|
|
|
|
<?php
|
2024-06-16 19:05:37 +02:00
|
|
|
ini_set('memory_limit', '512M');
|
|
|
|
|
|
|
|
|
|
$page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
|
|
|
|
$long_page = count($page)-1;
|
|
|
|
|
$url = $page[$long_page];
|
|
|
|
|
while ($page[$long_page] != 'albums' && $page[$long_page] != 'chansons'){
|
|
|
|
|
$long_page = $long_page - 1;
|
|
|
|
|
$url = $page[$long_page];
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-10 09:52:24 +02:00
|
|
|
foreach($chansons as $chanson){
|
2024-05-27 13:32:33 +02:00
|
|
|
echo "<div><article>";
|
|
|
|
|
echo "<header class='short-text'>";
|
2024-06-10 09:52:24 +02:00
|
|
|
echo anchor("chansons/view/{$chanson->id}","{$chanson->name}");
|
2024-06-10 12:26:53 +02:00
|
|
|
if($this->session->userdata('logged_in')){
|
2024-06-10 16:29:19 +02:00
|
|
|
if($this->model_music->SongInPlaylist($chanson->trackId)){
|
2024-06-16 19:05:37 +02:00
|
|
|
echo anchor("chansons/deleteSongtoPlaylist/{$chanson->trackId}?page={$url}","<i class='fa fa-trash'></i>");
|
2024-06-10 16:29:19 +02:00
|
|
|
}
|
2024-06-16 19:05:37 +02:00
|
|
|
echo anchor("chansons/addSongtoPlaylist/{$chanson->trackId}?page={$url}","<i class='fa fa-plus'></i>");
|
2024-06-10 12:26:53 +02:00
|
|
|
}
|
|
|
|
|
echo "</header>";
|
2024-06-10 09:52:24 +02:00
|
|
|
echo "<nav class='short-text'>Nom album: {$chanson->albumName}</nav>";
|
|
|
|
|
echo "<nav class='short-text'>Genre: {$chanson->genreName}</nav>";
|
|
|
|
|
echo "<footer class='short-text'>{$chanson->year} - {$chanson->artistName}</footer>
|
2024-05-27 13:32:33 +02:00
|
|
|
</article></div>";
|
|
|
|
|
}
|
2024-06-16 19:05:37 +02:00
|
|
|
|
|
|
|
|
echo "<div class='pagination-links'>";
|
|
|
|
|
echo "<?= $pagination; ?>";
|
|
|
|
|
echo "</div>";
|
2024-05-27 13:32:33 +02:00
|
|
|
?>
|
|
|
|
|
</section>
|