106 lines
No EOL
3.1 KiB
PHP
106 lines
No EOL
3.1 KiB
PHP
<?php
|
|
|
|
// read toml config file
|
|
use Yosymfony\Toml\Toml;
|
|
|
|
$config = Toml::ParseFile('includes/config.toml');
|
|
require_once 'vendor/autoload.php';
|
|
require_once 'functions/i18n.php';
|
|
require_once 'includes/sessions.php';
|
|
require_once 'includes/lang_loader.php';
|
|
require_once 'classes/Database.php';
|
|
require_once 'classes/Genres.php';
|
|
|
|
$genresFound = false;
|
|
// if there's a query parameter named 'dj', load the DJ class
|
|
$db = new Database($config);
|
|
$genres = new Genres($db);
|
|
?>
|
|
<!doctype html >
|
|
<html lang="en">
|
|
<head>
|
|
<?php require 'includes/header.php'; ?>
|
|
<style>
|
|
.card {
|
|
height: 160px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.card-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.card-title {
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.card-text {
|
|
flex-grow: 1;
|
|
}
|
|
|
|
.btn {
|
|
margin-top: auto;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
<body style="background-color: #eee;">
|
|
<?php require 'includes/navbar.php'; ?>
|
|
<section style="background-color: #eee;">
|
|
<div class="container py-5">
|
|
<div class="row">
|
|
<div class="col">
|
|
<nav aria-label="breadcrumb" class="bg-body-tertiary rounded-3 p-3 mb-4">
|
|
<ol class="breadcrumb mb-0">
|
|
<li class="breadcrumb-item"><a href="/"><?php echo $locale['home']; ?></a></li>
|
|
<li class="breadcrumb-item active"><a href="/genres.php"><?php echo $locale['genres']; ?></a>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// we have a list of genres; we need to create them as cards
|
|
// loop through $genres->get_all_genres
|
|
// create a card for each genre, 4 max per row
|
|
|
|
$genres = $genres->get_nonzero_genres();
|
|
$count = 0;
|
|
foreach ($genres as $genre) {
|
|
if ($count % 4 == 0) {
|
|
echo '<div class="row">';
|
|
}
|
|
echo '<div class="col-md-3">';
|
|
echo '<div class="card mb-4">';
|
|
echo '<div class="card-body">';
|
|
echo '<h5 class="card-title" title="' . $genre['name'] . '">' . $genre['name'] . '</h5>';
|
|
echo '<p class="card-text">' . $genre['count'] . ' ';
|
|
if ($genre['count'] == 1) {
|
|
echo $locale['mix'];
|
|
} else {
|
|
echo $locale['mixes'];
|
|
}
|
|
echo '</p>';
|
|
echo '<a href="/genre.php?genre=' . $genre['slug'] . '" class="btn btn-primary">' . $locale['view'] . '</a>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
if ($count % 4 == 3) {
|
|
echo '</div>';
|
|
}
|
|
$count++;
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
</section>
|
|
<?php require 'includes/footer.php'; ?>
|
|
</body>
|
|
</html>
|