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-14 21:06:12 +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">
|
2023-06-14 21:06:12 +02:00
|
|
|
<title>Candle Bibliothek | Verlängerung Meine Bücher</title>
|
2023-05-26 16:39:10 +02:00
|
|
|
<link rel="icon" href="pictures/candle.png">
|
|
|
|
<script src="burgerIcon.js"></script>
|
2023-06-12 10:30:40 +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
|
2023-06-14 21:06:12 +02:00
|
|
|
session_start();
|
|
|
|
if(isset($_SESSION["eingeloggt"]) && $_SESSION["eingeloggt"] == 1 ){
|
|
|
|
echo "<a id='abmelden' href='abmelden.php'>Abmelden</a>";}
|
2023-06-12 16:17:49 +02:00
|
|
|
?>
|
|
|
|
<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>
|
2023-06-14 20:31:11 +02:00
|
|
|
<a href="warenkorb.php" id="warenKorbID">
|
2023-06-12 16:17:49 +02:00
|
|
|
<img id="shoppingCard" src="pictures/einkaufswagen.png"
|
|
|
|
alt="Bild von einem Wagen" width="50" height="50"/>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</header>
|
2023-06-14 21:06:12 +02:00
|
|
|
<div class="hauptcontainer"id="verlängerung">
|
|
|
|
<h1 id="verlängerungH1">Buch verlängern</h1>
|
|
|
|
<div id="verlängerungContent">
|
|
|
|
<p id="möchten-sie">Möchten Sie das folgende Buch um 7 Tage verlängern?</p>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-14 21:06:12 +02:00
|
|
|
<div id="searchResult_container">
|
|
|
|
<?php
|
|
|
|
$servername = "localhost";
|
|
|
|
$username = "web_b-3";
|
|
|
|
$password = "een7Ao6s";
|
|
|
|
$dbname = "bibliothek_candle";
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-14 21:06:12 +02:00
|
|
|
$connection =
|
|
|
|
mysqli_connect($servername, $username, $password, $dbname);
|
|
|
|
|
|
|
|
if (!$connection) {
|
|
|
|
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SQL-Befehl vorbereiten */
|
|
|
|
$sql = $connection->prepare("SELECT ab.AusleihID, ab.BuchID, b.Titel, b.Bild, ab.Verlängerbar, DATE_FORMAT(ab.Anfangsdatum, '%d.%m.%Y') as Anfangsdatum, DATE_FORMAT(ab.Enddatum, '%d.%m.%Y') as Enddatum,
|
|
|
|
GROUP_CONCAT(DISTINCT CONCAT(a.VorName, ' ', a.NachName)
|
|
|
|
SEPARATOR ', ') AS 'Autor',
|
|
|
|
IF(
|
|
|
|
(SELECT ausgeliehenes_buch.Anfangsdatum FROM ausgeliehenes_buch WHERE ausgeliehenes_buch.AusleihID=ab.AusleihID) = Curdate(), 'Sofort Abholbereit',
|
|
|
|
(
|
|
|
|
IF(
|
|
|
|
(SELECT ausgeliehenes_buch.Anfangsdatum FROM ausgeliehenes_buch WHERE ausgeliehenes_buch.AusleihID=ab.AusleihID) > Curdate(),
|
|
|
|
CONCAT(
|
|
|
|
'Abholbereit am: ', (
|
|
|
|
SELECT DATE_FORMAT(
|
|
|
|
ausgeliehenes_buch.Anfangsdatum , '%d.%m.%Y'
|
|
|
|
) FROM ausgeliehenes_buch WHERE ausgeliehenes_buch.AusleihID=ab.AusleihID
|
|
|
|
)
|
|
|
|
)
|
|
|
|
, CONCAT(
|
|
|
|
'Rückgabe am: ', (
|
|
|
|
SELECT DATE_FORMAT(
|
|
|
|
ausgeliehenes_buch.Enddatum , '%d.%m.%Y'
|
|
|
|
) FROM ausgeliehenes_buch WHERE ausgeliehenes_buch.AusleihID=ab.AusleihID
|
|
|
|
)
|
|
|
|
))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
AS 'Verfügbarkeit'
|
|
|
|
FROM ausgeliehenes_buch AS ab
|
|
|
|
INNER JOIN buch as b
|
|
|
|
ON ab.BuchID = b.BuchID
|
|
|
|
INNER JOIN `buch_verfasst_von_autor` AS bvva
|
|
|
|
ON b.BuchID = bvva.BuchID
|
|
|
|
INNER JOIN `autor` AS a ON bvva.AutorNr = a.AutorNr
|
|
|
|
WHERE ab.AusleihID=?
|
|
|
|
GROUP BY ab.AusleihID;;");
|
|
|
|
|
|
|
|
// Parameter binden
|
|
|
|
$sql->bind_param("i", $ID);
|
|
|
|
|
|
|
|
// Übergebene ID des angeklickten Container speichern
|
|
|
|
$containerID = $_GET['ausleihID'];
|
|
|
|
|
|
|
|
// Buch ID abtrennen
|
|
|
|
$ID = str_replace('placeholder_container', '', $containerID);
|
|
|
|
|
|
|
|
|
|
|
|
// SQL-Befehl ausführen
|
|
|
|
$sql->execute();
|
|
|
|
|
|
|
|
// Ergebnis speichern
|
|
|
|
$result = $sql->get_result();
|
|
|
|
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
|
|
while($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$bookID = $row['BuchID'];
|
|
|
|
$ausleihID = $row['AusleihID'];
|
|
|
|
$bookCover = $row['Bild'];
|
|
|
|
$bookTitle = $row['Titel'];
|
|
|
|
$bookAuthor = $row['Autor'];
|
|
|
|
$bookAvailability = $row['Verfügbarkeit'];
|
|
|
|
$bookExtendable = $row['Verlängerbar'];
|
|
|
|
$bookStartdate = $row['Anfangsdatum'];
|
|
|
|
$bookEnddate = $row['Enddatum'];
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-14 21:06:12 +02:00
|
|
|
$bookStartdatePlusSeven = $bookStartdate +7;
|
|
|
|
|
|
|
|
/* TODO: OnClick auslagern. */
|
|
|
|
echo "<div id='book_container$bookID+$ausleihID' class='book_container'
|
|
|
|
onclick='open_bookDetails(this.id)'>
|
|
|
|
<div class='bookCover_container'>
|
|
|
|
<img class='bookCover' src='book_covers/$bookCover'
|
|
|
|
alt='Kein Bild vorhanden'>
|
|
|
|
</div>
|
|
|
|
<div class='bookDetails_container'>
|
|
|
|
<h2 class='bookTitle'>$bookTitle</h2>
|
|
|
|
<div class='bookDetails'>
|
|
|
|
<p class='author'>von $bookAuthor</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class='available_container'>
|
|
|
|
<p id='available_$ausleihID' class='available'>
|
|
|
|
$bookAvailability</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p id='bestellungsInfo$ausleihID'></p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class='placeholder_container' id='placeholder_container$ausleihID'>
|
|
|
|
<div class='placeholder' id='placeholder$ausleihID'></div>
|
|
|
|
</div>
|
|
|
|
<script type='text/javascript'
|
|
|
|
language='JavaScript'>
|
|
|
|
(function() {
|
|
|
|
var currentElement = document.
|
|
|
|
getElementById('available_$ausleihID');
|
|
|
|
var parentDiv = currentElement.parentElement;
|
|
|
|
// Ausgeliehen und Verlängerbar
|
|
|
|
parentDiv.style.backgroundColor
|
|
|
|
= '#70AD47';
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</div>";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "Keine Infos vorhanden.";
|
|
|
|
echo $_POST['ausleihID'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$result) {
|
|
|
|
die("Ungültige SQL-Abfrage: " . mysqli_connect_error());
|
|
|
|
}
|
|
|
|
echo "
|
|
|
|
<div id='verlängerungButtonContainer'>
|
|
|
|
<a id = 'verlängerungButton1' href='verlaengerung_erfolgreich.php?ausleihID=$ID&buchID=$bookID'>Bestätigen</a>
|
|
|
|
<a id = 'verlängerungButton2' href='meinebuecher.php'>Abbrechen</a>
|
|
|
|
</div>";
|
|
|
|
mysqli_close($connection);
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
</div>
|
2023-05-26 16:39:10 +02:00
|
|
|
</div>
|
2023-06-14 21:06:12 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-26 16:39:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-14 21:06:12 +02:00
|
|
|
<!--Link JS file-->
|
|
|
|
<!--If it was small and got big, it calls the function only one time and doesn't do it all the time-->
|
2023-06-14 12:04:25 +02:00
|
|
|
<script src="resize.js"></script>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-12 11:23:37 +02:00
|
|
|
<nav id="activeid" class="active"></nav>
|
2023-05-26 16:39:10 +02:00
|
|
|
|
2023-06-12 10:30:40 +02:00
|
|
|
<footer id="footer" class="fuss" ></footer>
|
2023-05-26 16:39:10 +02:00
|
|
|
</body>
|
|
|
|
|
2023-05-31 13:51:15 +02:00
|
|
|
</html>
|