2024-06-17 18:43:13 +02:00
|
|
|
<?php
|
|
|
|
|
$page = preg_split('/[\/]/', $_SERVER['REQUEST_URI']);
|
|
|
|
|
if ($page[count($page)-2] != 'viewAlbum'): ?>
|
|
|
|
|
<h5>Filter Albums</h5>
|
|
|
|
|
<button type="button" onclick="toggleFilterOptions()">Filter</button>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<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>
|
|
|
|
|
</div>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<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>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<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>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<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>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<button type="submit">Apply Filters</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-17 18:43:13 +02:00
|
|
|
<h5>Sort Albums</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>
|
|
|
|
|
<button onclick="sortAlbums('name', 'asc')">Sort by Album Name Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('name', 'desc')">Sort by Album Name Desc</button>
|
|
|
|
|
<button onclick="sortAlbums('genreName', 'asc')">Sort by Genre Asc</button>
|
|
|
|
|
<button onclick="sortAlbums('genreName', 'desc')">Sort by Genre Desc</button>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-05-22 10:37:19 +02:00
|
|
|
<h5>Albums list</h5>
|
|
|
|
|
<section class="list">
|
2024-06-05 10:32:50 +02:00
|
|
|
|
2024-06-17 19:18:08 +02:00
|
|
|
<?php
|
2024-06-17 18:43:13 +02:00
|
|
|
foreach ($albums as $album):
|
2024-05-22 10:37:19 +02:00
|
|
|
?>
|
2024-06-17 18:43:13 +02:00
|
|
|
<div>
|
|
|
|
|
<article>
|
|
|
|
|
<header class="short-text">
|
|
|
|
|
<?= anchor("albums/viewMusique/{$album->albumId}", $album->name); ?>
|
|
|
|
|
<?php if ($this->session->userdata('logged_in')): ?>
|
2024-06-17 19:18:08 +02:00
|
|
|
<?= anchor("albums/addAlbumtoPlaylist/{$album->albumId}", "<i class='fa fa-plus'></i>"); ?>
|
2024-06-17 18:43:13 +02:00
|
|
|
<?php endif; ?>
|
|
|
|
|
</header>
|
|
|
|
|
<img src="data:image/jpeg;base64,<?= base64_encode($album->jpeg); ?>" alt="cover de l'album" />
|
|
|
|
|
<nav class="short-text">Genre: <?= $album->genreName; ?></nav>
|
|
|
|
|
<footer class="short-text"><?= $album->year; ?> - <?= $album->artistName; ?></footer>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endforeach; ?>
|
2024-05-22 10:37:19 +02:00
|
|
|
</section>
|