parent
8fc8c48414
commit
2730d10153
|
@ -27,6 +27,7 @@
|
|||
display: flex;
|
||||
/*Einzelne Elemente nebeneinander anzeigen.*/
|
||||
flex-direction: row;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bookCover_container {
|
||||
|
|
|
@ -64,7 +64,24 @@
|
|||
$dropdown3 = $_GET['dropdown3'];
|
||||
$search3 = $_GET['search3'];
|
||||
|
||||
/* TODO: Datum/Jahr */
|
||||
$startYear = $_GET['Buchdatum1'];
|
||||
$startYear = substr($startYear, 0, 4);
|
||||
$endYear = $_GET['Buchdatum2'];
|
||||
$endYear = substr($endYear, 0, 4);
|
||||
$yearQuery = '';
|
||||
/* Nur Startjahr */
|
||||
if ($startYear && !$endYear) {
|
||||
$yearQuery = "WHERE b.Erscheinungsjahr > $startYear";
|
||||
}
|
||||
/* Nur Endjahr */
|
||||
else if (!$startYear && $endYear) {
|
||||
$yearQuery = "WHERE b.Erscheinungsjahr < $endYear";
|
||||
}
|
||||
/* Start- und Endjahr */
|
||||
else if ($startYear && $endYear) {
|
||||
$yearQuery =
|
||||
"WHERE b.Erscheinungsjahr BETWEEN $startYear AND $endYear";
|
||||
}
|
||||
|
||||
$language = $_GET['language'];
|
||||
if ($language == 'Alle Sprachen') {
|
||||
|
@ -81,18 +98,22 @@
|
|||
|
||||
/* SQL-Befehl zusammenstellen */
|
||||
$sql = "SELECT b.BuchID, b.Titel, b.Erscheinungsjahr, b.Bild,
|
||||
b.Verlag, GROUP_CONCAT(DISTINCT CONCAT(a.VorName, ' ', a.NachName) SEPARATOR ', ') AS 'Autor',
|
||||
b.Verlag, GROUP_CONCAT(DISTINCT CONCAT(a.VorName, ' ', a.NachName)
|
||||
SEPARATOR ', ') AS 'Autor',
|
||||
GROUP_CONCAT(DISTINCT k.Name SEPARATOR ', ') AS 'Kategorie',
|
||||
b.ISBN, b.Klappentext AS 'Inhalt', sp.Bezeichnung AS 'Sprache',
|
||||
GROUP_CONCAT(DISTINCT st.Text SEPARATOR ', ') AS 'Stichwort',
|
||||
IF(b.Anzahl!=0, 'Verfügbar', CONCAT('Verfügbar ab: ', 'Test!')) AS 'Verfügbarkeit' FROM `buch` AS b
|
||||
INNER JOIN `buch_verfasst_von_autor` AS bvva ON b.BuchID = bvva.BuchID
|
||||
IF(b.Anzahl!=0, 'Verfügbar', CONCAT('Verfügbar ab: ', 'Test!'))
|
||||
AS 'Verfügbarkeit' FROM `buch` AS b
|
||||
INNER JOIN `buch_verfasst_von_autor` AS bvva
|
||||
ON b.BuchID = bvva.BuchID
|
||||
INNER JOIN `autor` AS a ON bvva.AutorNr = a.AutorNr
|
||||
INNER JOIN `buch_hat_kategorie` AS bhk ON bhk.BuchID = b.BuchID
|
||||
INNER JOIN `kategorie` AS k ON k.KategorieID = bhk.KategorieID
|
||||
INNER JOIN `sprache` AS sp ON sp.SprachenID = b.SprachenID
|
||||
INNER JOIN `buch_hat_stichwort` AS bhs ON bhs.BuchID = b.BuchID
|
||||
INNER JOIN `stichwort` AS st ON st.StichwortID = bhs.StichwortID
|
||||
$yearQuery
|
||||
GROUP BY b.BuchID
|
||||
HAVING $dropdown1 LIKE '%$search1%'
|
||||
$andOr1 $dropdown2 LIKE '%$search2%'
|
||||
|
@ -105,7 +126,8 @@
|
|||
$password = "een7Ao6s";
|
||||
$dbname = "bibliothek_candle";
|
||||
|
||||
$connection = mysqli_connect($servername, $username, $password, $dbname);
|
||||
$connection =
|
||||
mysqli_connect($servername, $username, $password, $dbname);
|
||||
|
||||
if (!$connection) {
|
||||
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
||||
|
@ -127,31 +149,43 @@
|
|||
if ($counter != 0) {
|
||||
echo "<div class='divider'></div>";
|
||||
}
|
||||
|
||||
echo "<div class='book_container'>
|
||||
/* TODO: OnClick auslagern. */
|
||||
echo "<div id='book_container$bookID' class='book_container'
|
||||
onclick='open_bookDetails(this.id)'>
|
||||
<div class='bookCover_container'>
|
||||
<img class='bookCover' src='pictures/$bookCover' alt='Kein Bild vorhanden'>
|
||||
<img class='bookCover' src='pictures/$bookCover'
|
||||
alt='Kein Bild vorhanden'>
|
||||
</div>
|
||||
<div class='bookDetails_container'>
|
||||
<h2 class='bookTitle'>$bookTitle</h2>
|
||||
<div class='bookDetails'>
|
||||
<p class='author'>Verfasser: $bookAuthor</p>
|
||||
<p class='publishing_year'>Erscheinungsjahr: $bookPublishingYear</p>
|
||||
<p class='publisher'>Verlag: $bookPublisher</p>
|
||||
<p class='category'>Kategorie: $bookCategory</p>
|
||||
<p class='publishing_year'>
|
||||
Erscheinungsjahr: $bookPublishingYear</p>
|
||||
<p class='publisher'>
|
||||
Verlag: $bookPublisher</p>
|
||||
<p class='category'>
|
||||
Kategorie: $bookCategory</p>
|
||||
</div>
|
||||
<div class='available_container'>
|
||||
<p id='available_$bookID' class='available'>$bookAvailability</p>
|
||||
<p id='available_$bookID' class='available'>
|
||||
$bookAvailability</p>
|
||||
<!--TODO: Auslagern-->
|
||||
<script type='text/javascript' language='JavaScript'>
|
||||
<script type='text/javascript'
|
||||
language='JavaScript'>
|
||||
(function() {
|
||||
var currentElement = document.getElementById('available_$bookID');
|
||||
var parentDiv = currentElement.parentElement;
|
||||
if (currentElement.innerHTML == 'Verfügbar') {
|
||||
parentDiv.style.backgroundColor = '#70AD47';
|
||||
var currentElement = document.
|
||||
getElementById('available_$bookID');
|
||||
var parentDiv =
|
||||
currentElement.parentElement;
|
||||
if (currentElement.innerHTML.trim()
|
||||
== 'Verfügbar') {
|
||||
parentDiv.style.backgroundColor
|
||||
= '#70AD47';
|
||||
}
|
||||
else {
|
||||
parentDiv.style.backgroundColor = '#F34343';
|
||||
parentDiv.style.backgroundColor
|
||||
= '#F34343';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
@ -173,12 +207,23 @@
|
|||
|
||||
mysqli_close($connection);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
function open_bookDetails(ID) {
|
||||
var data = new URLSearchParams();
|
||||
data.append("bookID", ID);
|
||||
|
||||
var url = "http://141.19.142.11/buch_details.php?" +
|
||||
data.toString();
|
||||
location.href = url;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!------------------------------------------------------------------------->
|
||||
|
||||
<!--Link JS file-->
|
Loading…
Reference in New Issue