Meh
parent
02619b31b2
commit
968ab11917
|
@ -5,6 +5,7 @@
|
|||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
|
||||
<link rel="Stylesheet" type="text/css" href="style.css"/>
|
||||
<link rel="Stylesheet" type="text/css" href="suchergebnisse.css"/>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<title>Candle Bibliothek | Löschen Meine Bücher</title>
|
||||
<link rel="icon" href="pictures/candle.png">
|
||||
|
@ -48,31 +49,192 @@
|
|||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="hauptcontainer">
|
||||
<?php
|
||||
$servername = "localhost";
|
||||
$username = "web_b-3";
|
||||
$password = "een7Ao6s";
|
||||
$dbname = "bibliothek_candle";
|
||||
|
||||
<div class="hauptcontainer" id="verlängerung">
|
||||
<h1 id="verlängerungH1">Reservierung stornieren</h1>
|
||||
<div id="verlängerungContent">
|
||||
<p id="möchten-sie">Möchten Sie die Reservierung für das folgende Buch wirklich stornieren?</p>
|
||||
$connection =
|
||||
mysqli_connect($servername, $username, $password, $dbname);
|
||||
|
||||
<div class="item" id="verlängerungItem">
|
||||
<img src="pictures/the_hundred_and_one_dalmatians.jpg" alt="The Hundred and One Dalmatians" height="200">
|
||||
<div class="beschreibung">
|
||||
<h2>The Hundred and One Dalmatians</h2>
|
||||
<h3>von Dodie Smith</h3>
|
||||
<div class="b2 red">Abholbereit am: 03.05.2023</div>
|
||||
</div>
|
||||
</div>
|
||||
if (!$connection) {
|
||||
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
||||
}
|
||||
|
||||
<div id="verlängerungButtonContainer">
|
||||
<a id = "verlängerungButton1" href="loeschenErfolgreich_meine_buecher.html">Bestätigen</a>
|
||||
<a id = "verlängerungButton2" href="meinebuecher.php">Abbrechen</a>
|
||||
</div>
|
||||
/* 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;;");
|
||||
|
||||
</div>
|
||||
// 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'];
|
||||
|
||||
/* 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;
|
||||
// Sofort Abholbereit
|
||||
if (currentElement.innerHTML.trim() === 'Sofort Abholbereit') {
|
||||
parentDiv.style.backgroundColor
|
||||
= '#70AD47';
|
||||
document.getElementById('bestellungsInfo$ausleihID').innerHTML = 'Diese Reservierung verfällt, wenn das Buch nicht bis zum $bookStartdatePlusSeven abgeholt wurde.';
|
||||
document.getElementById('placeholder$ausleihID').classList.add('bin');
|
||||
document.getElementById('placeholder_container$ausleihID').addEventListener('click', function(){
|
||||
if (!e) var e = window.event;
|
||||
e.cancelBubble = true;
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
ID = this.id;
|
||||
var data = new URLSearchParams();
|
||||
data.append('ausleihID', ID);
|
||||
var url = 'http://141.19.142.11/loeschen_meine_buecher.php?' + data.toString();
|
||||
location.href = url;
|
||||
});
|
||||
}
|
||||
// Ausgeliehen und Verlängerbar
|
||||
else if (currentElement.innerHTML.trim().includes('Rückgabe') && $bookExtendable === 1){
|
||||
parentDiv.style.backgroundColor
|
||||
= '#70AD47';
|
||||
document.getElementById('placeholder$ausleihID').classList.add('extend');
|
||||
}
|
||||
// Ausgeliehen und nicht Verlängerbar
|
||||
else if (currentElement.innerHTML.trim().includes('Rückgabe') && $bookExtendable === 0){
|
||||
parentDiv.style.backgroundColor
|
||||
= '#F34343';
|
||||
} else
|
||||
// Noch nicht Ausgeliehen
|
||||
{
|
||||
parentDiv.style.backgroundColor
|
||||
= '#F34343';
|
||||
document.getElementById('bestellungsInfo$ausleihID').innerHTML = 'Dieses Buch ist für sie Reserviert.';
|
||||
document.getElementById('placeholder$ausleihID').classList.add('bin');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</div>";
|
||||
}
|
||||
} else {
|
||||
echo "Keine Infos vorhanden.";
|
||||
echo $_POST['ausleihID'];
|
||||
}
|
||||
|
||||
if (!$result) {
|
||||
die("Ungültige SQL-Abfrage: " . mysqli_connect_error());
|
||||
}
|
||||
|
||||
mysqli_close($connection);
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
<!--<div class="hauptcontainer" id="verlängerung">-->
|
||||
<!-- <h1 id="verlängerungH1">Reservierung stornieren</h1>-->
|
||||
<!-- <div id="verlängerungContent">-->
|
||||
<!-- <p id="möchten-sie">Möchten Sie die Reservierung für das folgende Buch wirklich stornieren?</p>-->
|
||||
<!---->
|
||||
<!-- <div class="item" id="verlängerungItem">-->
|
||||
<!-- <img src="pictures/the_hundred_and_one_dalmatians.jpg" alt="The Hundred and One Dalmatians" height="200">-->
|
||||
<!-- <div class="beschreibung">-->
|
||||
<!-- <h2>The Hundred and One Dalmatians</h2>-->
|
||||
<!-- <h3>von Dodie Smith</h3>-->
|
||||
<!-- <div class="b2 red">Abholbereit am: 03.05.2023</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!---->
|
||||
<!-- <div id="verlängerungButtonContainer">-->
|
||||
<!-- <a id = "verlängerungButton1" href="loeschenErfolgreich_meine_buecher.html">Bestätigen</a>-->
|
||||
<!-- <a id = "verlängerungButton2" href="meinebuecher.php">Abbrechen</a>-->
|
||||
<!-- </div>-->
|
||||
<!---->
|
||||
<!-- </div>-->
|
||||
<!---->
|
||||
<!--</div>-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -51,11 +51,8 @@
|
|||
</header>
|
||||
<?php
|
||||
session_start();
|
||||
$db_link = mysqli_connect('localhost', 'web_b-3', 'een7Ao6s', 'bibliothek_candle', '3306');
|
||||
|
||||
|
||||
if($row['COUNT(*)'] > 0){
|
||||
|
||||
$_SESSION['eingeloggt'] = 1;
|
||||
echo '
|
||||
|
||||
<div class="hauptcontainer">
|
||||
|
@ -147,7 +144,7 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div class='placeholder_container'>
|
||||
<div class='placeholder_container' id='placeholder_container$ausleihID'>
|
||||
<div class='placeholder' id='placeholder$ausleihID'></div>
|
||||
</div>
|
||||
<script type='text/javascript'
|
||||
|
@ -162,7 +159,16 @@
|
|||
= '#70AD47';
|
||||
document.getElementById('bestellungsInfo$ausleihID').innerHTML = 'Diese Reservierung verfällt, wenn das Buch nicht bis zum $bookStartdatePlusSeven abgeholt wurde.';
|
||||
document.getElementById('placeholder$ausleihID').classList.add('bin');
|
||||
document.getElementById('placeholder$ausleihID').addEventListener('click', )
|
||||
document.getElementById('placeholder_container$ausleihID').addEventListener('click', function(){
|
||||
if (!e) var e = window.event;
|
||||
e.cancelBubble = true;
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
ID = this.id;
|
||||
var data = new URLSearchParams();
|
||||
data.append('ausleihID', ID);
|
||||
var url = 'http://141.19.142.11/loeschen_meine_buecher.php?' + data.toString();
|
||||
location.href = url;
|
||||
});
|
||||
}
|
||||
// Ausgeliehen und Verlängerbar
|
||||
else if (currentElement.innerHTML.trim().includes('Rückgabe') && $bookExtendable === 1){
|
||||
|
@ -196,15 +202,6 @@
|
|||
}
|
||||
|
||||
mysqli_close($connection);
|
||||
|
||||
|
||||
}else if($zeile['COUNT(*)'] > 0){
|
||||
header("Location: passwort_stimmt_nicht.php");
|
||||
}else{
|
||||
header("Location: benutzer_existiert_nicht.php");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
@ -221,6 +218,14 @@
|
|||
data.toString();
|
||||
location.href = url;
|
||||
}
|
||||
|
||||
function bin (ID){
|
||||
// OnClick Event für open_bookDetails stoppen
|
||||
if (!e) var e = window.event;
|
||||
e.cancelBubble = true;
|
||||
if (e.stopPropagation) e.stopPropagation();
|
||||
alert(ID)
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--Link JS file-->
|
||||
|
|
Loading…
Reference in New Issue