233 lines
11 KiB
PHP
233 lines
11 KiB
PHP
<?php
|
|
|
|
require_once 'includes/globals.php';
|
|
require_once 'vendor/autoload.php';
|
|
|
|
use DJMixHosting\Database;
|
|
use DJMixHosting\Genre;
|
|
use DJMixHosting\Mix;
|
|
use DJMixHosting\Mixshow;
|
|
|
|
// if there's a query parameter named 'dj', load the DJ class
|
|
$db = new Database($config);
|
|
$mixshowFound = false;
|
|
if (isset($_GET['mixshow']) && $_GET['mixshow'] != "") {
|
|
$mixshow = new Mixshow($_GET['mixshow'], $db);
|
|
if ($mixshow->get_name() != "") {
|
|
|
|
$mixshowFound = true;
|
|
$title = $mixshow->get_name();
|
|
}
|
|
}
|
|
|
|
require_once 'includes/header.php';
|
|
?>
|
|
<section>
|
|
<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"><a href="/mixshows"><?php echo $locale['mixshows']; ?></a></li>
|
|
<li class="breadcrumb-item active"
|
|
aria-current="page"><?php
|
|
if ($mixshow && $mixshow->get_name() != "") {
|
|
echo $mixshow->get_name();
|
|
} else {
|
|
echo $locale['notfound'];
|
|
}
|
|
?></li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ($mixshowFound): ?>
|
|
<div class="row">
|
|
<div class="col-lg-4">
|
|
<div class="card mb-4">
|
|
<div class="card-body bg-body-secondary text-center">
|
|
<img src="<?php echo $mixshow->get_cover(); ?>"
|
|
alt="avatar"
|
|
class="rounded-circle img-fluid" style="width: 150px;">
|
|
<h5 class="my-3"><?php echo $mixshow->get_name(); ?></h5>
|
|
</div>
|
|
</div>
|
|
<div class="card mb-4">
|
|
<div class="card-body bg-body-secondary text-center ">
|
|
<a type="button" id="followBtn" class="w-100 mb-2 btn btn-secondary">
|
|
<?php echo $locale['follow']; ?>
|
|
</a>
|
|
<button type="button" id="shareBtn" class="w-100 mb-2 btn btn-secondary"
|
|
data-bs-toggle="modal" data-bs-target="#shareModal">
|
|
<?php echo $locale['share']; ?>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-8">
|
|
<div class="card mb-4">
|
|
<div class="card-body bg-body-secondary">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<p class="mb-0"><?php echo $locale['mixshowName']; ?></p>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
<p class="text-muted mb-0"><?php echo $mixshow->get_name(); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if ($mixshow->get_description() != "") {
|
|
echo box_line($locale['desc'], $mixshow->get_description());
|
|
}
|
|
echo box_line($locale['lastupdated'], $mixshow->get_updated());
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card mb-4">
|
|
<div class="card-body bg-body-secondary">
|
|
<?php
|
|
$mixes = $mixshow->get_mixes();
|
|
$count = 0;
|
|
|
|
foreach ($mixes as $mix) {
|
|
$output = new Mix($mix['mix_id'], $db);
|
|
$genres = $output->get_genres();
|
|
$genrelist = [];
|
|
|
|
foreach ($genres as $genre) {
|
|
$genr = new Genre($genre, $db);
|
|
$genrelist[$genr->get_slug()] = $genr->get_name();
|
|
}
|
|
|
|
echo '<div class="row">'; // Start row for each mix
|
|
|
|
// Column for mix name and link
|
|
echo '<div class="col-md">';
|
|
echo '<p class="mb-0 " >';
|
|
echo '<a href="/mix/' . $output->get_slug() . '">';
|
|
echo $output->get_name();
|
|
echo '</a>';
|
|
echo '</p>';
|
|
echo '</div>'; // End column
|
|
|
|
// Column for genres
|
|
echo '<div class="col-md ">';
|
|
echo '<p class="mb-0">';
|
|
foreach ($genrelist as $slug => $name) {
|
|
echo ' <a href="/genre/' . $slug . '">';
|
|
// ellipse the genre name if it's too long
|
|
echo '<span class="">' . $name . '</span>';
|
|
echo '</a>';
|
|
}
|
|
echo '</p>';
|
|
echo '</div>'; // End column
|
|
|
|
// Column for duration
|
|
echo '<div class="col-md">';
|
|
echo '<p class="mb-0">';
|
|
$duration = $output->get_duration();
|
|
echo $duration['t'];
|
|
echo '</p>';
|
|
echo '</div>'; // End column
|
|
|
|
// Column for date
|
|
echo '<div class="col-md">';
|
|
echo '<p class="mb-0">';
|
|
// date format should just be year
|
|
$date = $output->get_recorded();
|
|
if ($date == "") {
|
|
$date = $output->get_created();
|
|
}
|
|
echo date('Y', strtotime($date));
|
|
|
|
echo '</p>';
|
|
echo '</div>'; // End column
|
|
|
|
|
|
echo '</div>'; // End row
|
|
|
|
$count++;
|
|
// Add horizontal rule only if it's not the last mix
|
|
if ($count < count($mixes)) {
|
|
echo '<hr>';
|
|
}
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal fade" id="shareModal" tabindex="-1" aria-labelledby="shareModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="shareModalLabel"><?php echo $locale['share']; ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<?php
|
|
$url = 'https://utahsdjs.com/mixshow/' . $_GET['mixshow'];
|
|
$utm_params = '?utm_source=website&utm_medium=share_modal&utm_campaign=sharing';
|
|
$share_url = urlencode($url . $utm_params);
|
|
?>
|
|
<a href="#" id="copyLinkBtn" class="btn btn-secondary w-100 mb-2">Copy URL</a>
|
|
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $share_url; ?>"
|
|
target="_blank" class="btn btn-primary w-100 mb-2" onclick="hideModal()">Share to
|
|
Facebook</a>
|
|
<a href="https://twitter.com/intent/tweet?url=<?php echo $share_url; ?>"
|
|
target="_blank" class="btn btn-info w-100 mb-2" onclick="hideModal()">Share to Twitter</a>
|
|
<a href="https://www.instagram.com/" target="_blank" class="btn btn-danger w-100"
|
|
onclick="hideModal()">Share to Instagram</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
var shareBtn = document.getElementById('shareBtn');
|
|
var shareModal = new bootstrap.Modal(document.getElementById('shareModal'));
|
|
var copyLinkBtn = document.getElementById("copyLinkBtn");
|
|
var urlToCopy = window.location.href + '?utm_source=website&utm_medium=share_modal&utm_campaign=sharing';
|
|
|
|
shareBtn.addEventListener('click', function () {
|
|
shareModal.show();
|
|
});
|
|
|
|
copyLinkBtn.onclick = function () {
|
|
navigator.clipboard.writeText(urlToCopy).then(function () {
|
|
alert('URL copied to clipboard');
|
|
shareModal.hide();
|
|
}, function (err) {
|
|
alert('Failed to copy URL: ' + err);
|
|
});
|
|
}
|
|
|
|
window.hideModal = function () {
|
|
shareModal.hide();
|
|
}
|
|
});
|
|
</script>
|
|
<?php else: ?>
|
|
<div class="row">
|
|
<div class="col">
|
|
<div class="alert alert-danger" role="alert">
|
|
<?php echo $locale['mixshowNotFound']; ?>
|
|
</div>
|
|
</div>
|
|
</div><?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<?php require_once 'includes/footer.php'; ?>
|