2024-06-10 09:52:24 +02:00
|
|
|
|
2024-06-16 21:57:34 +02:00
|
|
|
|
2024-06-10 12:26:53 +02:00
|
|
|
<?php $page = preg_split('/[\/]/',$_SERVER['REQUEST_URI']);
|
|
|
|
|
if($page[count($page)-2] != 'viewAlbum'){ ?>
|
2024-06-10 09:52:24 +02:00
|
|
|
<h5>Filter Albums</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>
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
|
<button type="submit">Apply Filters</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<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>
|
2024-06-10 12:26:53 +02:00
|
|
|
<?php } ?>
|
2024-06-10 09:52:24 +02:00
|
|
|
|
2024-05-22 10:37:19 +02:00
|
|
|
<h5>Albums list</h5>
|
|
|
|
|
<section class="list">
|
|
|
|
|
<?php
|
2024-06-16 21:57:34 +02:00
|
|
|
$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;
|
|
|
|
|
}
|
2024-06-16 19:05:37 +02:00
|
|
|
}
|
2024-06-05 10:32:50 +02:00
|
|
|
|
2024-05-22 10:37:19 +02:00
|
|
|
foreach($albums as $album){
|
2024-06-05 10:32:50 +02:00
|
|
|
|
2024-05-22 10:37:19 +02:00
|
|
|
echo "<div><article>";
|
|
|
|
|
echo "<header class='short-text'>";
|
2024-06-05 10:32:50 +02:00
|
|
|
echo anchor("albums/viewMusique/{$album->albumId}","{$album->name}");
|
2024-06-16 19:05:37 +02:00
|
|
|
if($this->session->userdata('logged_in')){
|
|
|
|
|
echo anchor("albums/addAlbumtoPlaylist/{$album->albumId}?page={$url}","<i class='fa fa-plus'></i>");
|
|
|
|
|
}
|
2024-05-22 10:37:19 +02:00
|
|
|
echo "</header>";
|
|
|
|
|
echo '<img src="data:image/jpeg;base64,'.base64_encode($album->jpeg).'" />';
|
2024-05-22 12:11:07 +02:00
|
|
|
echo "<nav class='short-text'>Genre: {$album->genreName}</nav>";
|
2024-05-22 10:37:19 +02:00
|
|
|
echo "<footer class='short-text'>{$album->year} - {$album->artistName}</footer>
|
|
|
|
|
</article></div>";
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</section>
|