2023-05-26 16:39:10 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta lang="de"/>
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
|
|
|
|
<link rel="Stylesheet" type="text/css" href="style.css"/>
|
2023-06-03 16:53:27 +02:00
|
|
|
<link rel="Stylesheet" type="text/css" href="suchergebnisse.css"/>
|
2023-05-26 16:39:10 +02:00
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
|
|
<title>Candle Bibliothek | Bücher</title>
|
|
|
|
<link rel="icon" href="pictures/candle.png">
|
2023-06-03 16:34:55 +02:00
|
|
|
<script src="notwendiges_laden.js" defer></script>
|
2023-05-26 16:39:10 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2023-06-12 16:17:49 +02:00
|
|
|
<header id="header">
|
|
|
|
<h1 class="kopf" >
|
|
|
|
<br><br>
|
|
|
|
Bibliothek
|
|
|
|
<a href="index.php" id="bildID">
|
|
|
|
<img id="CandleID" src="pictures/candle.png"
|
|
|
|
alt="Bild von einer Kerze" width="200" height="192"/></a>
|
|
|
|
<br><br>
|
|
|
|
Candle
|
|
|
|
</h1>
|
|
|
|
<div>
|
|
|
|
<a id="uberuns" href="uberuns.php">Über Uns</a>
|
|
|
|
<a id="buecher" href="buecher.php">Bücher</a>
|
|
|
|
<a id="meinebuecher" href="anmelden_meinebuecher.php">
|
|
|
|
Meine Bücher</a>
|
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
if(isset($_SESSION["eingeloggt"]) && $_SESSION["eingeloggt"] == 1 ){
|
|
|
|
echo "<a id='abmelden' href='abmelden.php'>Abmelden</a>";}
|
|
|
|
?>
|
|
|
|
<form action="suchergebnisse.php">
|
|
|
|
<input type="hidden" name="searchType" value="simple">
|
|
|
|
<input name="searchFor" class="suchleiste" type="search"
|
|
|
|
placeholder="Suche...">
|
|
|
|
<button type="submit" id="buttonID" class="searchButton">
|
|
|
|
<i class="fa fa-search"></i>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
<a id="erweitertesuche" href="erweitertesuche.php">
|
|
|
|
Erweiterte Suche</a>
|
|
|
|
<a href="anmelden.php" id="warenKorbID">
|
|
|
|
<img id="shoppingCard" src="pictures/einkaufswagen.png"
|
|
|
|
alt="Bild von einem Wagen" width="50" height="50"/>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</header>
|
2023-06-07 09:11:18 +02:00
|
|
|
<div class="hauptcontainer">
|
2023-06-07 09:28:03 +02:00
|
|
|
<h1 id="searchResult_heading">Bücher</h1>
|
|
|
|
<div id="searchResult_container">
|
2023-06-03 16:53:27 +02:00
|
|
|
<?php
|
|
|
|
$sql = '';
|
|
|
|
|
|
|
|
// 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',
|
|
|
|
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',
|
2023-06-07 09:28:03 +02:00
|
|
|
IF(b.Anzahl!=0, 'Verfügbar', CONCAT('Verfügbar ab: ',
|
|
|
|
(SELECT DATE_FORMAT(DATE_ADD(ab.Enddatum, INTERVAL 1 DAY)
|
|
|
|
,'%d.%m.%Y') FROM `ausgeliehenes_buch` AS ab
|
|
|
|
WHERE ab.BuchID = b.BuchID
|
|
|
|
ORDER BY ab.Reserviert ASC, ab.Enddatum ASC LIMIT 1)))
|
2023-06-03 16:53:27 +02:00
|
|
|
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
|
|
|
|
GROUP BY b.BuchID
|
|
|
|
;";
|
|
|
|
|
|
|
|
$servername = "localhost";
|
|
|
|
$username = "web_b-3";
|
|
|
|
$password = "een7Ao6s";
|
|
|
|
$dbname = "bibliothek_candle";
|
|
|
|
|
|
|
|
$connection =
|
|
|
|
mysqli_connect($servername, $username, $password, $dbname);
|
|
|
|
|
|
|
|
if (!$connection) {
|
|
|
|
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = mysqli_query($connection, $sql);
|
|
|
|
$counter = 0;
|
2023-06-07 09:28:03 +02:00
|
|
|
|
2023-06-03 16:53:27 +02:00
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
|
|
while($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$bookID = $row['BuchID'];
|
|
|
|
$bookCover = $row['Bild'];
|
|
|
|
$bookTitle = $row['Titel'];
|
|
|
|
$bookPublishingYear = $row['Erscheinungsjahr'];
|
|
|
|
$bookPublisher = $row['Verlag'];
|
|
|
|
$bookAuthor = $row['Autor'];
|
|
|
|
$bookCategory = $row['Kategorie'];
|
|
|
|
$bookAvailability = $row['Verfügbarkeit'];
|
|
|
|
|
|
|
|
if ($counter != 0) {
|
|
|
|
echo "<div class='divider'></div>";
|
|
|
|
}
|
|
|
|
// TODO: OnClick auslagern.
|
|
|
|
echo "<div id='book_container$bookID' class='book_container'
|
|
|
|
onclick='open_bookDetails(this.id)'>
|
|
|
|
<div class='bookCover_container'>
|
2023-06-08 15:12:13 +02:00
|
|
|
<img class='bookCover'
|
|
|
|
src='book_covers/$bookCover'
|
|
|
|
alt='Kein Bild vorhanden'>
|
2023-06-03 16:53:27 +02:00
|
|
|
</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>
|
|
|
|
</div>
|
|
|
|
<div class='available_container'>
|
|
|
|
<p id='available_$bookID' class='available'>
|
|
|
|
$bookAvailability</p>
|
|
|
|
<!--TODO: Auslagern-->
|
|
|
|
<script type='text/javascript'
|
|
|
|
language='JavaScript'>
|
|
|
|
(function() {
|
|
|
|
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';
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-06-13 12:22:38 +02:00
|
|
|
<!--TODO: OnClick Event auslagern-->
|
|
|
|
<div class='shoppingCart_container'
|
|
|
|
id='shoppingCart$bookID'
|
|
|
|
onclick='addBookToCart(this.id)'>
|
2023-06-03 16:53:27 +02:00
|
|
|
<div class='shoppingCart'></div>
|
|
|
|
</div>
|
|
|
|
</div>";
|
|
|
|
$counter++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "Keine Ergebnisse.";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$result) {
|
|
|
|
die("Ungültige SQL-Abfrage: " . mysqli_connect_error());
|
|
|
|
}
|
|
|
|
|
|
|
|
mysqli_close($connection);
|
|
|
|
|
|
|
|
?>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
|
|
|
</div>
|
2023-06-07 09:28:03 +02:00
|
|
|
</div>
|
2023-06-03 16:53:27 +02:00
|
|
|
|
2023-06-07 09:32:32 +02:00
|
|
|
|
|
|
|
<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;
|
|
|
|
}
|
2023-06-13 12:22:38 +02:00
|
|
|
|
|
|
|
function addBookToCart(ID) {
|
|
|
|
// OnClick Event für open_bookDetails stoppen
|
|
|
|
if (!e) var e = window.event;
|
|
|
|
e.cancelBubble = true;
|
|
|
|
if (e.stopPropagation) e.stopPropagation();
|
|
|
|
|
|
|
|
// ID abtrennen
|
|
|
|
ID = ID.replace('shoppingCart', '');
|
|
|
|
|
|
|
|
var request = new XMLHttpRequest();
|
|
|
|
request.open('POST',
|
|
|
|
'http://141.19.142.11/warenkorb_funktionen.php', true);
|
|
|
|
// TODO: Handler erstellen
|
|
|
|
request.onload = function() {
|
|
|
|
console.log(this.responseText);
|
|
|
|
}
|
|
|
|
request.setRequestHeader('Content-type',
|
|
|
|
'application/x-www-form-urlencoded');
|
|
|
|
request.send(`function=addBookToCart&id=${ID}`);
|
|
|
|
}
|
2023-06-07 09:32:32 +02:00
|
|
|
</script>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
|
|
|
<!--Link JS file-->
|
|
|
|
<script src="burgerIcon.js"></script>
|
|
|
|
<script>
|
|
|
|
var widthissue = false;
|
|
|
|
window.addEventListener("resize", function(event) {
|
|
|
|
if(window.innerWidth > 800 && widthissue) {
|
|
|
|
widthissue = false
|
|
|
|
unset()
|
|
|
|
}
|
|
|
|
else if(window.innerWidth < 800) widthissue = true;
|
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<!--Burger-->
|
2023-06-12 11:23:37 +02:00
|
|
|
<nav id="activeid" class="active"></nav>
|
2023-06-03 16:34:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
<footer id="footer" class="fuss" ></footer>
|
2023-05-26 16:39:10 +02:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
|